pub struct WorkerCa { /* private fields */ }Expand description
Worker certificate authority.
Holds the CA keypair + cert in memory after load/generate. Persisted to disk so the CA identity survives daemon restarts.
Implementations§
Source§impl WorkerCa
impl WorkerCa
Sourcepub fn load_or_generate(base_dir: impl AsRef<Path>) -> Result<Self>
pub fn load_or_generate(base_dir: impl AsRef<Path>) -> Result<Self>
Load the worker CA from base_dir, generating one if absent.
§Errors
Returns SecretsError::Storage on I/O failure and
SecretsError::Encryption on malformed on-disk PEM or rcgen
errors.
Sourcepub fn ca_cert_der(&self) -> Vec<u8> ⓘ
pub fn ca_cert_der(&self) -> Vec<u8> ⓘ
Return the CA certificate in DER encoding for inclusion in the gRPC
RegisterResponse.ca_chain_der.
Sourcepub fn ca_cert_pem(&self) -> String
pub fn ca_cert_pem(&self) -> String
Return the CA certificate in PEM (for human readers / debug).
Sourcepub fn sign_csr_der(
&self,
csr_der: &[u8],
common_name: &str,
validity: Duration,
) -> Result<Vec<u8>>
pub fn sign_csr_der( &self, csr_der: &[u8], common_name: &str, validity: Duration, ) -> Result<Vec<u8>>
Sign a worker-submitted CSR. Returns the leaf cert in DER.
§Errors
Returns SecretsError::Encryption if the CSR is malformed, uses an
unsupported key type, or signing fails.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for WorkerCa
impl !UnwindSafe for WorkerCa
impl Freeze for WorkerCa
impl Send for WorkerCa
impl Sync for WorkerCa
impl Unpin for WorkerCa
impl UnsafeUnpin for WorkerCa
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more