pub trait VerificationOps:
Send
+ Sync
+ 'static {
type Verification: AuthVerification;
// Required methods
fn create_verification<'life0, 'async_trait>(
&'life0 self,
verification: CreateVerification,
) -> Pin<Box<dyn Future<Output = Result<Self::Verification, AuthError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn get_verification<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
identifier: &'life1 str,
value: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Self::Verification>, AuthError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait;
fn get_verification_by_value<'life0, 'life1, 'async_trait>(
&'life0 self,
value: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Self::Verification>, AuthError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn consume_verification<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
identifier: &'life1 str,
value: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Self::Verification>, AuthError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait;
fn delete_verification<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), AuthError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn delete_expired_verifications<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<usize, AuthError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
// Provided method
fn get_verification_by_identifier<'life0, 'life1, 'async_trait>(
&'life0 self,
identifier: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Self::Verification>, AuthError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait { ... }
}Expand description
Verification token persistence operations.
Required Associated Types§
Required Methods§
fn create_verification<'life0, 'async_trait>(
&'life0 self,
verification: CreateVerification,
) -> Pin<Box<dyn Future<Output = Result<Self::Verification, AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn get_verification<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
identifier: &'life1 str,
value: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Self::Verification>, AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn get_verification_by_value<'life0, 'life1, 'async_trait>(
&'life0 self,
value: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Self::Verification>, AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Sourcefn consume_verification<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
identifier: &'life1 str,
value: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Self::Verification>, AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn consume_verification<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
identifier: &'life1 str,
value: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Self::Verification>, AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Atomically consume a verification token identified by (identifier, value).
Implementations should remove the token if it exists and is valid, then return the removed record. This prevents replay and race windows from split read-then-delete flows.