crypto: Implement From<EncryptedFile> for EncryptionInfo
parent
c318a6e847
commit
0c8e870bff
|
@ -23,7 +23,7 @@ use aes_ctr::{
|
||||||
};
|
};
|
||||||
use base64::DecodeError;
|
use base64::DecodeError;
|
||||||
use getrandom::getrandom;
|
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 serde::{Deserialize, Serialize};
|
||||||
use sha2::{Digest, Sha256};
|
use sha2::{Digest, Sha256};
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
|
@ -252,6 +252,12 @@ pub struct EncryptionInfo {
|
||||||
pub hashes: BTreeMap<String, String>,
|
pub hashes: BTreeMap<String, String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl From<EncryptedFile> for EncryptionInfo {
|
||||||
|
fn from(file: EncryptedFile) -> Self {
|
||||||
|
Self { version: file.v, web_key: file.key, iv: file.iv, hashes: file.hashes }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use std::io::{Cursor, Read};
|
use std::io::{Cursor, Read};
|
||||||
|
|
Loading…
Reference in New Issue