From 3db0167f5a0c567e8043949f04513163e9b7529f Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Wed, 26 Jul 2023 23:28:35 +0100 Subject: [PATCH] minor cleanups --- spec/integ/crypto/megolm-backup.spec.ts | 2 +- src/client.ts | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/spec/integ/crypto/megolm-backup.spec.ts b/spec/integ/crypto/megolm-backup.spec.ts index af9734f9c87..8b1cc0cc0a5 100644 --- a/spec/integ/crypto/megolm-backup.spec.ts +++ b/spec/integ/crypto/megolm-backup.spec.ts @@ -267,7 +267,7 @@ describe.each(Object.entries(CRYPTO_BACKENDS))("megolm-keys backup (%s)", (backe await backupEnabled; - const backupStatus = aliceClient.getCrypto()!.getActiveSessionBackupVersion(); + const backupStatus = await aliceClient.getCrypto()!.getActiveSessionBackupVersion(); expect(backupStatus).toBeDefined(); expect(backupStatus).toStrictEqual(backupVersion); }); diff --git a/src/client.ts b/src/client.ts index 6944a309a70..7facb355e74 100644 --- a/src/client.ts +++ b/src/client.ts @@ -3354,12 +3354,12 @@ export class MatrixClient extends TypedEventEmitter> { - if (!this.getCrypto()) { + if (!this.cryptoBackend) { throw new Error("End-to-end encryption disabled"); } // eslint-disable-next-line camelcase - const { algorithm, auth_data, recovery_key, privateKey } = await this.getCrypto()!.prepareKeyBackupVersion( + const { algorithm, auth_data, recovery_key, privateKey } = await this.cryptoBackend.prepareKeyBackupVersion( password, ); @@ -3395,11 +3395,11 @@ export class MatrixClient extends TypedEventEmitter { - if (!this.getCrypto()) { + if (!this.cryptoBackend) { throw new Error("End-to-end encryption disabled"); } - await this.getCrypto()!.getBackupManager().createKeyBackupVersion(info); + await this.cryptoBackend.backupManager.createKeyBackupVersion(info); const data = { algorithm: info.algorithm, @@ -3414,7 +3414,7 @@ export class MatrixClient extends TypedEventEmitter