Repository navigation
Description
Phase 4 of the phased install plan (#464 comment). Independent of Phase 3 (`--did`) — works against any `--pod ` target whose ACL grants the corresponding pubkey.
What
`jss install --nostr-privkey <64-hex>` signs each git push with NIP-98 (`Authorization: Nostr <b64(signed-event)>`) instead of fetching a bearer token from `/idp/credentials`. JSS already verifies the NIP-98 signature and returns a `did:nostr:` identity for ACL matching (`src/auth/token.js:182`).
```bash
jss install chrome --nostr-privkey 812616ff213392879da94c75c85c69494b3ba424f819115d866f0706edf8ce5d
```
Or via env (better — keeps the secret out of shell history):
```bash
NOSTR_PRIVKEY=812616... jss install chrome
```
ACL prereq
Target ACL must grant the corresponding pubkey:
```turtle
<#owner> a acl:Authorization;
acl:agent did:nostr:59427bb1...; # the schnorr pubkey of the privkey
acl:accessTo <./>;
acl:default <./>;
acl:mode acl:Read, acl:Write, acl:Control.
```
This is typically already true on a pod started with `--provision-keys`, since JSS seeds the owner ACL to grant the provisioned key. The user's own `/private/privkey.jsonld` is the natural source.
Scope
~30 LoC + one dep:
- `--nostr-privkey ` flag (and `NOSTR_PRIVKEY` env)
- Validate against `/^[0-9a-f]{64}$/i`
- `@noble/secp256k1` import for Schnorr signing (already a transitive dep of `src/keys/provision.js`)
- Build NIP-98 event (kind 27235, `u` + `method` tags, content empty)
- Schnorr-sign with the privkey, derive pubkey, base64-encode the signed event
- Inject `Authorization: Nostr ` via `git -c http.extraHeader=` instead of the Bearer header
When `--nostr-privkey` is set, skip the `/idp/credentials` token fetch entirely — the NIP-98 header is the auth.
Implementation notes
- Per-push event: a NIP-98 event signs ONE specific (URL, method) pair. The `u` tag must match the push URL and the `method` tag must be `POST` (git-receive-pack uses POST). One event per push call — for the dual `HEAD:main` + `HEAD:gh-pages` push, two signed events.
- Event timestamp (`created_at`) must be recent — JSS likely accepts a window of a few minutes; cryptographically signed, so replay-mitigation is mostly handled.
Acceptance criteria
```bash
Start a pod with provision-keys ON
jss start --provision-keys &
Note the provisioned privkey at /private/privkey.jsonld
PRIVKEY=$(jq -r .secretKeyMultibase pod-data/private/privkey.jsonld | sed 's/^f8126//')
Install using NIP-98 auth — no password needed
jss install chrome --nostr-privkey $PRIVKEY
→ ✓ chrome → http://localhost:4443/public/apps/chrome/
```
Test plan
- `jss install chrome --nostr-privkey ` against an ACL that grants the corresponding did:nostr → installs successfully
- `jss install chrome --nostr-privkey ` against an ACL that does NOT grant the pubkey → 401/403, exit 1
- `jss install chrome --nostr-privkey ` (not 64 hex chars) → validation error, exit 1
- `NOSTR_PRIVKEY= jss install chrome` works the same as the flag
- Both flag and `--password` set → error (mutually exclusive) or `--nostr-privkey` wins (document either way)
Parent
#464 (phased plan in the comment thread)
Related
- #4 — did:nostr SSO + Schnorr (umbrella for Nostr identity in JSS)
- jspod#1 — multi-device LAN problem this fixes downstream (Nostr-keyed install works regardless of pod hostname)
Activity
feat(cli): \`jss install --nostr-privkey <hex>\` (#482, Phase 4 of #464…