feat(cli): jss install --nostr-privkey <hex> (Phase 4 of #464) - #483
Merged
Conversation
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
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.
Fixes #482. Phase 4 of the phased install plan — sign install pushes with NIP-98 instead of fetching a bearer token.
What
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 viasrc/auth/token.jsand hands adid:nostr:<hex>identity to the WAC checker.The git-multi-request wrinkle
git pushmakes two HTTP requests on the samehttp.extraHeader: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 whoseutag is a prefix of the request URL, and whosemethodtag 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.jsonldjss install chrome --nostr-privkey <hex>→ ✓ installed, 200 in browserNOSTR_PRIVKEY=<hex> jss install vellum→ env-var path worksDeps
Imports
nip98Tokenfromsrc/nostr/event.js(already in JSS, no new runtime deps).Not in scope
--did did:nostr:<hex>resolution (target by DID instead of--pod)--bundle <url-or-path>