Skip to main content

get_owned_api_key

Function get_owned_api_key 

Source
pub async fn get_owned_api_key(
    ctx: &AuthContext<impl AuthSchema>,
    config: &ApiKeyConfig,
    key_id: &str,
    user_id: &str,
    action: &str,
) -> AuthResult<ApiKey>
Expand description

Fetch an API key by ID and verify that it belongs to the given user.

Returns AuthError::not_found if the key does not exist or belongs to another user. This pattern was duplicated in handle_get, handle_update, and handle_delete.

ยงErrors

Returns an error if the key is missing, belongs to another owner, or its lookup fails.