crypto: Add getters for the sender key in our sessions

master
Damir Jelić 2021-01-18 13:28:09 +01:00
parent 5418c88775
commit 629a8ee84f
2 changed files with 10 additions and 0 deletions

View File

@ -188,6 +188,11 @@ impl InboundGroupSession {
.expect("Can't export at the first known index") .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. /// Export this session at the given message index.
pub async fn export_at_index(&self, message_index: u32) -> Option<ExportedRoomKey> { pub async fn export_at_index(&self, message_index: u32) -> Option<ExportedRoomKey> {
let session_key = let session_key =

View File

@ -77,6 +77,11 @@ impl Session {
Ok(plaintext) 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. /// Encrypt the given plaintext as a OlmMessage.
/// ///
/// Returns the encrypted Olm message. /// Returns the encrypted Olm message.