TokenStorage

Trait TokenStorage 

Source
pub trait TokenStorage: UserStorage {
    // Required methods
    fn save_secure_token<'life0, 'life1, 'async_trait>(
        &'life0 self,
        token: &'life1 SecureToken,
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_secure_token<'life0, 'life1, 'async_trait>(
        &'life0 self,
        token: &'life1 str,
        purpose: TokenPurpose,
    ) -> Pin<Box<dyn Future<Output = Result<Option<SecureToken>, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn set_secure_token_used<'life0, 'life1, 'async_trait>(
        &'life0 self,
        token: &'life1 str,
        purpose: TokenPurpose,
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn cleanup_expired_secure_tokens<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Storage methods for secure tokens

This trait provides storage for generic secure tokens that can be used for various authentication purposes like magic links, password resets, and email verification.

Required Methods§

Source

fn save_secure_token<'life0, 'life1, 'async_trait>( &'life0 self, token: &'life1 SecureToken, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Save a secure token to storage

Source

fn get_secure_token<'life0, 'life1, 'async_trait>( &'life0 self, token: &'life1 str, purpose: TokenPurpose, ) -> Pin<Box<dyn Future<Output = Result<Option<SecureToken>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get a secure token by its string value and purpose

Source

fn set_secure_token_used<'life0, 'life1, 'async_trait>( &'life0 self, token: &'life1 str, purpose: TokenPurpose, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Mark a secure token as used

Source

fn cleanup_expired_secure_tokens<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Clean up expired tokens for all purposes

Implementors§