Title: feat: --provision-keys flag for pod creation (Schnorr/Nostr/CID v1.0 identity) · Issue #437 · JavaScriptSolidServer/JavaScriptSolidServer · GitHub
Open Graph Title: feat: --provision-keys flag for pod creation (Schnorr/Nostr/CID v1.0 identity) · Issue #437 · JavaScriptSolidServer/JavaScriptSolidServer
X Title: feat: --provision-keys flag for pod creation (Schnorr/Nostr/CID v1.0 identity) · Issue #437 · JavaScriptSolidServer/JavaScriptSolidServer
Description: Summary Add a --provision-keys CLI flag for pod creation that generates a Schnorr secp256k1 keypair and writes it to /private/privkey.jsonld in W3C CID v1.0 Multikey format. The single key works as: (a) the pod owner's signing identity, ...
Open Graph Description: Summary Add a --provision-keys CLI flag for pod creation that generates a Schnorr secp256k1 keypair and writes it to /private/privkey.jsonld in W3C CID v1.0 Multikey format. The single key works as...
X Description: Summary Add a --provision-keys CLI flag for pod creation that generates a Schnorr secp256k1 keypair and writes it to /private/privkey.jsonld in W3C CID v1.0 Multikey format. The single key works as...
Opengraph URL: https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/issues/437
X: @github
Domain: github.com
IPv4 address: 140.82.112.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"feat: --provision-keys flag for pod creation (Schnorr/Nostr/CID v1.0 identity)","articleBody":"## Summary\n\nAdd a `--provision-keys` CLI flag for pod creation that generates a Schnorr secp256k1 keypair and writes it to `/private/privkey.jsonld` in W3C CID v1.0 Multikey format. The single key works as: (a) the pod owner's signing identity, (b) a Nostr identity (same curve), (c) a did:nostr DID controller.\n\nOne CLI flag → pod-resident self-sovereign identity ready for both Solid and Nostr/agentic use cases. Differentiates JSS as the AGPL-substrate Solid server with native agentic identity support.\n\n## Why\n\nThe agentic use case (AI agent operates a Solid pod) requires the pod to own its credentials. Current flow: spin up pod → manually generate keys → manually write to a path → manually configure ACLs → manually wire to did:nostr. This is 4 manual steps for a deployment pattern that should be one.\n\nThis also lands JSS as a reference implementation of W3C CID v1.0 (REC) in the substrate itself — the key file IS a CID v1.0 conformant document.\n\n## Phase 1 — Minimum viable shipping scope\n\n### CLI\n\n```bash\njss start --single-user --provision-keys\n# or for multi-user\njss create-pod --owner=alice --provision-keys\n```\n\n### Key generation\n\n- Algorithm: Schnorr secp256k1 via `@noble/curves/secp256k1`\n- Standard, well-audited, same curve as Nostr/Bitcoin\n- No new cryptographic dependencies\n\n### File written\n\n`/private/privkey.jsonld` — W3C CID v1.0 Multikey format:\n\n```json\n{\n \"@context\": \"https://www.w3.org/ns/cid/v1\",\n \"type\": \"Multikey\",\n \"controller\": \"did:nostr:npub1...\",\n \"publicKeyMultibase\": \"z6Mk...\",\n \"secretKeyMultibase\": \"z6L...\",\n \"nostr\": {\n \"npub\": \"npub1...\",\n \"nsec\": \"nsec1...\"\n }\n}\n```\n\nThe `nostr` extension block is non-standard but lets Nostr-native tools grab `nsec`/`npub` directly without computing from multibase. CID-aware tools use the spec-standard `secretKeyMultibase` / `publicKeyMultibase`.\n\n### ACL\n\n`/private/` ACL must be owner-only (Read + Write for owner WebID, no public). This is the standard `/private/` container ACL — verify it's auto-set on pod creation; if not, set it explicitly during `--provision-keys`.\n\n### CLI output\n\nAfter successful provisioning:\n\n```\n✓ Pod created at https://alice.example/\n✓ Schnorr secp256k1 keypair generated\n✓ Public key: https://alice.example/private/privkey.jsonld\n✓ Owner DID: did:nostr:npub1...\n✓ Nostr npub: npub1...\n\n⚠ BACK UP /private/privkey.jsonld\n Losing this file means losing this identity permanently.\n See docs/key-recovery.md\n```\n\n### Tests\n\n- Unit: key generation produces valid Schnorr keypair\n- Unit: JSON-LD output is valid CID v1.0 Multikey document\n- Unit: multibase encoding is correct\n- Integration: `--provision-keys` writes file to correct path\n- Integration: ACL on `/private/` correctly restricts to owner\n- Integration: file is readable by owner, 401 for public\n\n### Documentation\n\n- `docs/provision-keys.md` — feature overview, security notes, recovery flow\n- `docs/key-recovery.md` — backup recommendations, restore process\n- README mention under \"CLI Reference\" section\n\n## Phase 1 acceptance criteria\n\n- [ ] `--provision-keys` flag added to `jss start --single-user` and pod creation\n- [ ] Schnorr secp256k1 keypair generated using `@noble/curves`\n- [ ] `/private/privkey.jsonld` written with CID v1.0 Multikey format + nostr extension\n- [ ] ACL on `/private/` set to owner-only\n- [ ] CLI emits prominent backup-required message\n- [ ] Tests cover generation, format, ACL, file-access\n- [ ] Documentation pages added\n- [ ] All existing tests pass\n\n## Phase 1 explicit NON-goals (deferred to future phases)\n\n- did:nostr DID-document publication (Phase 2)\n- WebID profile updated to reference public key (Phase 2)\n- Discovery mechanism (Phase 2)\n- Seed-phrase derivation (BIP-39 / 12-24 word backup) (Phase 3)\n- Key rotation flow (Phase 3)\n- Multi-algorithm key support (Ed25519, RSA) (Phase 3)\n- Hardware wallet integration (Phase 4)\n- Encrypted key-at-rest (Phase 4)\n- Multi-pod / multi-device key sync (Phase 4)\n\n## Future phases (sketched)\n\n### Phase 2 — close the LWS-CID loop (rescoped, sub-issue #443)\n\nThe original Phase 2 sketch overestimated what was missing. Most of the work was already in tree before #437: the LWS-CID verifier (`src/auth/lws-cid.js`), the `did:nostr:` resolver (`src/auth/did-nostr.js`), the well-known DID-doc publisher (`src/idp/well-known-did-nostr.js`), the profile generator's CID v1.0 `verificationMethod` slot (`src/webid/profile.js`), the pubkey extractor (`src/auth/nostr-keys.js`).\n\nThe actual Phase 2 gap is **two wires**:\n\n1. Inject the Phase 1 public key into the seeded WebID profile's `verificationMethod` array (so the LWS-CID verifier can find it when an agent signs a JWT with the on-disk secret).\n2. Flip the Phase 1 controller in `/private/privkey.jsonld` from WebID to `did:nostr:\u003cnpub>` (the resolver lands the round-trip).\n\nSee **#443** for the full plan, acceptance criteria, and tests.\n\n### Phase 3 — Backup and rotation\n\n- `--seed-phrase` flag generates keypair from BIP-39 mnemonic\n- `jss rotate-keys` command for replacing keys\n- Migration path for existing pods (re-key + update WebID + notify)\n\n### Phase 4 — Hardware and multi-device\n\n- Integration with hardware wallets (Ledger, NIP-46 signers)\n- Encrypted key storage at rest (passphrase-derived)\n- Multi-pod sync for users with multiple devices\n\n## Design decisions logged\n\n- **JSON-LD over TTL**: aligns with CID v1.0 REC, agentic-friendly, no RDF parser dependency, scores across every tool/audience axis\n- **Schnorr secp256k1**: shared curve with Nostr/Bitcoin, well-audited library, one key serves multiple ecosystems\n- **`/private/privkey.jsonld`** path: simple, ACL-protected by `/private/` standard, not nested in `/settings/keys/` (SolidOS convention), not at WebID-adjacent (that's for public key only)\n- **CID v1.0 Multikey format**: spec-correct property names (`publicKeyMultibase`, `secretKeyMultibase`); `nostr` extension block for ecosystem convenience without breaking spec conformance\n- **Owner-only ACL**: standard `/private/` container behaviour; verify or set explicitly during provisioning\n\n## Test plan\n\n- Unit tests in `test/keys/`\n- Integration test in `test/integration/provision-keys.test.js`\n- Manual verification:\n 1. `jss start --single-user --provision-keys --port 4444`\n 2. `curl -i http://localhost:4444/private/privkey.jsonld` → 401\n 3. Authenticated GET → returns valid CID v1.0 Multikey JSON-LD\n 4. Parse with `multibase` library → keys decode correctly\n 5. Test Schnorr signature using the secret key against a known message\n 6. Verify with the public key → signature valid\n\n## References\n\n- W3C Controlled Identifiers v1.0 (REC): https://www.w3.org/TR/cid-1.0/\n- did:nostr method: https://nostrcg.github.io/did-nostr/\n- @noble/curves (Schnorr secp256k1): https://github.com/paulmillr/noble-curves\n- NIP-19 (bech32 npub/nsec encoding): https://github.com/nostr-protocol/nips/blob/master/19.md\n- Multibase encoding: https://github.com/multiformats/multibase\n\n---\n\n## Design resolutions (pre-implementation)\n\nSix design questions answered before opening Phase 1 PR. Logged here so future PRs have a referent.\n\n### 1. Plaintext secret on disk\n\n**Decision: ship plaintext in Phase 1, document the risk loudly.**\n\nEven with owner-only WAC, anyone with filesystem access (root, backups, container layer dumps, snapshots) gets the key. Phase 4 promises encrypted-at-rest; Phase 1 ships the worst case.\n\nMitigations in scope for Phase 1:\n- The `BACK UP` warning expanded to include the threat model (filesystem reads bypass WAC).\n- `docs/provision-keys.md` includes a \"Protect this file\" section recommending FDE / LUKS / OS keyring / restrictive `umask`.\n- File written with `0600` mode (POSIX) so even other unix users on the box can't read it.\n\nOut of scope for Phase 1: a `--key-passphrase` flag wrapping the secret with scrypt+aesgcm. Coherent fit is alongside the seed-phrase work in Phase 3.\n\n### 2. Duplicate secret representation\n\n**Decision: drop `nostr.nsec`. Keep `nostr.npub`.**\n\n`secretKeyMultibase` and `nostr.nsec` would have been the same key in two formats — doubles the surface for log/error/dump leaks and makes \"rotate the key\" mean rewriting the same secret twice consistently. Bech32 encoding is a one-liner; document it. The public side `npub` next to `publicKeyMultibase` is harmless and convenient.\n\nThe `nostr` extension block becomes:\n```json\n\"nostr\": { \"npub\": \"npub1...\" }\n```\n\n### 3. Controller field\n\n**Decision: WebID in Phase 1, `did:nostr:` in Phase 2.**\n\nPhase 2 ships the `did:nostr:` resolver. Until then, a Multikey document with `controller: did:nostr:npub1...` references something nothing can resolve — strict CID consumers may choke. Phase 1 uses the pod owner's WebID as controller (e.g. `https://alice.example/profile/card.jsonld#me`); Phase 2 swaps to `did:nostr:` once the resolution mechanism exists. The key file is self-consistent at every phase.\n\n### 4. Path choice: `/private/privkey.jsonld` vs `/settings/keys/`\n\n**Decision: keep `/private/privkey.jsonld`.**\n\nDeviation from SolidOS's `/settings/keys/` convention is intentional. `/private/` is the obvious \"private namespace\" of a Solid pod and gets owner-only WAC by default in JSS-created pods. `/settings/` is conventionally for preferences and type indexes; layering keys on top of that mixes concerns. Documented here so future contributors don't \"fix\" it.\n\n### 5. Multi-user CLI\n\n**Decision: extend `POST /.pods` body with `provisionKeys: true`. No new CLI subcommand in Phase 1.**\n\nToday the multi-user pod-creation entry point is `POST /.pods` (HTTP). Adding a `jss create-pod` subcommand would mean a second pod-creation surface that has to stay in lockstep with the HTTP one. Cleaner to thread the flag through the existing surface:\n\n```bash\ncurl -X POST http://localhost:4444/.pods \\\n -H \"Content-Type: application/json\" \\\n -d '{ \"name\": \"alice\", \"provisionKeys\": true }'\n```\n\nSingle-user mode keeps the CLI flag (`jss start --single-user --provision-keys`) since there's no HTTP equivalent.\n\n### 6. Default vs opt-in\n\n**Decision: opt-in, explicitly.**\n\nKeys-on-disk is a real security tradeoff (see #1). Defaulting it on would make every `jss start --single-user` ship a plaintext secret to disk silently. Opt-in keeps it visible. Future PRs proposing \"let's default it on for ergonomics\" should re-open this design call — link back here.","author":{"url":"https://github.com/melvincarvalho","@type":"Person","name":"melvincarvalho"},"datePublished":"2026-05-14T07:11:31Z","url":"https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/issues/437"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:80e5e54c-b7f4-881a-e6e7-5f8c3f872f99 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E6C2:1AC597:29BF0FB:373BBE5:6B038BCC |
| html-safe-nonce | ede643d236f424fa9554f07ac7095080f0eac44f209e8d36db3178317964c8bc |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNkMyOjFBQzU5NzoyOUJGMEZCOjM3M0JCRTU6NkIwMzhCQ0MiLCJ2aXNpdG9yX2lkIjoiNjUyNzEyNDI2NzUzMDk0NzUzMyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 638c1c7bf1b3030f1cc45d860a8e8fd6d3fce1bd7a01c34706477efbfc883743 |
| hovercard-subject-tag | issue:4443982053 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/JavaScriptSolidServer/JavaScriptSolidServer/437/issue_layout |
| twitter:image | https://opengraph.githubassets.com/74092c836cbb9cec6d5571dda01f29b726e026667304dfdf4e8ada7a3725d090/JavaScriptSolidServer/JavaScriptSolidServer/issues/437 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/74092c836cbb9cec6d5571dda01f29b726e026667304dfdf4e8ada7a3725d090/JavaScriptSolidServer/JavaScriptSolidServer/issues/437 |
| og:image:alt | Summary Add a --provision-keys CLI flag for pod creation that generates a Schnorr secp256k1 keypair and writes it to /private/privkey.jsonld in W3C CID v1.0 Multikey format. The single key works as... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | melvincarvalho |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| go-import | github.com/JavaScriptSolidServer/JavaScriptSolidServer git https://github.com/JavaScriptSolidServer/JavaScriptSolidServer.git |
| octolytics-dimension-user_id | 205442424 |
| octolytics-dimension-user_login | JavaScriptSolidServer |
| octolytics-dimension-repository_id | 958025407 |
| octolytics-dimension-repository_nwo | JavaScriptSolidServer/JavaScriptSolidServer |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 958025407 |
| octolytics-dimension-repository_network_root_nwo | JavaScriptSolidServer/JavaScriptSolidServer |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width