Commit c888cc3
committed
feat(cli): make
The command was a gated stub (STASH_EXPERIMENTAL_ENV_CMD) waiting on "the
CTS mint endpoint" — which turned out to already exist. It now mints
working credentials from the device-code session using the same APIs the
dashboard uses, all plain fetch against the session's own service URLs:
1. GET {cts}/api/workspaces → server-authoritative region → CS_WORKSPACE_CRN
2. POST {zerokms}/create-client → CS_CLIENT_ID / CS_CLIENT_KEY (hex-transcoded)
3. POST {cts}/api/access-keys → CS_CLIENT_ACCESS_KEY (member role, always —
the CLI deliberately cannot mint admin keys; role is omitted so the
server owns the default)
Design points:
- The ZeroKMS client is created before the access key, so a partial
failure leaves an inert client record, never an unaccounted-for live
credential.
- The key name resolves before any profile/network access, so the
non-interactive missing-name failure is credential-free — that is the
seam the new pty-less e2e exercises (minting live keys from a dev
machine's real session in tests is deliberately impossible).
- --write emits .env.production.local with mode 0600 and refuses to
overwrite non-interactively; --json emits one minted object or the
shared { status: 'error' } envelope.
Closes #663 (the wasm/edge credential gap, CIP-2997): edge runtimes that
cannot read ~/.cipherstash (containerised supabase functions serve,
Workers) now have a supported path — stash env + --env-file/secret store.
Claude-Session: https://claude.ai/code/session_01MxTTPaPP16m6br7Hoab94wstash env mint real deployment credentials1 parent 8b2551a commit c888cc3
9 files changed
Lines changed: 793 additions & 46 deletions
File tree
- .changeset
- packages/cli
- src
- bin
- cli
- commands/env
- __tests__
- tests/e2e
- skills
- stash-cli
- stash-supabase
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
128 | | - | |
| 128 | + | |
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
| |||
532 | 532 | | |
533 | 533 | | |
534 | 534 | | |
535 | | - | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
536 | 540 | | |
537 | 541 | | |
538 | 542 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
530 | 530 | | |
531 | 531 | | |
532 | 532 | | |
533 | | - | |
| 533 | + | |
534 | 534 | | |
535 | 535 | | |
536 | 536 | | |
537 | | - | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
538 | 554 | | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
539 | 561 | | |
540 | 562 | | |
541 | | - | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
542 | 570 | | |
543 | 571 | | |
544 | 572 | | |
| |||
0 commit comments