Move crypto.rs into common
- Refactor code and move crypto.rs into the common subdirectory. - Fixed comments
This commit is contained in:
@@ -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(())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user