pub struct FileBackend { /* private fields */ }Expand description
File-backed SigningBackend implementation.
Thin adapter over the existing JSON-keystore free functions
(load_signer_for_kid, rotate_keystore, list_valid_pubkeys,
prune_expired_grace). Each call opens the file fresh so external
edits (e.g., the daemon’s hourly sweep) are picked up without
needing a cache-invalidation hook.
Private key material lives on disk encrypted only by filesystem
permissions (0600 owner-only). For tamper-resistant storage use a
future TPM or YubiHSM backend.
Implementations§
Trait Implementations§
Source§impl Clone for FileBackend
impl Clone for FileBackend
Source§fn clone(&self) -> FileBackend
fn clone(&self) -> FileBackend
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for FileBackend
impl Debug for FileBackend
Source§impl SigningBackend for FileBackend
impl SigningBackend for FileBackend
Source§fn name(&self) -> &'static str
fn name(&self) -> &'static str
Returns a human-readable name (
"file", "tpm", …) for log
lines and --key-store-backend debug output.Source§fn is_hardware_backed(&self) -> bool
fn is_hardware_backed(&self) -> bool
Returns
true if private key material lives in tamper-resistant
hardware. Pure-software backends return false. Used for
startup logging and the “key-store-backend: tpm (hw-backed)”
banner.Source§fn active_key_id<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<String, SecretsError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn active_key_id<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<String, SecretsError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Lowercase hex first-8-chars-of-SHA256 of the currently-active
verifying key. Stable across processes for the same key.
Source§fn public_key_b64<'life0, 'life1, 'async_trait>(
&'life0 self,
kid: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<String>, SecretsError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn public_key_b64<'life0, 'life1, 'async_trait>(
&'life0 self,
kid: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<String>, SecretsError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
URL-safe no-pad base64 of the verifying key bytes for the given
kid. Returns Ok(None) if the kid is unknown or its grace
window has expired.Source§fn list_valid_pubkeys<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<PubkeyInfo>, SecretsError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list_valid_pubkeys<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<PubkeyInfo>, SecretsError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
All currently-valid (active OR not-yet-expired grace) keys in
the store with their statuses.
Source§fn sign<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
kid: &'life1 str,
msg: &'life2 [u8],
) -> Pin<Box<dyn Future<Output = Result<[u8; 64], SecretsError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn sign<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
kid: &'life1 str,
msg: &'life2 [u8],
) -> Pin<Box<dyn Future<Output = Result<[u8; 64], SecretsError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Sign
msg with the key identified by kid. Fails with
SecretsError::Provider if the kid is unknown or expired.
Note that signing with a grace-window key is unusual (callers
typically only sign with the active key) but supported for
recovery scenarios.Source§fn rotate<'life0, 'async_trait>(
&'life0 self,
grace: Duration,
) -> Pin<Box<dyn Future<Output = Result<KeystoreRotationResult, SecretsError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn rotate<'life0, 'async_trait>(
&'life0 self,
grace: Duration,
) -> Pin<Box<dyn Future<Output = Result<KeystoreRotationResult, SecretsError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Rotate the keystore: generate a new active key, move the
previous active into the grace window for
grace, and return
the new active kid + public key. Idempotent only in the sense
that calling twice produces two rotations.Source§fn prune_expired_grace<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<usize, SecretsError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn prune_expired_grace<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<usize, SecretsError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Prune any grace-window entries whose retention has elapsed.
Returns the count of pruned entries. Called periodically by the
daemon’s keystore sweep task.
Auto Trait Implementations§
impl Freeze for FileBackend
impl RefUnwindSafe for FileBackend
impl Send for FileBackend
impl Sync for FileBackend
impl Unpin for FileBackend
impl UnsafeUnpin for FileBackend
impl UnwindSafe for FileBackend
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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