From 485d88b896643fbecaef3b987fe182a828f620a0 Mon Sep 17 00:00:00 2001 From: Sorunome Date: Wed, 10 Jun 2020 12:11:10 +0200 Subject: [PATCH] Hotfix decryption can request session --- lib/encryption/encryption.dart | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/encryption/encryption.dart b/lib/encryption/encryption.dart index d09d0f1e..9038b574 100644 --- a/lib/encryption/encryption.dart +++ b/lib/encryption/encryption.dart @@ -100,8 +100,11 @@ class Encryption { canRequestSession = true; throw (DecryptError.UNKNOWN_SESSION); } + // decrypt errors here may mean we have a bad session key - others might have a better one + canRequestSession = true; final decryptResult = inboundGroupSession.inboundGroupSession .decrypt(event.content['ciphertext']); + canRequestSession = false; final messageIndexKey = event.eventId + event.originServerTs.millisecondsSinceEpoch.toString(); var haveIndex = inboundGroupSession.indexes.containsKey(messageIndexKey); @@ -124,8 +127,6 @@ class Encryption { roomId, sessionId); } - // decrypt errors here may mean we have a bad session key - others might have a better one - canRequestSession = true; decryptedPayload = json.decode(decryptResult.plaintext); } catch (exception) { // alright, if this was actually by our own outbound group session, we might as well clear it