Skip to main content

Module api_key

Module api_key 

Source
Expand description

API key authentication with Argon2 password hashing.

Keys are stored as Argon2 hashes. Each key has a name, optional expiry, and optional role. Multiple keys can be valid simultaneously for rotation.

§Example

use chronix_security::auth::api_key::ApiKeyStore;

let mut store = ApiKeyStore::new();
let raw_key = store.create_key("admin", None).unwrap();
assert!(store.validate(&raw_key).is_ok());

Structs§

ApiKeyEntry
A stored API key entry with metadata.
ApiKeyStore
In-memory store for API keys with Argon2 hashing.