From 629a8ee84fe292a9d1d85bdab123cb6a6d951c79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Mon, 18 Jan 2021 13:28:09 +0100 Subject: [PATCH] crypto: Add getters for the sender key in our sessions --- matrix_sdk_crypto/src/olm/group_sessions/inbound.rs | 5 +++++ matrix_sdk_crypto/src/olm/session.rs | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/matrix_sdk_crypto/src/olm/group_sessions/inbound.rs b/matrix_sdk_crypto/src/olm/group_sessions/inbound.rs index 121a9017..78aa9878 100644 --- a/matrix_sdk_crypto/src/olm/group_sessions/inbound.rs +++ b/matrix_sdk_crypto/src/olm/group_sessions/inbound.rs @@ -188,6 +188,11 @@ impl InboundGroupSession { .expect("Can't export at the first known index") } + /// Get the sender key that this session was received from. + pub fn sender_key(&self) -> &str { + &self.sender_key + } + /// Export this session at the given message index. pub async fn export_at_index(&self, message_index: u32) -> Option { let session_key = diff --git a/matrix_sdk_crypto/src/olm/session.rs b/matrix_sdk_crypto/src/olm/session.rs index 8d031f63..dafe9fcb 100644 --- a/matrix_sdk_crypto/src/olm/session.rs +++ b/matrix_sdk_crypto/src/olm/session.rs @@ -77,6 +77,11 @@ impl Session { Ok(plaintext) } + /// Get the sender key that was used to establish this Session. + pub fn sender_key(&self) -> &str { + &self.sender_key + } + /// Encrypt the given plaintext as a OlmMessage. /// /// Returns the encrypted Olm message.