From 7d5360a00fc4af73b960ea9320c15ee31d1ff67c Mon Sep 17 00:00:00 2001 From: Faye Duxovni Date: Mon, 3 Oct 2022 19:51:30 -0400 Subject: [PATCH] Rename redecryption-related function arguments for clarity (#2709) --- src/crypto/algorithms/megolm.ts | 11 ++++++++--- src/models/event.ts | 8 ++++++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/crypto/algorithms/megolm.ts b/src/crypto/algorithms/megolm.ts index 2052ee967..dbd9c6596 100644 --- a/src/crypto/algorithms/megolm.ts +++ b/src/crypto/algorithms/megolm.ts @@ -1795,12 +1795,17 @@ class MegolmDecryption extends DecryptionAlgorithm { * @private * @param {String} senderKey * @param {String} sessionId - * @param {Boolean} keyTrusted + * @param {Boolean} forceRedecryptIfUntrusted whether messages that were already + * successfully decrypted using untrusted keys should be re-decrypted * * @return {Boolean} whether all messages were successfully * decrypted with trusted keys */ - private async retryDecryption(senderKey: string, sessionId: string, keyTrusted?: boolean): Promise { + private async retryDecryption( + senderKey: string, + sessionId: string, + forceRedecryptIfUntrusted?: boolean, + ): Promise { const senderPendingEvents = this.pendingEvents.get(senderKey); if (!senderPendingEvents) { return true; @@ -1815,7 +1820,7 @@ class MegolmDecryption extends DecryptionAlgorithm { await Promise.all([...pending].map(async (ev) => { try { - await ev.attemptDecryption(this.crypto, { isRetry: true, keyTrusted }); + await ev.attemptDecryption(this.crypto, { isRetry: true, forceRedecryptIfUntrusted }); } catch (e) { // don't die if something goes wrong } diff --git a/src/models/event.ts b/src/models/event.ts index 071134978..406aded0b 100644 --- a/src/models/event.ts +++ b/src/models/event.ts @@ -151,7 +151,7 @@ interface IKeyRequestRecipient { export interface IDecryptOptions { emit?: boolean; isRetry?: boolean; - keyTrusted?: boolean; + forceRedecryptIfUntrusted?: boolean; } /** @@ -678,6 +678,8 @@ export class MatrixEvent extends TypedEventEmitter