pub trait OAuthRefreshTokenFormatter:
Send
+ Sync
+ Debug {
// Required methods
fn encrypt(
&self,
token: &str,
session_id: Option<&str>,
) -> AuthResult<OAuthRefreshTokenEncryption>;
fn decrypt<'life0, 'life1, 'async_trait>(
&'life0 self,
token: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<OAuthDecodedRefreshToken>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
Better Auth’s formatRefreshToken. Both callbacks are required by its types;
absence of the whole formatter preserves raw refresh credentials.
Required Methods§
Sourcefn encrypt(
&self,
token: &str,
session_id: Option<&str>,
) -> AuthResult<OAuthRefreshTokenEncryption>
fn encrypt( &self, token: &str, session_id: Option<&str>, ) -> AuthResult<OAuthRefreshTokenEncryption>
Invoked after refresh persistence (and rotation claim), before prefixing.
Sourcefn decrypt<'life0, 'life1, 'async_trait>(
&'life0 self,
token: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<OAuthDecodedRefreshToken>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn decrypt<'life0, 'life1, 'async_trait>(
&'life0 self,
token: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<OAuthDecodedRefreshToken>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Invoked after removing the configured prefix; unlike encryption this is awaited.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".