pub struct CpskValidator { /* private fields */ }Expand description
Capability Pre-Shared Key (CPSK) validator
Stores tokens in memory with their associated scopes.
Tokens have the format: cpsk_<base62-random-32-chars>
Implementations§
Source§impl CpskValidator
impl CpskValidator
Sourcepub fn with_default_ttl(ttl: Duration) -> Self
pub fn with_default_ttl(ttl: Duration) -> Self
Create a new CPSK validator with a default token TTL. Tokens registered without an explicit expiry will expire after this duration. The relay uses 24h by default to prevent indefinitely-valid tokens (Phase 1.2).
Sourcepub fn register(&self, token: String, info: TokenInfo)
pub fn register(&self, token: String, info: TokenInfo)
Register a token with the given scopes. If the token has no expiry and a default TTL is configured, the TTL is applied.
Sourcepub fn list_tokens(&self) -> Vec<String>
pub fn list_tokens(&self) -> Vec<String>
List all token IDs (for admin purposes)
Sourcepub fn generate_token() -> String
pub fn generate_token() -> String
Generate a new CPSK token string using cryptographically secure randomness
Trait Implementations§
Source§impl Default for CpskValidator
impl Default for CpskValidator
Auto Trait Implementations§
impl !Freeze for CpskValidator
impl RefUnwindSafe for CpskValidator
impl Send for CpskValidator
impl Sync for CpskValidator
impl Unpin for CpskValidator
impl UnsafeUnpin for CpskValidator
impl UnwindSafe for CpskValidator
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
Mutably borrows from an owned value. Read more