diff --git a/src/matrix/Sync3.ts b/src/matrix/Sync3.ts index 85c74db6..63f2365d 100644 --- a/src/matrix/Sync3.ts +++ b/src/matrix/Sync3.ts @@ -82,6 +82,7 @@ type RoomSubscriptionsRequest = { type ExtensionsRequest = { to_device?: ToDeviceExtensionRequest; + e2ee?: E2EEExtensionRequest; }; type ToDeviceExtensionRequest = { @@ -90,6 +91,10 @@ type ToDeviceExtensionRequest = { limit?: number; }; +type E2EEExtensionRequest = { + enabled: boolean; +}; + interface Sync3RequestBody { session_id: string; lists: Sync3List[]; @@ -133,6 +138,7 @@ interface RoomResponse { type ExtensionsResponse = { to_device?: ToDeviceExtensionResponse; + e2ee?: E2EEExtensionResponse; }; type ToDeviceExtensionResponse = { @@ -140,6 +146,11 @@ type ToDeviceExtensionResponse = { events: any[]; }; +type E2EEExtensionResponse = { + device_lists: any; + device_one_time_keys_count: any; +}; + // Some internal data structure types type IndexToRoomId = { @@ -366,6 +377,9 @@ export class Sync3 { limit: 100, since: toDeviceSince, }, + e2ee: { + enabled: true, + }, }, }; if (this.nextRoomSubscriptions.length > 0) { @@ -443,6 +457,8 @@ export class Sync3 { try { // E2EE decrypts room keys const v2DeviceResponse = { + device_one_time_keys_count: resp.extensions?.e2ee?.device_one_time_keys_count, + device_lists: resp.extensions?.e2ee?.device_lists, to_device: { events: resp.extensions?.to_device?.events, },