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:
Malte Meiboom
2026-05-19 16:07:48 +02:00
parent 14dca91d92
commit e6c6bf87d9
10 changed files with 162 additions and 51 deletions
+3 -3
View File
@@ -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());
}