litellm_rs/auth/
api_keys.rs1use super::system::AuthSystem;
4use crate::core::models::ApiKey;
5use crate::utils::error::gateway_error::Result;
6use tracing::info;
7use uuid::Uuid;
8
9impl AuthSystem {
10 pub async fn create_api_key(
12 &self,
13 user_id: Uuid,
14 name: String,
15 permissions: Vec<String>,
16 ) -> Result<(ApiKey, String)> {
17 info!("Creating API key for user: {}", user_id);
18 self.api_key
19 .create_key(Some(user_id), None, name, permissions)
20 .await
21 }
22
23 pub async fn revoke_api_key(&self, key_id: Uuid) -> Result<()> {
25 info!("Revoking API key: {}", key_id);
26 self.api_key.revoke_key(key_id).await
27 }
28}