1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-08-07 23:02:56 +03:00

Fix reattempting decryption check

This commit is contained in:
Brad Murray
2021-07-26 07:49:42 -04:00
parent 8aa283d994
commit 4f8c20ddae
2 changed files with 2 additions and 2 deletions

View File

@@ -274,7 +274,7 @@ describe("Crypto", function() {
// alice encrypts each event, and then bob tries to decrypt
// them without any keys, so that they'll be in pending
await aliceClient.crypto.encryptEvent(event, aliceRoom);
event.clearEvent = {};
event.clearEvent = undefined;
event.senderCurve25519Key = null;
event.claimedEd25519Key = null;
try {

View File

@@ -534,7 +534,7 @@ export class MatrixEvent extends EventEmitter {
throw new Error("Attempt to decrypt event which isn't encrypted");
}
if (this.clearEvent?.content && this.clearEvent.content.msgtype !== "m.bad.encrypted") {
if (this.clearEvent && !this.isDecryptionFailure()) {
// we may want to just ignore this? let's start with rejecting it.
throw new Error(
"Attempt to decrypt event which has already been decrypted",