Skip to content

v2: API keys management pages#1106

Merged
canalesb93 merged 4 commits into
mainfrom
claude/v2-api-keys
May 16, 2026
Merged

v2: API keys management pages#1106
canalesb93 merged 4 commits into
mainfrom
claude/v2-api-keys

Conversation

@canalesb93
Copy link
Copy Markdown
Owner

Summary

Build out the v2 SPA's API keys surface — list page, new-key form, and one-time plaintext disclosure subpage. Drops the user into the same conventions as the rest of v2 (shadcn primitives, RHF + zod, shared DataTable, withMutationToast).

  • /v2/api-keys — Active / Revoked tabs over the shared DataTable, with name/prefix/actor search. Per-row dropdown opens a revoke confirm dialog that wires straight into useRevokeAPIKey. Read-only sessions hit the existing ApiError path because GET /api/v1/api-keys requires write scope.
  • /v2/api-keys/new — shadcn Form + RHF + zod. Scope and actor type are OptionCard-wrapped RadioGroup tiles so the choice reads as a deliberate decision rather than a buried dropdown. Optional actor display name lets you label an integration ("Claude — Ricardo's laptop") without renaming the key itself.
  • /v2/api-keys/createdCard with a one-time-copy plaintext input, an X-API-Key usage hint, and a one-line "stored as SHA-256 hash" warning. Plaintext lives in sessionStorage so a refresh mid-copy isn't fatal; it clears on unmount or on "I've saved it — done".

New shadcn primitive (radio-group) added via the CLI plus a sandbox specimen so the component is discoverable in the gallery.

Screens

List — Active / Revoked tabs, search, per-row actions (desktop / tablet / mobile):

API keys list

New key form (desktop):

New API key form

New key form — responsive composite:

New API key form — responsive

Key created — one-time plaintext disclosure:

Key created — one-time disclosure

Test plan

  • bun run lint (tsc --noEmit) — clean
  • bun run build — clean
  • Validated /v2/api-keys, /v2/api-keys/new, /v2/api-keys/created in headless Chromium against a locally-built breadbox serve on port 8083
  • Drove the new-key form end-to-end — list refetches and the new row shows up after returning from /created
  • Sandbox RadioGroup specimen renders in /v2/sandbox → Primitives

🤖 Generated with Claude Code

canalesb93 and others added 4 commits May 15, 2026 22:39
List, create, and one-time-plaintext-disclosure subpages for the v2 SPA.

- /v2/api-keys — Active/Revoked tabs over a shared DataTable. Search by
  name/prefix/actor. Dropdown action triggers a revoke confirm dialog
  that wires straight into useRevokeAPIKey.
- /v2/api-keys/new — shadcn Form + RHF + zod. Scope and actor type pick
  via OptionCard-wrapped RadioGroup. Plaintext is stashed in
  sessionStorage and the user is bounced to /created.
- /v2/api-keys/created — Card with one-time-copy plaintext input,
  X-API-Key usage hint, and a one-line "stored as SHA-256 hash" warning.
  Storage clears on unmount or "Done" click.

Adds the radio-group shadcn primitive and a sandbox specimen so the
component shows up in the gallery.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Wire the apiKeysSearchSchema to URL state (status + q) — refresh now
  preserves the tab/search like the comment promised. Matches
  connections.tsx idiom.
- Drop the triple `as CreateAPIKeyResult` cast in api-key-form by
  awaiting mutateAsync directly and toasting inline; no behavior change.
- Flatten the nested-ternary emptyState into a small renderEmptyState
  helper with early returns.
- Use shadcn <Input readOnly> on /api-keys/created instead of a
  hand-styled <input>.
- Memoize the filtered row set; clear the "copied" setTimeout on unmount
  to avoid late setState on a torn-down component.
- Replace `typeof ShieldCheck` / `typeof Bot` with LucideIcon; drop
  unreachable ?? Bot fallback in ActorBadge.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
# Conflicts:
#	web/src/api/types.ts
#	web/src/main.tsx
@canalesb93 canalesb93 merged commit ecfffba into main May 16, 2026
10 checks passed
Copy link
Copy Markdown
Owner Author

Merge activity

@canalesb93 canalesb93 deleted the claude/v2-api-keys branch May 16, 2026 06:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant