From b56b720c0cb9ac1a0e69ea8f287071fab73f09c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Wed, 22 Apr 2020 15:22:43 +0200 Subject: [PATCH] crypto: Return a EncryptedEventContent when encrypting instead of a specific one. --- src/crypto/machine.rs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/crypto/machine.rs b/src/crypto/machine.rs index 343cd458..f6576c6b 100644 --- a/src/crypto/machine.rs +++ b/src/crypto/machine.rs @@ -944,7 +944,7 @@ impl OlmMachine { &self, room_id: &RoomId, content: MessageEventContent, - ) -> Result { + ) -> Result { let session = self.outbound_group_session.get(room_id); let session = if let Some(s) = session { @@ -972,13 +972,15 @@ impl OlmMachine { let ciphertext = session.encrypt(plaintext).await; - Ok(MegolmV1AesSha2Content { - algorithm: Algorithm::MegolmV1AesSha2, - ciphertext, - sender_key: self.account.identity_keys().curve25519().to_owned(), - session_id: session.session_id().to_owned(), - device_id: self.device_id.to_owned(), - }) + Ok(EncryptedEventContent::MegolmV1AesSha2( + MegolmV1AesSha2Content { + algorithm: Algorithm::MegolmV1AesSha2, + ciphertext, + sender_key: self.account.identity_keys().curve25519().to_owned(), + session_id: session.session_id().to_owned(), + device_id: self.device_id.to_owned(), + }, + )) } async fn olm_encrypt(