Compare commits
5 Commits
683a76cc80
...
v0.1.3
| Author | SHA1 | Date | |
|---|---|---|---|
| 44ab31aebb | |||
| e4f1d7d4b0 | |||
| 7600804aa1 | |||
| a4589b6e09 | |||
| d0986a4608 |
@@ -4,3 +4,8 @@
|
||||
- Implement the Double Ratchet, X3DH and OMEMO specific bits
|
||||
- Add a Blind-Trust-Before-Verification TrustManager
|
||||
- Supported OMEMO version: 0.8.3
|
||||
|
||||
## 0.1.3
|
||||
|
||||
- Fix bug with the Double Ratchet causing only the initial message to be decryptable
|
||||
- Expose `getDeviceMap` as a developer usable function
|
||||
|
||||
@@ -26,10 +26,10 @@ Include `omemo_dart` in your `pubspec.yaml` like this:
|
||||
# [...]
|
||||
|
||||
dependencies:
|
||||
omemo_dart:
|
||||
hosted: https://git.polynom.me/api/packages/PapaTutuWawa/pub
|
||||
version: ^0.1.0
|
||||
# [...]
|
||||
omemo_dart:
|
||||
hosted: https://git.polynom.me/api/packages/PapaTutuWawa/pub
|
||||
version: ^0.1.0
|
||||
# [...]
|
||||
|
||||
# [...]
|
||||
```
|
||||
|
||||
@@ -293,11 +293,15 @@ class OmemoDoubleRatchet {
|
||||
return plaintext;
|
||||
}
|
||||
|
||||
if (header.dhPub != await dhr?.getBytes()) {
|
||||
final dhPubMatches = listsEqual(
|
||||
header.dhPub ?? <int>[],
|
||||
await dhr?.getBytes() ?? <int>[],
|
||||
);
|
||||
if (!dhPubMatches) {
|
||||
await _skipMessageKeys(header.pn!);
|
||||
await _dhRatchet(header);
|
||||
}
|
||||
|
||||
|
||||
await _skipMessageKeys(header.n!);
|
||||
final newCkr = await kdfCk(ckr!, kdfCkNextChainKey);
|
||||
final mk = await kdfCk(ckr!, kdfCkNextMessageKey);
|
||||
|
||||
@@ -386,13 +386,22 @@ class OmemoSessionManager {
|
||||
_eventStreamController.add(DeviceModifiedEvent(_device));
|
||||
});
|
||||
}
|
||||
|
||||
/// 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
|
||||
OmemoDoubleRatchet getRatchet(String jid, int deviceId) => _ratchetMap[RatchetMapKey(jid, deviceId)]!;
|
||||
|
||||
@visibleForTesting
|
||||
Map<String, List<int>> getDeviceMap() => _deviceMap;
|
||||
|
||||
@visibleForTesting
|
||||
Map<RatchetMapKey, OmemoDoubleRatchet> getRatchetMap() => _ratchetMap;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
name: omemo_dart
|
||||
description: An XMPP library independent OMEMO library
|
||||
version: 0.1.2
|
||||
version: 0.1.3
|
||||
homepage: https://github.com/PapaTutuWawa/omemo_dart
|
||||
publish_to: https://git.polynom.me/api/packages/PapaTutuWawa/pub
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ void main() {
|
||||
final oldDevice = await oldSession.getDevice();
|
||||
final newDevice = await newSession.getDevice();
|
||||
expect(await oldDevice.equals(newDevice), true);
|
||||
expect(oldSession.getDeviceMap(), newSession.getDeviceMap());
|
||||
expect(await oldSession.getDeviceMap(), await newSession.getDeviceMap());
|
||||
|
||||
expect(oldSession.getRatchetMap().length, newSession.getRatchetMap().length);
|
||||
for (final session in oldSession.getRatchetMap().entries) {
|
||||
|
||||
Reference in New Issue
Block a user