From 09da5fa4ca146d207b34a899de98e4a9b8ef4bbb Mon Sep 17 00:00:00 2001 From: Sorunome Date: Mon, 18 May 2020 17:31:40 +0200 Subject: [PATCH] automatically clear an outbound session, if you are unable to decrypt your own messages --- lib/src/room.dart | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/src/room.dart b/lib/src/room.dart index 3a24b44..52cb3d7 100644 --- a/lib/src/room.dart +++ b/lib/src/room.dart @@ -1811,6 +1811,10 @@ class Room { _storeOutboundGroupSession(); decryptedPayload = json.decode(decryptResult.plaintext); } catch (exception) { + // alright, if this was actually by our own outbound group session, we might as well clear it + if ((_outboundGroupSession?.session_id() ?? '') == event.content['session_id']) { + clearOutboundGroupSession(wipe: true); + } if (exception.toString() == DecryptError.UNKNOWN_SESSION) { decryptedPayload = { 'content': event.content,