pub struct MemoryApiKeyStore { /* private fields */ }Expand description
In-memory implementation of API key store (for testing)
Implementations§
Trait Implementations§
Source§impl ApiKeyStore for MemoryApiKeyStore
impl ApiKeyStore for MemoryApiKeyStore
Source§fn create<'life0, 'life1, 'async_trait>(
&'life0 self,
record: &'life1 ApiKeyRecord,
) -> Pin<Box<dyn Future<Output = Result<(), ApiKeyError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn create<'life0, 'life1, 'async_trait>(
&'life0 self,
record: &'life1 ApiKeyRecord,
) -> Pin<Box<dyn Future<Output = Result<(), ApiKeyError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Store a new API key
Source§fn find_by_hash<'life0, 'life1, 'async_trait>(
&'life0 self,
hash: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<ApiKeyRecord>, ApiKeyError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn find_by_hash<'life0, 'life1, 'async_trait>(
&'life0 self,
hash: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<ApiKeyRecord>, ApiKeyError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Find a key by its hash (for legacy SHA-256 compatibility)
Source§fn find_and_verify_key<'life0, 'life1, 'async_trait>(
&'life0 self,
plaintext_key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<ApiKeyRecord>, ApiKeyError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn find_and_verify_key<'life0, 'life1, 'async_trait>(
&'life0 self,
plaintext_key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<ApiKeyRecord>, ApiKeyError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Find and verify a key using Argon2
Recommended approach: extract key ID from prefix for O(1) lookup
Source§fn find_by_user<'life0, 'life1, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<ApiKeyRecord>, ApiKeyError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn find_by_user<'life0, 'life1, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<ApiKeyRecord>, ApiKeyError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Find all keys for a user
Source§fn record_usage<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<(), ApiKeyError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn record_usage<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<(), ApiKeyError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Update last_used_at timestamp
Source§fn revoke<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<(), ApiKeyError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn revoke<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<(), ApiKeyError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Revoke a key
Source§fn delete<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<(), ApiKeyError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn delete<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<(), ApiKeyError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Delete a key
Source§fn rotate<'life0, 'async_trait>(
&'life0 self,
old_key_id: Uuid,
expires_in_days: Option<u32>,
) -> Pin<Box<dyn Future<Output = Result<(ApiKeyRecord, String), ApiKeyError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn rotate<'life0, 'async_trait>(
&'life0 self,
old_key_id: Uuid,
expires_in_days: Option<u32>,
) -> Pin<Box<dyn Future<Output = Result<(ApiKeyRecord, String), ApiKeyError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Rotate a key: creates a new key and revokes the old one Read more
Source§impl Debug for MemoryApiKeyStore
impl Debug for MemoryApiKeyStore
Source§impl Default for MemoryApiKeyStore
impl Default for MemoryApiKeyStore
Source§fn default() -> MemoryApiKeyStore
fn default() -> MemoryApiKeyStore
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !Freeze for MemoryApiKeyStore
impl !RefUnwindSafe for MemoryApiKeyStore
impl Send for MemoryApiKeyStore
impl Sync for MemoryApiKeyStore
impl Unpin for MemoryApiKeyStore
impl !UnwindSafe for MemoryApiKeyStore
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more