Add locals add and remove subcommands
- `locals add` adds a local (unintroduced) certificate for encryption. - `locals remove` removes/deacivates a local certificate. - Overall cleanup
This commit is contained in:
@@ -31,14 +31,14 @@ pub async fn dispatch(cmd: IntroducerAddCommand, config: HuskConfigContainer) ->
|
||||
if matches!(vc.revocation_status(), RevocationStatus::Revoked(_)) {
|
||||
return Err(CommandError::CertRevoked(vc.fingerprint()).into());
|
||||
}
|
||||
if !crypto::has_certification_capability(&vc) {
|
||||
if !crypto::can_certify(&vc) {
|
||||
return Err(CommandError::CertNotUsable(vc.fingerprint()).into());
|
||||
}
|
||||
|
||||
Introducer::create(&context, &vc, cmd.domains)?;
|
||||
} else if let Some(cert) = cmd.cert {
|
||||
let fpr = Fingerprint::from_hex(cert.as_str())?;
|
||||
let certs = cert_store.lookup_by_cert(&KeyHandle::try_from(&fpr)?)
|
||||
let certs = cert_store.lookup_by_cert(&KeyHandle::from(&fpr))
|
||||
.map_err(|_| CommandError::CertNotFound(fpr.clone()))?;
|
||||
|
||||
let certs: Vec<ValidCert> = certs.iter()
|
||||
@@ -48,7 +48,7 @@ pub async fn dispatch(cmd: IntroducerAddCommand, config: HuskConfigContainer) ->
|
||||
.collect();
|
||||
|
||||
if let Some(cert) = certs.first() {
|
||||
Introducer::create(&context, &cert, cmd.domains)?;
|
||||
Introducer::create(&context, cert, cmd.domains)?;
|
||||
} else {
|
||||
return Err(CommandError::CertNotUsable(fpr).into());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user