From 0e2af1f2a314234f48ce72649d66101fcde49e95 Mon Sep 17 00:00:00 2001 From: "Alexander \"PapaTutuWawa" Date: Fri, 19 Aug 2022 16:58:23 +0200 Subject: [PATCH] feat: Add a function to check if a ratchet is acknowledged --- lib/src/omemo/sessionmanager.dart | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/src/omemo/sessionmanager.dart b/lib/src/omemo/sessionmanager.dart index 542e21a..c8c6a76 100644 --- a/lib/src/omemo/sessionmanager.dart +++ b/lib/src/omemo/sessionmanager.dart @@ -461,6 +461,12 @@ class OmemoSessionManager { }); } + /// Returns true if the ratchet for [jid] with device identifier [deviceId] is + /// acknowledged. Returns false if not. + Future isRatchetAcknowledged(String jid, int deviceId) async { + return _lock.synchronized(() => _ratchetMap[RatchetMapKey(jid, deviceId)]!.acknowledged); + } + /// Mark the ratchet for device [deviceId] from [jid] as acked. Future ratchetAcknowledged(String jid, int deviceId) async { await _lock.synchronized(() async {