Skip to content

feat(cli): jss install --nostr-privkey <hex> (Phase 4 of #464) - #483

Merged
melvincarvalho merged 1 commit into
gh-pagesfrom
issue-482-install-nostr-privkey
May 18, 2026
Merged

feat(cli): jss install --nostr-privkey <hex> (Phase 4 of #464)#483
melvincarvalho merged 1 commit into
gh-pagesfrom
issue-482-install-nostr-privkey

Conversation

@melvincarvalho

Copy link
Copy Markdown
Contributor

Fixes #482. Phase 4 of the phased install plan — sign install pushes with NIP-98 instead of fetching a bearer token.

What

jss install chrome --nostr-privkey 5e1f17...2743
NOSTR_PRIVKEY=5e1f17...2743 jss install chrome

When the flag (or env) is set, the bearer-token fetch is skipped entirely — the NIP-98 Authorization: Nostr <b64> header is the auth. JSS verifies via src/auth/token.js and hands a did:nostr:<hex> identity to the WAC checker.

The git-multi-request wrinkle

git push makes two HTTP requests on the same http.extraHeader:

GET  <dest>/info/refs?service=git-receive-pack   (advertise)
POST <dest>/git-receive-pack                     (receive)

NIP-98 events sign one URL+method tuple. JSS is lenient for git clients (src/auth/nostr.js:226): it accepts a NIP-98 event whose u tag is a prefix of the request URL, and whose method tag is * as a wildcard. We sign the base <dest> URL with method * so one event covers both the advertise GET and the receive POST.

Verified end-to-end

  • jss start --provision-keys → seeds owner key at /private/privkey.jsonld
  • jss install chrome --nostr-privkey <hex> → ✓ installed, 200 in browser
  • NOSTR_PRIVKEY=<hex> jss install vellum → env-var path works
  • bad privkey (pubkey not in ACL) → ✗ push failed, exit 1
  • malformed privkey (not 64 hex) → validation error, exit 1

Deps

Imports nip98Token from src/nostr/event.js (already in JSS, no new runtime deps).

Not in scope

  • Phase 3: --did did:nostr:<hex> resolution (target by DID instead of --pod)
  • Phase 5: curated default set
  • Phase 6: --bundle <url-or-path>

Sign install pushes with NIP-98 instead of fetching a bearer token
from the IDP. Pairs naturally with --provision-keys: the privkey
JSS provisions at <pod>/private/privkey.jsonld is the natural source.

  jss install chrome --nostr-privkey 5e1f17...2743
  NOSTR_PRIVKEY=5e1f17...2743 jss install chrome

When the flag (or env) is set, the bearer-token fetch is skipped —
the NIP-98 header IS the auth. JSS verifies the Schnorr signature
in src/auth/token.js and hands a did:nostr:<hex> identity to the
WAC checker.

## The git-multi-request wrinkle

git push makes two HTTP requests on the same http.extraHeader:
  GET <dest>/info/refs?service=git-receive-pack   (advertise)
  POST <dest>/git-receive-pack                    (receive)

NIP-98 events sign one URL+method tuple. JSS is lenient for git
clients (src/auth/nostr.js): it accepts a NIP-98 event whose \`u\`
tag is a *prefix* of the request URL, and whose \`method\` tag is
\`*\` as a wildcard. We sign \`<dest>\` (the base URL, no
/git-receive-pack suffix) with method '*' so one event covers both
the advertise GET and the receive POST.

## Verified end-to-end

- jss start --provision-keys → owner key seeded at /private/privkey.jsonld
- jss install chrome --nostr-privkey <hex> → ✓ installed, 200 in browser
- NOSTR_PRIVKEY=<hex> jss install vellum → env-var path works
- bad privkey (wrong pubkey not in ACL) → ✗ push failed, exit 1
- malformed privkey (not 64 hex) → ✗ validation error, exit 1

## Dep note

Imports nip98Token from src/nostr/event.js (already in JSS).
No new runtime dependencies.

Fixes #482
@melvincarvalho
melvincarvalho merged commit 4813ac0 into gh-pages May 18, 2026
1 check passed
@melvincarvalho
melvincarvalho deleted the issue-482-install-nostr-privkey branch May 18, 2026 04:31
melvincarvalho added a commit that referenced this pull request May 18, 2026
Includes since 0.0.197:
- jss install <name>            (#479, Phase 1 of #464)
- jss install generalized spec  (#481, Phase 2 of #464)
- jss install --nostr-privkey   (#483, Phase 4 of #464)
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.

jss install --nostr-privkey <hex> — NIP-98 signed install (Phase 4 of #464)

1 participant