crypto: Return a EncryptedEventContent when encrypting instead of a specific one.

master
Damir Jelić 2020-04-22 15:22:43 +02:00
parent 27ae8bccb9
commit b56b720c0c
1 changed files with 10 additions and 8 deletions

View File

@ -944,7 +944,7 @@ impl OlmMachine {
&self, &self,
room_id: &RoomId, room_id: &RoomId,
content: MessageEventContent, content: MessageEventContent,
) -> Result<MegolmV1AesSha2Content> { ) -> Result<EncryptedEventContent> {
let session = self.outbound_group_session.get(room_id); let session = self.outbound_group_session.get(room_id);
let session = if let Some(s) = session { let session = if let Some(s) = session {
@ -972,13 +972,15 @@ impl OlmMachine {
let ciphertext = session.encrypt(plaintext).await; let ciphertext = session.encrypt(plaintext).await;
Ok(MegolmV1AesSha2Content { Ok(EncryptedEventContent::MegolmV1AesSha2(
algorithm: Algorithm::MegolmV1AesSha2, MegolmV1AesSha2Content {
ciphertext, algorithm: Algorithm::MegolmV1AesSha2,
sender_key: self.account.identity_keys().curve25519().to_owned(), ciphertext,
session_id: session.session_id().to_owned(), sender_key: self.account.identity_keys().curve25519().to_owned(),
device_id: self.device_id.to_owned(), session_id: session.session_id().to_owned(),
}) device_id: self.device_id.to_owned(),
},
))
} }
async fn olm_encrypt( async fn olm_encrypt(