Skip to main content

VerificationBackend

Trait VerificationBackend 

Source
pub trait VerificationBackend: Send + Sync {
    // Required methods
    fn put(&self, token: &VerificationToken);
    fn get(&self, id: &str) -> Option<VerificationToken>;
    fn by_prefix(&self, prefix: &str) -> Vec<VerificationToken>;
    fn mark_consumed(&self, id: &str, now: u64) -> bool;
    fn purge_expired(&self, now: u64);
}

Required Methods§

Source

fn put(&self, token: &VerificationToken)

Source

fn get(&self, id: &str) -> Option<VerificationToken>

Source

fn by_prefix(&self, prefix: &str) -> Vec<VerificationToken>

Lookup by token_prefix — backends index this column so consume_by_plaintext is one fast SQL hit per attempt.

Source

fn mark_consumed(&self, id: &str, now: u64) -> bool

Mark as consumed. Implementations MUST be idempotent so concurrent verify requests can’t both succeed.

Source

fn purge_expired(&self, now: u64)

Best-effort sweep of expired-and-consumed rows. Called opportunistically — never blocking the hot path.

Implementors§