Expand description
API Key management — Personal Access Token (PAT) pattern.
API keys are long-lived credentials that can be exchanged for short-lived JWTs. This allows agents and external systems to authenticate without managing JWT expiry themselves.
§Flow
- User creates an API key via
POST /api/uar/auth/keys(requires JWT) - Raw key is shown once — caller must store it securely
- Caller sends
POST /api/uar/auth/exchangewith the raw key → receives a JWT - JWT is used for subsequent requests (standard Bearer auth)
- Middleware also accepts raw API keys directly via
X-API-Keyheader
Structs§
- ApiKey
Metadata - Public metadata returned to callers (no hash).
- ApiKey
Record - Stored API key record (hash only — raw key is never persisted).
- ApiKey
Response - Response returned when a key is created (raw key shown once).
- ApiKey
Service - API key management service.
- Create
KeyRequest - Request body for creating a new API key.
- InMemory
ApiKey Storage - Thread-safe in-memory API key store (suitable for development / testing).
Traits§
- ApiKey
Storage - Persistence abstraction for API key records.