Skip to main content

TokenCache

Trait TokenCache 

Source
pub trait TokenCache: Send + Sync {
    // Required methods
    fn get_jwt<'life0, 'async_trait>(
        &'life0 self,
        app_id: GitHubAppId,
    ) -> Pin<Box<dyn Future<Output = Result<Option<JsonWebToken>, CacheError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn store_jwt<'life0, 'async_trait>(
        &'life0 self,
        jwt: JsonWebToken,
    ) -> Pin<Box<dyn Future<Output = Result<(), CacheError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_installation_token<'life0, 'async_trait>(
        &'life0 self,
        installation_id: InstallationId,
    ) -> Pin<Box<dyn Future<Output = Result<Option<InstallationToken>, CacheError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn store_installation_token<'life0, 'async_trait>(
        &'life0 self,
        token: InstallationToken,
    ) -> Pin<Box<dyn Future<Output = Result<(), CacheError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn invalidate_installation_token<'life0, 'async_trait>(
        &'life0 self,
        installation_id: InstallationId,
    ) -> Pin<Box<dyn Future<Output = Result<(), CacheError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn cleanup_expired_tokens(&self);
}
Expand description

Interface for caching authentication tokens securely.

Required Methods§

Source

fn get_jwt<'life0, 'async_trait>( &'life0 self, app_id: GitHubAppId, ) -> Pin<Box<dyn Future<Output = Result<Option<JsonWebToken>, CacheError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get cached JWT token.

Source

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

Store JWT token in cache.

Source

fn get_installation_token<'life0, 'async_trait>( &'life0 self, installation_id: InstallationId, ) -> Pin<Box<dyn Future<Output = Result<Option<InstallationToken>, CacheError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get cached installation token.

Source

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

Store installation token in cache.

Source

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

Invalidate installation token.

Source

fn cleanup_expired_tokens(&self)

Cleanup expired tokens.

Implementors§