pub trait ApiKeyStore: Send + Sync {
// Required method
fn validate_key<'life0, 'life1, 'async_trait>(
&'life0 self,
api_key: &'life1 str,
) -> Pin<Box<dyn Future<Output = ApiKeyValidationResult> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
// Provided methods
fn get_rate_limit_config<'life0, 'life1, 'async_trait>(
&'life0 self,
api_key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Option<BarnacleConfig>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn try_cache_key<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
api_key: &'life1 str,
config: &'life2 BarnacleConfig,
ttl_seconds: Option<u64>,
) -> Pin<Box<dyn Future<Output = Result<(), BarnacleError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
}
Expand description
Trait for API key validation and configuration retrieval
Required Methods§
Provided Methods§
Sourcefn get_rate_limit_config<'life0, 'life1, 'async_trait>(
&'life0 self,
api_key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Option<BarnacleConfig>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_rate_limit_config<'life0, 'life1, 'async_trait>(
&'life0 self,
api_key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Option<BarnacleConfig>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Optional: Get rate limit configuration for a specific key This allows for dynamic per-key configuration
Sourcefn try_cache_key<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
api_key: &'life1 str,
config: &'life2 BarnacleConfig,
ttl_seconds: Option<u64>,
) -> Pin<Box<dyn Future<Output = Result<(), BarnacleError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn try_cache_key<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
api_key: &'life1 str,
config: &'life2 BarnacleConfig,
ttl_seconds: Option<u64>,
) -> Pin<Box<dyn Future<Output = Result<(), BarnacleError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Optional: Cache a validated API key for future requests Default implementation does nothing - stores can override if they support caching