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§
fn put(&self, token: &VerificationToken)
fn get(&self, id: &str) -> Option<VerificationToken>
Sourcefn by_prefix(&self, prefix: &str) -> Vec<VerificationToken>
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.
Sourcefn mark_consumed(&self, id: &str, now: u64) -> bool
fn mark_consumed(&self, id: &str, now: u64) -> bool
Mark as consumed. Implementations MUST be idempotent so concurrent verify requests can’t both succeed.
Sourcefn purge_expired(&self, now: u64)
fn purge_expired(&self, now: u64)
Best-effort sweep of expired-and-consumed rows. Called opportunistically — never blocking the hot path.