API Key and Token Service · View 11 of 22 · Act 4 · Data
Decisions
- `credential` holds a digest and a pepper version, never a secret. The pepper version is what makes rotation possible without re-issuing every customer credential.
- Scopes live on `credential_version`, not on `credential`, so a scope change is a new version with the old one retained in audit rather than an update that erases what the key used to be able to do.
- `revocation` is keyed by a monotonic sequence, and a bulk revocation is a tenant epoch bump rather than N rows — one message revokes a hundred thousand keys.
Observations, not inputs
- `usage_observation` is explicitly lossy and lagging. Nothing reads it to make an authorization decision, which is what allows it to be cheap.
- Promoting it to an authorization input — auto-expiring idle keys — would make the hot path a durable write at 250,000/s. That trade is named in the requirement and deferred to Phase 3.
Assumptions
- last_used_at freshness within 5 minutes; call counts approximate.
- Audit records are hash-chained per tenant, so deletion is detectable without a separate ledger.