pub trait TwoFactorStore: Send + Sync {
// Required methods
fn create_two_factor<'life0, 'async_trait>(
&'life0 self,
two_factor: CreateTwoFactor,
) -> Pin<Box<dyn Future<Output = AuthResult<TwoFactor>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_two_factor_by_user_id<'life0, 'life1, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<Option<TwoFactor>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn update_two_factor_backup_codes<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
backup_codes: &'life2 str,
) -> Pin<Box<dyn Future<Output = AuthResult<TwoFactor>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn delete_two_factor<'life0, 'life1, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
// Provided methods
fn update_two_factor<'life0, 'life1, 'async_trait>(
&'life0 self,
_id: &'life1 str,
_update: UpdateTwoFactor,
) -> Pin<Box<dyn Future<Output = AuthResult<Option<TwoFactor>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn increment_two_factor_failure<'life0, 'life1, 'async_trait>(
&'life0 self,
_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<Option<TwoFactor>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn set_two_factor_lock_if_count_at_least<'life0, 'life1, 'async_trait>(
&'life0 self,
_id: &'life1 str,
_threshold: f64,
_until: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = AuthResult<Option<TwoFactor>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn clear_expired_two_factor_lock<'life0, 'life1, 'async_trait>(
&'life0 self,
_id: &'life1 str,
_now: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = AuthResult<Option<TwoFactor>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn reset_two_factor_failures<'life0, 'life1, 'async_trait>(
&'life0 self,
_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn compare_and_swap_two_factor_backup_codes<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_id: &'life1 str,
_expected: &'life2 str,
_replacement: &'life3 str,
) -> Pin<Box<dyn Future<Output = AuthResult<bool>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait { ... }
}Required Methods§
fn create_two_factor<'life0, 'async_trait>(
&'life0 self,
two_factor: CreateTwoFactor,
) -> Pin<Box<dyn Future<Output = AuthResult<TwoFactor>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_two_factor_by_user_id<'life0, 'life1, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<Option<TwoFactor>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn update_two_factor_backup_codes<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
backup_codes: &'life2 str,
) -> Pin<Box<dyn Future<Output = AuthResult<TwoFactor>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn delete_two_factor<'life0, 'life1, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Provided Methods§
fn update_two_factor<'life0, 'life1, 'async_trait>(
&'life0 self,
_id: &'life1 str,
_update: UpdateTwoFactor,
) -> Pin<Box<dyn Future<Output = AuthResult<Option<TwoFactor>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Sourcefn increment_two_factor_failure<'life0, 'life1, 'async_trait>(
&'life0 self,
_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<Option<TwoFactor>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn increment_two_factor_failure<'life0, 'life1, 'async_trait>(
&'life0 self,
_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<Option<TwoFactor>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Atomically increment the stored counter, returning the winning row. SQL-backed adapters preserve NULL, matching the pinned Kysely adapter.
fn set_two_factor_lock_if_count_at_least<'life0, 'life1, 'async_trait>(
&'life0 self,
_id: &'life1 str,
_threshold: f64,
_until: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = AuthResult<Option<TwoFactor>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn clear_expired_two_factor_lock<'life0, 'life1, 'async_trait>(
&'life0 self,
_id: &'life1 str,
_now: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = AuthResult<Option<TwoFactor>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn reset_two_factor_failures<'life0, 'life1, 'async_trait>(
&'life0 self,
_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn compare_and_swap_two_factor_backup_codes<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_id: &'life1 str,
_expected: &'life2 str,
_replacement: &'life3 str,
) -> Pin<Box<dyn Future<Output = AuthResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".