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
+15 -2
View File
@@ -42,6 +42,7 @@ impl Introducer {
}
}
/// Has this introducer certified cert?
pub fn is_introducing(&self, cert: &Cert) -> bool {
let policy = StandardPolicy::new();
@@ -66,6 +67,7 @@ impl Introducer {
result
}
/// Create an introducer.
pub fn create(context: &HuskContext, cert: &ValidCert, domains: Vec<String>)
-> Result<()> {
@@ -75,9 +77,15 @@ impl Introducer {
return Err(IntroducerError::UnsuitableCertificate.into());
}
crypto::authenticate(context, cert, true, Some(domains))
crypto::authenticate(
context,
cert,
crypto::Role::Introducer,
true,
Some(domains))
}
/// Remove an introducer.
pub fn remove(context: &HuskContext, cert: &ValidCert, _demote: bool)
-> Result<()> {
@@ -87,7 +95,12 @@ impl Introducer {
return Err(IntroducerError::UnsuitableCertificate.into());
}
crypto::authenticate(context, cert, false, None)
crypto::authenticate(
context,
cert,
crypto::Role::Introducer,
false,
None)
}
}