Sign encrypted mails.

- Husk now not only encrypts outgoing emails (if possible) but also adds
  a signature.
- Rework the internal handling of the signing key.
- Integrate the signing into the workflow of the daemon.
- Add a configuration option for a subject replacement.
This commit is contained in:
Malte Meiboom
2026-06-18 13:24:24 +02:00
parent 06c0583f5e
commit e47b1b837c
10 changed files with 155 additions and 47 deletions
+29 -1
View File
@@ -9,13 +9,14 @@ use toml;
use log4rs;
use crate::types::errors::HuskError;
use crate::types::defaults::CONSOLE_LOGGING;
use crate::types::defaults::{CONSOLE_LOGGING, SUBJECT_REPLACEMENT};
#[derive(Deserialize, Debug, Clone)]
pub struct HuskConfig {
pub connection: String,
pub sequoia_home: String,
pub keyservers: Option<Vec<String>>,
pub subject_replacement: Option<String>,
logging: Option<toml::Value>,
}
@@ -68,6 +69,13 @@ impl HuskConfig {
}
}
pub fn get_subject_replacement(&self) -> String {
if let Some(replacement) = &self.subject_replacement {
replacement.clone()
} else {
SUBJECT_REPLACEMENT.to_string()
}
}
}
pub type HuskConfigContainer = Arc<Mutex<HuskConfig>>;
@@ -79,3 +87,23 @@ impl From<HuskConfigContainer> for HuskConfig {
}
}
#[cfg(test)]
mod tests {
use crate::types::defaults;
use super::HuskConfig;
#[test]
fn subject_line() {
let config = HuskConfig {
connection: "".into(),
sequoia_home: "".into(),
keyservers: None,
subject_replacement: None,
logging: None
};
assert_eq!(config.get_subject_replacement(), defaults::SUBJECT_REPLACEMENT);
}
}