pub struct FileBackedCredentialRevocationStore { /* private fields */ }Expand description
Durable credential-revocation store: an in-memory index in front of a JSONL append file. This is the canonical store form owned by the policy process — a revocation becomes visible to checks only after it has been appended AND fsync’d, so a crash never resurrects a revoked credential.
Implementations§
Source§impl FileBackedCredentialRevocationStore
impl FileBackedCredentialRevocationStore
Sourcepub fn open(path: &Path) -> Result<Self>
pub fn open(path: &Path) -> Result<Self>
Open (creating if absent) the durable store at path and load every
non-expired entry into memory. Expired entries are dropped on load —
natural token expiry rejects them anyway.
Uses blocking file IO: called once at startup, before the process serves traffic.
Corruption policy: a malformed COMPLETE line (newline-terminated) is a
hard error — genuine corruption fails closed. A malformed or
newline-less FINAL fragment is a torn tail left by a crash mid-append
(the writer appends record + '\n', so a newline-terminated line is
always complete): the file is truncated to just after the last
complete newline, the recovery is logged loudly, and a fragment that
still parses as a valid record is re-appended through the normal
write path so the revocation is not lost.
A newly created file fsyncs its containing directory so the create itself is durable; creating a fresh empty store where one should pre-exist is logged as a loud warning (all prior revocations lost).
Trait Implementations§
Source§impl CredentialRevocationStore for FileBackedCredentialRevocationStore
impl CredentialRevocationStore for FileBackedCredentialRevocationStore
Source§fn is_revoked_checked<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 CredentialId,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn is_revoked_checked<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 CredentialId,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
is_revoked after
validation. Implementations provide the actual store lookup.
Implementations fail closed: any lookup error returns true.Source§fn revoke_credential<'life0, 'async_trait>(
&'life0 self,
id: CredentialId,
expires_at: i64,
) -> Pin<Box<dyn Future<Output = Result<(), RevocationPublishError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn revoke_credential<'life0, 'async_trait>(
&'life0 self,
id: CredentialId,
expires_at: i64,
) -> Pin<Box<dyn Future<Output = Result<(), RevocationPublishError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
expires_at is the token’s exp — the entry
can be garbage-collected after this time. Read moreSource§fn is_revoked<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 CredentialId,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn is_revoked<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 CredentialId,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
true if the given issuer-scoped credential has been revoked. Read moreAuto Trait Implementations§
impl !Freeze for FileBackedCredentialRevocationStore
impl !RefUnwindSafe for FileBackedCredentialRevocationStore
impl Send for FileBackedCredentialRevocationStore
impl Sync for FileBackedCredentialRevocationStore
impl Unpin for FileBackedCredentialRevocationStore
impl UnsafeUnpin for FileBackedCredentialRevocationStore
impl UnwindSafe for FileBackedCredentialRevocationStore
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
§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