pub struct LongLivedTokenStore { /* private fields */ }Implementations§
Source§impl LongLivedTokenStore
impl LongLivedTokenStore
Sourcepub fn empty() -> Self
pub fn empty() -> Self
Empty store. No tokens accepted. Register tokens explicitly
via Self::register before exposing the API to the network.
Sourcepub fn from_env() -> Self
pub fn from_env() -> Self
Reads HOMECORE_TOKENS from the environment and registers
each comma-separated value. Trims whitespace; drops empty
values. If the env var is unset / empty, the store starts
empty.
Sourcepub fn allow_any_non_empty() -> Self
pub fn allow_any_non_empty() -> Self
DEV ONLY — closes HC-01/02 audit findings on paper while preserving the legacy “any non-empty bearer” behaviour for users mid-migration. Emits a warn on every check. Removed in P3.
Sourcepub async fn register(&self, token: impl Into<String>) -> bool
pub async fn register(&self, token: impl Into<String>) -> bool
Register a token. Idempotent. Returns true if the token was new, false if it was already in the set.
Sourcepub async fn revoke(&self, token: &str) -> bool
pub async fn revoke(&self, token: &str) -> bool
Revoke a token. Returns true if the token was in the set.
Sourcepub async fn is_valid(&self, token: &str) -> bool
pub async fn is_valid(&self, token: &str) -> bool
Check a token against the store. Fast O(1) hashset lookup.
In allow_any mode, any non-empty token returns true and a
warn is logged.
pub async fn is_empty(&self) -> bool
Sourcepub async fn is_dev_mode(&self) -> bool
pub async fn is_dev_mode(&self) -> bool
Is the store accepting any non-empty bearer (DEV mode)?
Trait Implementations§
Source§impl Clone for LongLivedTokenStore
impl Clone for LongLivedTokenStore
Source§fn clone(&self) -> LongLivedTokenStore
fn clone(&self) -> LongLivedTokenStore
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 !RefUnwindSafe for LongLivedTokenStore
impl !UnwindSafe for LongLivedTokenStore
impl Freeze for LongLivedTokenStore
impl Send for LongLivedTokenStore
impl Sync for LongLivedTokenStore
impl Unpin for LongLivedTokenStore
impl UnsafeUnpin for LongLivedTokenStore
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<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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>
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