pub struct VerificationStore { /* private fields */ }Implementations§
Source§impl VerificationStore
impl VerificationStore
pub fn new() -> Self
pub fn with_backend(backend: Box<dyn VerificationBackend>) -> Self
Sourcepub fn mint(
&self,
kind: TokenKind,
email: &str,
user_id: Option<String>,
payload: Option<String>,
) -> MintedToken
pub fn mint( &self, kind: TokenKind, email: &str, user_id: Option<String>, payload: Option<String>, ) -> MintedToken
Mint + store a token. Returns the plaintext (caller emails it
to the user) alongside the persisted record (whose
token_hash is what’s saved).
Sourcepub fn consume(
&self,
plaintext: &str,
expected_kind: TokenKind,
) -> Result<VerificationToken, VerificationError>
pub fn consume( &self, plaintext: &str, expected_kind: TokenKind, ) -> Result<VerificationToken, VerificationError>
Look up + consume a plaintext token. Returns the matching
record on success — the caller then applies the side effect
(set new password, swap email, mint session). Idempotent: a
second call with the same token returns AlreadyConsumed.
Sourcepub fn purge_expired(&self)
pub fn purge_expired(&self)
Opportunistic sweep — call from a background tick.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for VerificationStore
impl !RefUnwindSafe for VerificationStore
impl Send for VerificationStore
impl Sync for VerificationStore
impl Unpin for VerificationStore
impl UnsafeUnpin for VerificationStore
impl !UnwindSafe for VerificationStore
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