Compare commits

..

No commits in common. "7600804aa19d2d9140a9f2e84f9ac05735a667c3" and "683a76cc80af872549ddc50b4eaf3e55b722389e" have entirely different histories.

3 changed files with 6 additions and 19 deletions

View File

@ -293,11 +293,7 @@ class OmemoDoubleRatchet {
return plaintext; return plaintext;
} }
final dhPubMatches = listsEqual( if (header.dhPub != await dhr?.getBytes()) {
header.dhPub ?? <int>[],
await dhr?.getBytes() ?? <int>[],
);
if (!dhPubMatches) {
await _skipMessageKeys(header.pn!); await _skipMessageKeys(header.pn!);
await _dhRatchet(header); await _dhRatchet(header);
} }

View File

@ -387,21 +387,12 @@ class OmemoSessionManager {
}); });
} }
/// Returns the device map, i.e. the mapping of bare Jid to its device identifiers
/// we have built sessions with.
Future<Map<String, List<int>>> getDeviceMap() async {
Map<String, List<int>>? map;
await _lock.synchronized(() async {
map = _deviceMap;
});
return map!;
}
@visibleForTesting @visibleForTesting
OmemoDoubleRatchet getRatchet(String jid, int deviceId) => _ratchetMap[RatchetMapKey(jid, deviceId)]!; OmemoDoubleRatchet getRatchet(String jid, int deviceId) => _ratchetMap[RatchetMapKey(jid, deviceId)]!;
@visibleForTesting
Map<String, List<int>> getDeviceMap() => _deviceMap;
@visibleForTesting @visibleForTesting
Map<RatchetMapKey, OmemoDoubleRatchet> getRatchetMap() => _ratchetMap; Map<RatchetMapKey, OmemoDoubleRatchet> getRatchetMap() => _ratchetMap;

View File

@ -93,7 +93,7 @@ void main() {
final oldDevice = await oldSession.getDevice(); final oldDevice = await oldSession.getDevice();
final newDevice = await newSession.getDevice(); final newDevice = await newSession.getDevice();
expect(await oldDevice.equals(newDevice), true); expect(await oldDevice.equals(newDevice), true);
expect(await oldSession.getDeviceMap(), await newSession.getDeviceMap()); expect(oldSession.getDeviceMap(), newSession.getDeviceMap());
expect(oldSession.getRatchetMap().length, newSession.getRatchetMap().length); expect(oldSession.getRatchetMap().length, newSession.getRatchetMap().length);
for (final session in oldSession.getRatchetMap().entries) { for (final session in oldSession.getRatchetMap().entries) {