feat: Add a function to check if a ratchet is acknowledged

This commit is contained in:
PapaTutuWawa 2022-08-19 16:58:23 +02:00
parent 80e1b20f27
commit 0e2af1f2a3

View File

@ -461,6 +461,12 @@ class OmemoSessionManager {
}); });
} }
/// Returns true if the ratchet for [jid] with device identifier [deviceId] is
/// 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.
Future<void> ratchetAcknowledged(String jid, int deviceId) async { Future<void> ratchetAcknowledged(String jid, int deviceId) async {
await _lock.synchronized(() async { await _lock.synchronized(() async {