crypto: Add some more methods to the group session wrapper.

master
Damir Jelić 2020-04-09 16:23:24 +02:00
parent b4de95185d
commit a5f43db859
1 changed files with 10 additions and 0 deletions

View File

@ -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()