Skip to main content

TokenStore

Trait TokenStore 

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

Source

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.

Source

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.

Source

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

Drop the persisted refresh token (logout / terminal refresh failure).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§