Step 1b of ADR 0001, with the user's decisions D1–D3 recorded: - POST /v1/licences/ci (PUBLIC_EXPLICIT, the bearer is a tenant API key with scope <product>:licence): 24 h licence with kind "ci", no heartbeat, not a seat (D1; the registry records ci.licence usage once per key and day). Reused per key, device and UTC day; at most 60 calls per key and hour. Unblocks firmwerk#64 step 1. - Werkpilot CI licences carry the tenant's LiteLLM key (D2) with a 1-day LiteLLM expiry; the secret is sealed on the licence row (AES-256-GCM, new SECRETS_ENCRYPTION_KEY, migration 0017) so the reused licence hands out the same key. At most 10 keys per API key and day. Without the encryption key a reuse comes without the key. - Integration keys: a tenant admin's user token from a holder product's web client (werkmeister-<env>) creates, lists and revokes that holder's key for its own tenant only; scopes from a per-holder allowlist, the holder product must be booked. A user token on the key routes is classified as AUTHZ group api-keys.integration, so plain api-keys stays a service grant. - Migration 0016: key names are unique among active keys only, so a revoked name can be reused (re-issue = revoke, then create). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
5 lines
329 B
SQL
5 lines
329 B
SQL
-- A key name is unique among a tenant's ACTIVE keys only, so a revoked key's
|
|
-- name can be reused (re-issuing an integration key = revoke, then create).
|
|
ALTER TABLE api_keys DROP CONSTRAINT api_keys_tenant_id_name_key;
|
|
CREATE UNIQUE INDEX api_keys_tenant_name_active_idx ON api_keys (tenant_id, name) WHERE revoked_at IS NULL;
|