Skip to main content

verify_bearer_token

Function verify_bearer_token 

Source
pub fn verify_bearer_token(
    token: &str,
    keys: &[ApiKeyEntry],
) -> Option<AuthIdentity>
Expand description

Verify a bearer token against configured API keys.

Argon2id verification is CPU-intensive, so this should be called via spawn_blocking. Returns the matching identity if the token is valid.

Iterates all keys to completion to prevent timing side-channels that would reveal how many keys exist or which slot matched.