Repository navigation
typetorch keys create / list / revoke: API keys with roles - #42
Merged
Merged
Conversation
…he backend
- create: POST /v1/admin/keys { name, role, expiresDays? }; the key printed once (--json: in key), registered with
the scrubber the moment it arrives, never written anywhere; no error quotes a reply that held a key
- list [--all]: id, name, role, scopes, expires, last used, built-in / revoked
- revoke <id>: DELETE /v1/admin/keys/{id}; built-in env:* ids and pasted whole keys refused locally
- validation: name [a-z0-9._-]{1,48}, the five roles, --expires 1-3650 days (90d, 365d, 1y)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Plan:
/home/phasenull/projects/TypeTorch/plans/31-api-keys-rbac.md(CLI half). Named API keys with roles on the TypeTorch backend, managed with the admin token.Commands
typetorch keys create --name <name> --role <game|lookup|support|analyst|admin> [--expires 365d|90d|1y]:POST /v1/admin/keys.--jsonreturns it inkey.typetorch keys list [--all]:GET /v1/admin/keys[?all=1]. A table of id, name, role, scopes, expires, last used, state (active / built-in / revoked);--jsontoo.typetorch keys revoke <id>:DELETE /v1/admin/keys/{id}. Refused locally, before any request:env:*ids, with a hint to rotate the env variable instead;[a-z0-9._-]{1,48}, the five roles, expiry 1..3650 days.keyscommand with the prod-signing subcommands (init,rotate,resign), which are unchanged. API-key flags are refused on those.Test plan
bunx tsc --noEmitbun test test/apikeys.test.ts: 16 pass. Covers:--jsonoutput, and never in errors or inlist/revokeoutput;bun test: 875 pass, 1 fail. The failure is the knownbackend blessfull-run test, which also fails on main.bun run build,node scripts/smoke.mjsfeat/api-keys-rbacis deployed:typetorch keys create/list/revokeagainst a test backend.No version bump.
🤖 Generated with Claude Code