Move crypto.rs into common

- Refactor code and move crypto.rs into the common subdirectory.
- Fixed comments
This commit is contained in:
Malte Meiboom
2026-05-06 12:34:21 +02:00
parent bf53af50ec
commit f2260bc335
13 changed files with 45 additions and 47 deletions
+22 -3
View File
@@ -1,11 +1,30 @@
use anyhow::Result;
use crate::cli::cli_args::IntroducerRemoveCommand;
use crate::config::HuskConfigContainer;
use sequoia_openpgp::{Fingerprint, KeyHandle};
use sequoia_cert_store::Store;
pub async fn dispatch(cmd: IntroducerRemoveCommand, _config: &HuskConfigContainer) -> Result<()> {
use crate::cli::cli_args::IntroducerRemoveCommand;
use crate::commands::CommandError;
use crate::config::HuskConfigContainer;
use crate::types::husk_context::HuskContext;
use crate::types::introducer::Introducer;
pub async fn dispatch(cmd: IntroducerRemoveCommand, config: HuskConfigContainer) -> Result<()> {
println!("remove");
println!(" {:?}", cmd.cert);
println!(" {:?}", cmd.demote);
let context = HuskContext::new(&config.into())?;
let policy = &context.policy;
let cert_store = &context.cert_store;
// Get the certificate
let fpr = Fingerprint::from_hex(&cmd.cert)?;
let certs = cert_store.lookup_by_cert(&KeyHandle::try_from(&fpr)?)
.map_err(|_| CommandError::CertNotFound(fpr.clone()))?;
Ok(())
}