pub struct TrustStore { /* private fields */ }Expand description
Key-centric trust store. Thread-safe, lock-free reads.
Keyed by VerifyingKey (Ed25519 pubkey). Each entry records what
scopes that key is authorized for and when the attestation expires.
Implementations§
Source§impl TrustStore
impl TrustStore
Sourcepub fn insert(&self, key: VerifyingKey, attestation: Attestation)
pub fn insert(&self, key: VerifyingKey, attestation: Attestation)
Insert a verified attestation for a key.
If the key already exists, the attestation is replaced if the new one expires later. Otherwise the existing entry is kept (prevents downgrade). Logs a warning on equal-expiry discard.
Sourcepub fn publish_service_registration(
&self,
key: VerifyingKey,
service: &str,
attestation: Attestation,
) -> Result<()>
pub fn publish_service_registration( &self, key: VerifyingKey, service: &str, attestation: Attestation, ) -> Result<()>
Publish a service registration after the caller has verified the CA credential, service subject and signer binding. Unlike a generic cache insertion, this may complete a same-credential, same-expiry identity cache entry with its certified service scope. Conflicting identities, credentials or scope sets are never silently overwritten.
Check if a key is authorized for the given scope.
Returns true if:
- The key has an entry in the trust store
- The scope is in the entry’s scope set
- The attestation has not expired
Sourcepub fn keys_for_scope(&self, scope: &str) -> Vec<VerifyingKey>
pub fn keys_for_scope(&self, scope: &str) -> Vec<VerifyingKey>
Get all keys authorized for a given scope.
Returns an empty Vec if no keys match. Useful for finding candidate endpoints when multiple instances exist.
Sourcepub fn published_keys_for_scope(&self, scope: &str) -> Vec<PublishedServiceKey>
pub fn published_keys_for_scope(&self, scope: &str) -> Vec<PublishedServiceKey>
Get every named, unexpired verification key published for a service scope.
Consumers must select an entry by key_id, or try every compatible
candidate. This intentionally exposes no authority-bearing positional
selection: a service may publish a drain and lead key simultaneously.
Sourcepub fn published_keys_for_scope_at(
&self,
scope: &str,
now: i64,
) -> Vec<PublishedServiceKey>
pub fn published_keys_for_scope_at( &self, scope: &str, now: i64, ) -> Vec<PublishedServiceKey>
Resolve the published key set at a supplied Unix timestamp.
This is useful to consumers which evaluate a signed assertion at its issuance time and to deterministic rotation tests.
Sourcepub fn get(&self, key: &VerifyingKey) -> Option<Attestation>
pub fn get(&self, key: &VerifyingKey) -> Option<Attestation>
Get the attestation for a specific key, if present and not expired.
Sourcepub fn resolve_one(&self, scope: &str) -> Option<VerifyingKey>
pub fn resolve_one(&self, scope: &str) -> Option<VerifyingKey>
Resolve a single key for a given scope.
Returns the first valid (non-expired) key found for this scope.
For multi-instance deployments, use keys_for_scope() instead.
Returns None if no keys are authorized for this scope.
Sourcepub fn resolve_subject(&self, signer_pubkey: &[u8; 32]) -> Option<Subject>
pub fn resolve_subject(&self, signer_pubkey: &[u8; 32]) -> Option<Subject>
Resolve a signer key to an authorization subject.
For user keys: returns attestation.subject (e.g., “alice”).
For service keys: returns "service:{first_scope}" (e.g., “service:model”).
Returns None if the key is not in the trust store or is expired.
Sourcepub fn invalidate_by_root(&self, root_key: &VerifyingKey) -> usize
pub fn invalidate_by_root(&self, root_key: &VerifyingKey) -> usize
Remove all entries whose attestation was issued by the given root key.
Returns the number of entries removed.
Trait Implementations§
Source§impl Clone for TrustStore
impl Clone for TrustStore
Source§fn clone(&self) -> TrustStore
fn clone(&self) -> TrustStore
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for TrustStore
impl !RefUnwindSafe for TrustStore
impl Send for TrustStore
impl Sync for TrustStore
impl Unpin for TrustStore
impl UnsafeUnpin for TrustStore
impl !UnwindSafe for TrustStore
Blanket Implementations§
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
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>
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