diff --git a/app/definitions/rest/v1/e2e.ts b/app/definitions/rest/v1/e2e.ts index 4e41ef56..b62f312f 100644 --- a/app/definitions/rest/v1/e2e.ts +++ b/app/definitions/rest/v1/e2e.ts @@ -1,5 +1,12 @@ +import { IUser } from '../../IUser'; + export type E2eEndpoints = { 'e2e.setUserPublicAndPrivateKeys': { POST: (params: { public_key: string; private_key: string }) => void; }; + 'e2e.getUsersOfRoomWithoutKey': { + GET: (params: { rid: string }) => { + users: Pick[]; + }; + }; }; diff --git a/app/lib/encryption/room.ts b/app/lib/encryption/room.ts index a68ccc49..ee351920 100644 --- a/app/lib/encryption/room.ts +++ b/app/lib/encryption/room.ts @@ -158,12 +158,12 @@ export default class EncryptionRoom { const result = await RocketChat.e2eGetUsersOfRoomWithoutKey(this.roomId); if (result.success) { const { users } = result; - await Promise.all(users.map((user: IUser) => this.encryptRoomKeyForUser(user))); + await Promise.all(users.map(user => this.encryptRoomKeyForUser(user))); } }; // Encrypt the room key to each user in - encryptRoomKeyForUser = async (user: IUser) => { + encryptRoomKeyForUser = async (user: Pick) => { if (user?.e2e?.public_key) { const { public_key: publicKey } = user.e2e; const userKey = await SimpleCrypto.RSA.importKey(EJSON.parse(publicKey)); diff --git a/app/lib/rocketchat/services/restApi.ts b/app/lib/rocketchat/services/restApi.ts index a3f148f0..51526901 100644 --- a/app/lib/rocketchat/services/restApi.ts +++ b/app/lib/rocketchat/services/restApi.ts @@ -41,10 +41,8 @@ export const e2eRequestSubscriptionKeys = (): any => // RC 0.72.0 sdk.methodCallWrapper('e2e.requestSubscriptionKeys'); -export const e2eGetUsersOfRoomWithoutKey = (rid: string): any => +export const e2eGetUsersOfRoomWithoutKey = (rid: string) => // RC 0.70.0 - // TODO: missing definitions from server - // @ts-ignore sdk.get('e2e.getUsersOfRoomWithoutKey', { rid }); export const e2eSetRoomKeyID = (rid: string, keyID: string): any =>