- Reject user ids containing ANSI control characters when creating a new signing key. - Prevent adding certificates twice when querying online sources if they contain multiple encryption keys. - Dedup introducers if there are multiple authenticating paths. - When listing locals, skip the signing key. - Check if a mail can be encrypted at all due to available certificates. If not tell the MTA that the processing is done. - Make `Introducer` comparable (`PartialEq`, `Eq` and `Hash`). - minor polishing
38 lines
1007 B
Rust
38 lines
1007 B
Rust
//! locals subcommand
|
|
use anyhow::Result;
|
|
|
|
use crate::cli::cli_args::{LocalsCommand, LocalsSubcommand};
|
|
use crate::common::crypto;
|
|
use crate::config::HuskConfigContainer;
|
|
use crate::types::husk_context::HuskContext;
|
|
|
|
pub mod add;
|
|
pub mod remove;
|
|
|
|
pub async fn dispatch(cmd: LocalsCommand, config: HuskConfigContainer) -> Result<()> {
|
|
match cmd.subcommand {
|
|
LocalsSubcommand::Add(add_cmd) => {
|
|
add::dispatch(add_cmd, config).await?;
|
|
},
|
|
LocalsSubcommand::Remove(rm_cmd) => {
|
|
remove::dispatch(rm_cmd, config).await?;
|
|
},
|
|
LocalsSubcommand::List => {
|
|
let context = HuskContext::new(&config.into())?;
|
|
|
|
// XXX: sort the output
|
|
for local in crypto::get_locals(
|
|
&context.cert_store,
|
|
&context.policy,
|
|
context.local_trust_root.fingerprint(),
|
|
context.signing_key) {
|
|
|
|
println!("{}", local);
|
|
}
|
|
|
|
},
|
|
}
|
|
|
|
Ok(())
|
|
}
|