Use the E2EE extension
This commit is contained in:
parent
b9af4a585c
commit
104363b1ef
1 changed files with 16 additions and 0 deletions
|
@ -82,6 +82,7 @@ type RoomSubscriptionsRequest = {
|
||||||
|
|
||||||
type ExtensionsRequest = {
|
type ExtensionsRequest = {
|
||||||
to_device?: ToDeviceExtensionRequest;
|
to_device?: ToDeviceExtensionRequest;
|
||||||
|
e2ee?: E2EEExtensionRequest;
|
||||||
};
|
};
|
||||||
|
|
||||||
type ToDeviceExtensionRequest = {
|
type ToDeviceExtensionRequest = {
|
||||||
|
@ -90,6 +91,10 @@ type ToDeviceExtensionRequest = {
|
||||||
limit?: number;
|
limit?: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type E2EEExtensionRequest = {
|
||||||
|
enabled: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
interface Sync3RequestBody {
|
interface Sync3RequestBody {
|
||||||
session_id: string;
|
session_id: string;
|
||||||
lists: Sync3List[];
|
lists: Sync3List[];
|
||||||
|
@ -133,6 +138,7 @@ interface RoomResponse {
|
||||||
|
|
||||||
type ExtensionsResponse = {
|
type ExtensionsResponse = {
|
||||||
to_device?: ToDeviceExtensionResponse;
|
to_device?: ToDeviceExtensionResponse;
|
||||||
|
e2ee?: E2EEExtensionResponse;
|
||||||
};
|
};
|
||||||
|
|
||||||
type ToDeviceExtensionResponse = {
|
type ToDeviceExtensionResponse = {
|
||||||
|
@ -140,6 +146,11 @@ type ToDeviceExtensionResponse = {
|
||||||
events: any[];
|
events: any[];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type E2EEExtensionResponse = {
|
||||||
|
device_lists: any;
|
||||||
|
device_one_time_keys_count: any;
|
||||||
|
};
|
||||||
|
|
||||||
// Some internal data structure types
|
// Some internal data structure types
|
||||||
|
|
||||||
type IndexToRoomId = {
|
type IndexToRoomId = {
|
||||||
|
@ -366,6 +377,9 @@ export class Sync3 {
|
||||||
limit: 100,
|
limit: 100,
|
||||||
since: toDeviceSince,
|
since: toDeviceSince,
|
||||||
},
|
},
|
||||||
|
e2ee: {
|
||||||
|
enabled: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
if (this.nextRoomSubscriptions.length > 0) {
|
if (this.nextRoomSubscriptions.length > 0) {
|
||||||
|
@ -443,6 +457,8 @@ export class Sync3 {
|
||||||
try {
|
try {
|
||||||
// E2EE decrypts room keys
|
// E2EE decrypts room keys
|
||||||
const v2DeviceResponse = {
|
const v2DeviceResponse = {
|
||||||
|
device_one_time_keys_count: resp.extensions?.e2ee?.device_one_time_keys_count,
|
||||||
|
device_lists: resp.extensions?.e2ee?.device_lists,
|
||||||
to_device: {
|
to_device: {
|
||||||
events: resp.extensions?.to_device?.events,
|
events: resp.extensions?.to_device?.events,
|
||||||
},
|
},
|
||||||
|
|
Reference in a new issue