Compare commits
No commits in common. "b6aa28e1ee8ab2173f4012787445275b87fadc5b" and "f68e45af265ed3394743c4a4e414711e47f7eda7" have entirely different histories.
b6aa28e1ee
...
f68e45af26
@ -15,8 +15,3 @@
|
|||||||
- Add convenience functions `getDeviceId` and `getDeviceBundle`
|
- Add convenience functions `getDeviceId` and `getDeviceBundle`
|
||||||
- Creating a new ratchet with an id for which we already have a ratchet will now overwrite the old ratchet
|
- Creating a new ratchet with an id for which we already have a ratchet will now overwrite the old ratchet
|
||||||
- Ratchet now carry an "acknowledged" attribute
|
- Ratchet now carry an "acknowledged" attribute
|
||||||
|
|
||||||
## 0.2.1
|
|
||||||
|
|
||||||
- Add `isRatchetAcknowledged`
|
|
||||||
- Ratchets that are created due to accepting a kex are now unacknowledged
|
|
||||||
|
@ -197,7 +197,7 @@ class OmemoDoubleRatchet {
|
|||||||
ik,
|
ik,
|
||||||
ad,
|
ad,
|
||||||
{},
|
{},
|
||||||
false,
|
true,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -446,25 +446,18 @@ class OmemoSessionManager {
|
|||||||
|
|
||||||
/// Returns the list of device identifiers belonging to [jid] that are yet unacked, i.e.
|
/// Returns the list of device identifiers belonging to [jid] that are yet unacked, i.e.
|
||||||
/// we have not yet received an empty OMEMO message from.
|
/// we have not yet received an empty OMEMO message from.
|
||||||
Future<List<int>?> getUnacknowledgedRatchets(String jid) async {
|
Future<List<int>> getUnacknowledgedRatchets(String jid) async {
|
||||||
return _lock.synchronized(() async {
|
final ret = List<int>.empty(growable: true);
|
||||||
final ret = List<int>.empty(growable: true);
|
|
||||||
final devices = _deviceMap[jid];
|
|
||||||
if (devices == null) return null;
|
|
||||||
|
|
||||||
|
await _lock.synchronized(() async {
|
||||||
|
final devices = _deviceMap[jid]!;
|
||||||
for (final device in devices) {
|
for (final device in devices) {
|
||||||
final ratchet = _ratchetMap[RatchetMapKey(jid, device)]!;
|
final ratchet = _ratchetMap[RatchetMapKey(jid, device)]!;
|
||||||
if (!ratchet.acknowledged) ret.add(device);
|
if (!ratchet.acknowledged) ret.add(device);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
/// Returns true if the ratchet for [jid] with device identifier [deviceId] is
|
return ret;
|
||||||
/// acknowledged. Returns false if not.
|
|
||||||
Future<bool> isRatchetAcknowledged(String jid, int deviceId) async {
|
|
||||||
return _lock.synchronized(() => _ratchetMap[RatchetMapKey(jid, deviceId)]!.acknowledged);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Mark the ratchet for device [deviceId] from [jid] as acked.
|
/// Mark the ratchet for device [deviceId] from [jid] as acked.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
name: omemo_dart
|
name: omemo_dart
|
||||||
description: An XMPP library independent OMEMO library
|
description: An XMPP library independent OMEMO library
|
||||||
version: 0.2.1
|
version: 0.2.0
|
||||||
homepage: https://github.com/PapaTutuWawa/omemo_dart
|
homepage: https://github.com/PapaTutuWawa/omemo_dart
|
||||||
publish_to: https://git.polynom.me/api/packages/PapaTutuWawa/pub
|
publish_to: https://git.polynom.me/api/packages/PapaTutuWawa/pub
|
||||||
|
|
||||||
|
@ -539,7 +539,7 @@ void main() {
|
|||||||
// Alice marks the ratchet as acknowledged
|
// Alice marks the ratchet as acknowledged
|
||||||
await aliceSession.ratchetAcknowledged(bobJid, await bobSession.getDeviceId());
|
await aliceSession.ratchetAcknowledged(bobJid, await bobSession.getDeviceId());
|
||||||
expect(
|
expect(
|
||||||
(await aliceSession.getUnacknowledgedRatchets(bobJid))!.isEmpty,
|
(await aliceSession.getUnacknowledgedRatchets(bobJid)).isEmpty,
|
||||||
true,
|
true,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user