diff --git a/src/crypto/OlmDevice.ts b/src/crypto/OlmDevice.ts index 2de8313d9..0b2e616a8 100644 --- a/src/crypto/OlmDevice.ts +++ b/src/crypto/OlmDevice.ts @@ -92,7 +92,7 @@ export interface InboundGroupSessionData { sharedHistory?: boolean; } -interface IDecryptedGroupMessage { +export interface IDecryptedGroupMessage { result: string; keysClaimed: Record; senderKey: string; @@ -100,6 +100,11 @@ interface IDecryptedGroupMessage { untrusted: boolean; } +export interface IInboundSession { + payload: string; + session_id: string; +} + export interface IExportedDevice { pickleKey: string; pickledAccount: string; @@ -620,7 +625,7 @@ export class OlmDevice { theirDeviceIdentityKey: string, messageType: number, ciphertext: string, - ): Promise<{ payload: string, session_id: string }> { // eslint-disable-line camelcase + ): Promise { if (messageType !== 0) { throw new Error("Need messageType == 0 to create inbound session"); } diff --git a/src/crypto/algorithms/megolm.ts b/src/crypto/algorithms/megolm.ts index 8bf5a7c62..07636c11d 100644 --- a/src/crypto/algorithms/megolm.ts +++ b/src/crypto/algorithms/megolm.ts @@ -30,7 +30,7 @@ import { registerAlgorithm, UnknownDeviceError, } from "./base"; -import { WITHHELD_MESSAGES } from '../OlmDevice'; +import { IDecryptedGroupMessage, WITHHELD_MESSAGES } from '../OlmDevice'; import { Room } from '../../models/room'; import { DeviceInfo } from "../deviceinfo"; import { IOlmSessionResult } from "../olmlib"; @@ -1280,7 +1280,7 @@ class MegolmDecryption extends DecryptionAlgorithm { // (fixes https://github.com/vector-im/element-web/issues/5001) this.addEventToPendingList(event); - let res; + let res: IDecryptedGroupMessage; try { res = await this.olmDevice.decryptGroupMessage( event.getRoomId(), content.sender_key, content.session_id, content.ciphertext, diff --git a/src/crypto/algorithms/olm.ts b/src/crypto/algorithms/olm.ts index c640d14ef..e11a666e1 100644 --- a/src/crypto/algorithms/olm.ts +++ b/src/crypto/algorithms/olm.ts @@ -32,6 +32,7 @@ import { import { Room } from '../../models/room'; import { MatrixEvent } from "../.."; import { IEventDecryptionResult } from "../index"; +import { IInboundSession } from "../OlmDevice"; const DeviceVerification = DeviceInfo.DeviceVerification; @@ -331,7 +332,7 @@ class OlmDecryption extends DecryptionAlgorithm { // prekey message which doesn't match any existing sessions: make a new // session. - let res; + let res: IInboundSession; try { res = await this.olmDevice.createInboundSession( theirDeviceIdentityKey, message.type, message.body, diff --git a/src/crypto/olmlib.ts b/src/crypto/olmlib.ts index 19c34fe2b..c017af081 100644 --- a/src/crypto/olmlib.ts +++ b/src/crypto/olmlib.ts @@ -323,7 +323,7 @@ export async function ensureOlmSessionsForDevices( } const oneTimeKeyAlgorithm = "signed_curve25519"; - let res; + let res: IClaimOTKsResult; let taskDetail = `one-time keys for ${devicesWithoutSession.length} devices`; try { log.debug(`Claiming ${taskDetail}`); diff --git a/src/models/event.ts b/src/models/event.ts index 79e17d711..0ce12e068 100644 --- a/src/models/event.ts +++ b/src/models/event.ts @@ -823,18 +823,13 @@ export class MatrixEvent extends TypedEventEmitter