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§
Sourcefn 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 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
Sourcefn 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 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