From 698ab5328f1898de38ceee1dfac09c5800056f49 Mon Sep 17 00:00:00 2001 From: Denis Kasak Date: Thu, 28 Apr 2022 16:03:34 +0200 Subject: [PATCH 1/2] docs(crypto): Document `OlmDecryptionInfo` and fix some errors. --- crates/matrix-sdk-crypto/src/machine.rs | 6 +----- crates/matrix-sdk-crypto/src/olm/account.rs | 7 ++++++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/crates/matrix-sdk-crypto/src/machine.rs b/crates/matrix-sdk-crypto/src/machine.rs index df852ca3d..8ceda3c3e 100644 --- a/crates/matrix-sdk-crypto/src/machine.rs +++ b/crates/matrix-sdk-crypto/src/machine.rs @@ -741,11 +741,7 @@ impl OlmMachine { /// /// # Arguments /// - /// * `sender_key` - The sender (curve25519) key of the event sender. - /// - /// * `signing_key` - The signing (ed25519) key of the event sender. - /// - /// * `event` - The decrypted to-device event. + /// * `decrypted` - The decrypted event and some associated metadata. async fn handle_decrypted_to_device_event( &self, decrypted: &OlmDecryptionInfo, diff --git a/crates/matrix-sdk-crypto/src/olm/account.rs b/crates/matrix-sdk-crypto/src/olm/account.rs index fb9fa5157..088ceb6f8 100644 --- a/crates/matrix-sdk-crypto/src/olm/account.rs +++ b/crates/matrix-sdk-crypto/src/olm/account.rs @@ -90,6 +90,11 @@ impl SessionType { } } +/// A struct witnessing a successful decryption of an Olm-encrypted to-device +/// event. +/// +/// Contains the decrypted event plaintext along with some associated metadata, +/// such as the identity (Curve25519) key of the to-device event sender. #[derive(Debug, Clone)] pub struct OlmDecryptionInfo { pub sender: OwnedUserId, @@ -1005,7 +1010,7 @@ impl ReadOnlyAccount { /// session failed. /// /// # Arguments - /// * `their_identity_key` - The other account's identitiy/curve25519 key. + /// * `their_identity_key` - The other account's identity/curve25519 key. /// /// * `message` - A pre-key Olm message that was sent to us by the other /// account. From 73bd3a0598c5e0fffe04af48da5139785c1410a6 Mon Sep 17 00:00:00 2001 From: Denis Kasak Date: Thu, 28 Apr 2022 16:19:44 +0200 Subject: [PATCH 2/2] fix(crypto): Make `OlmDecryptionInfo` and `decrypt_to_device_event` `pub(crate)`. --- crates/matrix-sdk-crypto/src/olm/account.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/matrix-sdk-crypto/src/olm/account.rs b/crates/matrix-sdk-crypto/src/olm/account.rs index 088ceb6f8..dd79d594b 100644 --- a/crates/matrix-sdk-crypto/src/olm/account.rs +++ b/crates/matrix-sdk-crypto/src/olm/account.rs @@ -96,7 +96,7 @@ impl SessionType { /// Contains the decrypted event plaintext along with some associated metadata, /// such as the identity (Curve25519) key of the to-device event sender. #[derive(Debug, Clone)] -pub struct OlmDecryptionInfo { +pub(crate) struct OlmDecryptionInfo { pub sender: OwnedUserId, pub session: SessionType, pub message_hash: OlmMessageHash, @@ -218,7 +218,7 @@ impl Account { } } - pub async fn decrypt_to_device_event( + pub(crate) async fn decrypt_to_device_event( &self, event: &ToDeviceRoomEncryptedEvent, ) -> OlmResult {