pub trait TokenStore: Send + Sync {
// Required methods
fn load<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<String>, TokenStoreError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn save<'life0, 'life1, 'async_trait>(
&'life0 self,
refresh_token: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), TokenStoreError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn clear<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), TokenStoreError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
Durable persistence seam for a rotated refresh token. All methods are
Send-safe for multi-threaded runtimes.
The consumer plugs the keystore: CNC → macOS Keychain, a short-lived process
→ MemoryTokenStore. The store owns exactly one refresh token per session
(the latest, after rotation).
Required Methods§
Sourcefn load<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<String>, TokenStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn load<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<String>, TokenStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
The currently-persisted refresh token, or None if unauthenticated.
Sourcefn save<'life0, 'life1, 'async_trait>(
&'life0 self,
refresh_token: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), TokenStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn save<'life0, 'life1, 'async_trait>(
&'life0 self,
refresh_token: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), TokenStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Persist a (freshly-rotated) refresh token, replacing any prior one.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".