Merge branch 'soru/autoclear-outbound-session' into 'master'

automatically clear an outbound session, if you are unable to decrypt your own messages

See merge request famedly/famedlysdk!307
This commit is contained in:
Christian Pauly 2020-05-18 16:02:48 +00:00
commit 3ee5c2effa
1 changed files with 4 additions and 0 deletions

View File

@ -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,