Problem
Quint’s original authentication used a flat API key scheme (X-API-Key header, SHA-256 hashed). This had no concept of:
- Agent identity or delegation chains
- Role-based access control (RBAC)
- Action signatures / non-repudiation
- Human override flows for high-risk decisions
- Token rotation or granular revocation
Solution
A 6-type token hierarchy that traces accountability from humans through agents and sub-agents with cryptographic attestation. The system is split into two components:- Shared auth library (
src/auth/) — In-process validation on the API hot path (under 10ms) - Auth service (
src/auth_service/) — Separate FastAPI container for token lifecycle management
Architecture
Design Decisions
In-process validation (not an auth gateway)
Token validation runs inside the API process — no network hop to the auth service. This is critical for the sub-10ms latency target on event ingestion. The auth service is only called for management operations (create, rotate, revoke tokens).Bloom filter for revocation
Instead of checking the database on every request, a Redis bitmap bloom filter provides O(1) revocation checks with ~0.8% false positive rate. The bloom filter is rebuilt from theauth.revocation_log table on demand.
Dual-mode auth (backward compatible)
BothAuthorization: Bearer qt_* and X-API-Key work simultaneously. Legacy responses include a deprecation header. No breaking changes during migration.
ES256 (ECDSA P-256) over RS256
ES256 was chosen over RS256 for:- Smaller key sizes (256-bit vs 2048+ bit)
- Faster signature verification (~0.5ms)
- Industry alignment with WebAuthn / FIDO2