diff --git a/matrix_sdk_crypto/src/file_encryption/attachments.rs b/matrix_sdk_crypto/src/file_encryption/attachments.rs index 81c3cf23..70354f1f 100644 --- a/matrix_sdk_crypto/src/file_encryption/attachments.rs +++ b/matrix_sdk_crypto/src/file_encryption/attachments.rs @@ -23,7 +23,7 @@ use aes_ctr::{ }; use base64::DecodeError; use getrandom::getrandom; -use matrix_sdk_common::events::room::{JsonWebKey, JsonWebKeyInit}; +use matrix_sdk_common::events::room::{EncryptedFile, JsonWebKey, JsonWebKeyInit}; use serde::{Deserialize, Serialize}; use sha2::{Digest, Sha256}; use thiserror::Error; @@ -252,6 +252,12 @@ pub struct EncryptionInfo { pub hashes: BTreeMap, } +impl From for EncryptionInfo { + fn from(file: EncryptedFile) -> Self { + Self { version: file.v, web_key: file.key, iv: file.iv, hashes: file.hashes } + } +} + #[cfg(test)] mod test { use std::io::{Cursor, Read};