pub struct ApiKeyManager { /* private fields */ }Implementations§
Source§impl ApiKeyManager
impl ApiKeyManager
pub fn new() -> Self
pub async fn generate_api_key( &self, user_id: Uuid, name: String, description: Option<String>, scopes: Vec<String>, rate_limit: Option<u32>, expires_in: Option<Duration>, ) -> Result<(String, ApiKey)>
pub async fn verify_api_key(&self, key: &str) -> Result<ApiKey>
pub async fn revoke_api_key(&self, key_id: &Uuid) -> Result<()>
pub async fn update_last_used(&self, key_id: &Uuid) -> Result<()>
pub async fn list_user_keys(&self, user_id: &Uuid) -> Vec<ApiKey>
pub async fn rotate_api_key( &self, old_key_id: &Uuid, ) -> Result<(String, ApiKey)>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ApiKeyManager
impl !RefUnwindSafe for ApiKeyManager
impl Send for ApiKeyManager
impl Sync for ApiKeyManager
impl Unpin for ApiKeyManager
impl !UnwindSafe for ApiKeyManager
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