Add encryption

- actually encrypt the body of a mail
This commit is contained in:
Malte Meiboom
2025-12-17 11:11:28 +01:00
parent 64312da01d
commit eeda63f5ab
4 changed files with 55 additions and 7 deletions
+11 -4
View File
@@ -210,14 +210,21 @@ impl Daemon {
// none -> accept
// partial -> accept (later: split)
// full -> encrypt
// check mailbody
// is encrypted -> accept
// else -> encrypt
let protection = ProtectionPossibility::from(&context.mail);
if protection == ProtectionPossibility::Full {
// encrypt
// if an error occures the body is not exchanged
match crypto::encrypt(&context, &body, &context.mail.recipients) {
Ok(encrypted) => {
if cx.actions.replace_body(&encrypted).await.is_err() {
log::error!("Cannot exchange body");
}
},
Err(e) => {
log::error!("{}", e);
}
}
}
}