mirror of
https://github.com/chatmail/core.git
synced 2026-05-16 21:36:30 +03:00
test: use encrypted messages in more tests
This change is a preparation for ignoring unencrypted messages by default. New test_utils::encrypt_raw_message and test_utils::receive_encrypted_imf are used to encrypt the messages before "receiving" them with receive_imf.
This commit is contained in:
17
src/e2ee.rs
17
src/e2ee.rs
@@ -42,12 +42,25 @@ impl EncryptHelper {
|
||||
compress: bool,
|
||||
seipd_version: SeipdVersion,
|
||||
) -> Result<String> {
|
||||
let sign_key = load_self_secret_key(context).await?;
|
||||
|
||||
let mut raw_message = Vec::new();
|
||||
let cursor = Cursor::new(&mut raw_message);
|
||||
mail_to_encrypt.clone().write_part(cursor).ok();
|
||||
|
||||
let ctext = self
|
||||
.encrypt_raw(context, keyring, raw_message, compress, seipd_version)
|
||||
.await?;
|
||||
Ok(ctext)
|
||||
}
|
||||
|
||||
pub async fn encrypt_raw(
|
||||
self,
|
||||
context: &Context,
|
||||
keyring: Vec<SignedPublicKey>,
|
||||
raw_message: Vec<u8>,
|
||||
compress: bool,
|
||||
seipd_version: SeipdVersion,
|
||||
) -> Result<String> {
|
||||
let sign_key = load_self_secret_key(context).await?;
|
||||
let ctext =
|
||||
pgp::pk_encrypt(raw_message, keyring, sign_key, compress, seipd_version).await?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user