From a5f43db859f95902a7a3199e9e4afb3688fdb045 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Thu, 9 Apr 2020 16:23:24 +0200 Subject: [PATCH] crypto: Add some more methods to the group session wrapper. --- src/crypto/olm.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/crypto/olm.rs b/src/crypto/olm.rs index bafd2d56..cc538558 100644 --- a/src/crypto/olm.rs +++ b/src/crypto/olm.rs @@ -172,6 +172,12 @@ impl Session { Ok(plaintext) } + pub fn encrypt(&mut self, plaintext: &str) -> OlmMessage { + let message = self.inner.encrypt(plaintext); + self.last_use_time = Instant::now(); + message + } + pub fn matches( &self, their_identity_key: &str, @@ -317,6 +323,10 @@ impl OutboundGroupSession { self.shared.store(true, Ordering::Relaxed); } + pub fn shared(&self) -> bool { + self.shared.load(Ordering::Relaxed) + } + pub async fn session_key(&self) -> String { let session = self.inner.lock().await; session.session_key()