fix: Handle duplicate indexes properly
This commit is contained in:
parent
e08f35b5d0
commit
64b8e01444
|
@ -148,6 +148,13 @@ class Encryption {
|
||||||
// TODO: maybe clear outbound session, if it is ours
|
// TODO: maybe clear outbound session, if it is ours
|
||||||
throw (DecryptError.CHANNEL_CORRUPTED);
|
throw (DecryptError.CHANNEL_CORRUPTED);
|
||||||
}
|
}
|
||||||
|
final existingIndex = inboundGroupSession.indexes.entries.firstWhere(
|
||||||
|
(e) => e.value == decryptResult.message_index,
|
||||||
|
orElse: () => null);
|
||||||
|
if (existingIndex != null && existingIndex.key != messageIndexKey) {
|
||||||
|
// TODO: maybe clear outbound session, if it is ours
|
||||||
|
throw (DecryptError.CHANNEL_CORRUPTED);
|
||||||
|
}
|
||||||
inboundGroupSession.indexes[messageIndexKey] =
|
inboundGroupSession.indexes[messageIndexKey] =
|
||||||
decryptResult.message_index;
|
decryptResult.message_index;
|
||||||
if (!haveIndex) {
|
if (!haveIndex) {
|
||||||
|
|
Loading…
Reference in a new issue