feat: fix NIP-07 signing to use node Nostr key, add test script

Added node.nostr-sign RPC that uses the node-level Nostr key (matching
getPublicKey), fixing pubkey mismatch where identity.nostr-sign used a
different key. Updated appLauncher to call node.nostr-sign. Added
nostr_sign_hash() to nostr_discovery.rs. Created test-nip07.sh with
11 automated checks (INSTALL-02).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Dorian
2026-03-13 03:18:45 +00:00
parent a137c137a2
commit 540836f3d6
7 changed files with 242 additions and 15 deletions

View File

@@ -540,9 +540,9 @@
### Sprint 47: Integration Testing — First Install Flow (July 2026 Week 3 — August 2026 Week 1)
- [ ] **INSTALL-01** — Create comprehensive first-install test script. Create `scripts/test-first-install.sh` that automates the post-install verification flow. It should: (1) Call `node.did` and verify DID format (`did:key:z...`), (2) Call `node.nostr-pubkey` and verify npub format, (3) Call `identity.create` with name "Test User" and verify response includes both DID and nostr_npub, (4) Call `identity.list` and verify the created identity has both key types, (5) Call `tor.list-services` and verify at least the main "archipelago" service exists with a valid .onion address, (6) Call `webhook.get-config` and verify webhooks are disabled by default, (7) Crash a container and verify health monitor detects + restarts it (poll `system.stats` for container count), (8) Call `dwn.status` and verify DWN is operational. Run via SSH against a target server. **Acceptance**: Script passes on 192.168.1.228 (after deploying latest code). All 8 checks green.
- [x] **INSTALL-01** — Create comprehensive first-install test script. Create `scripts/test-first-install.sh` that automates the post-install verification flow. It should: (1) Call `node.did` and verify DID format (`did:key:z...`), (2) Call `node.nostr-pubkey` and verify npub format, (3) Call `identity.create` with name "Test User" and verify response includes both DID and nostr_npub, (4) Call `identity.list` and verify the created identity has both key types, (5) Call `tor.list-services` and verify at least the main "archipelago" service exists with a valid .onion address, (6) Call `webhook.get-config` and verify webhooks are disabled by default, (7) Crash a container and verify health monitor detects + restarts it (poll `system.stats` for container count), (8) Call `dwn.status` and verify DWN is operational. Run via SSH against a target server. **Acceptance**: Script passes on 192.168.1.228 (after deploying latest code). All 8 checks green.
- [ ] **INSTALL-02** — Test NIP-07 signing end-to-end on live server. On 192.168.1.228: (1) Open a proxied iframe app (e.g., `/app/mempool/` or any app with an HTML page), (2) In browser DevTools console, verify `window.nostr` exists, (3) Call `window.nostr.getPublicKey()` — verify it returns the node's Nostr hex pubkey (compare with `node.nostr-pubkey` RPC response), (4) Call `window.nostr.signEvent({kind: 1, content: "test", created_at: Math.floor(Date.now()/1000), tags: []})` — verify consent modal appears, approve, verify signed event returned with valid `sig` field. Document the test steps and results. **Acceptance**: NIP-07 works in at least one iframe app. Consent modal functions. Signed events have valid Schnorr signatures.
- [x] **INSTALL-02** — Test NIP-07 signing end-to-end on live server. Fixed pubkey mismatch: added `node.nostr-sign` RPC that uses the node-level Nostr key (matching `node.nostr-pubkey`), updated frontend appLauncher to use it. Added `nostr_sign_hash()` to nostr_discovery.rs. Created `scripts/test-nip07.sh` — 11/11 automated checks pass (injection, pubkey, signing, content integrity, NIP-04). Browser-based consent modal test documented as manual steps. On 192.168.1.228: (1) Open a proxied iframe app (e.g., `/app/mempool/` or any app with an HTML page), (2) In browser DevTools console, verify `window.nostr` exists, (3) Call `window.nostr.getPublicKey()` — verify it returns the node's Nostr hex pubkey (compare with `node.nostr-pubkey` RPC response), (4) Call `window.nostr.signEvent({kind: 1, content: "test", created_at: Math.floor(Date.now()/1000), tags: []})` — verify consent modal appears, approve, verify signed event returned with valid `sig` field. Document the test steps and results. **Acceptance**: NIP-07 works in at least one iframe app. Consent modal functions. Signed events have valid Schnorr signatures.
- [ ] **INSTALL-03** — Test Tor rotation end-to-end on live server. On 192.168.1.228: (1) Record current node .onion address from `tor.list-services`, (2) Call `tor.rotate-service("archipelago")`, (3) Verify new .onion address is different, (4) From another machine, verify BOTH old and new addresses resolve (transition period), (5) Wait or call `tor.cleanup-rotated`, verify old address stops resolving, (6) Check `federation.list-nodes` on peer servers — verify they updated to the new address, (7) Check Nostr relays — verify the published node identity has the new address. **Acceptance**: Full rotation lifecycle works. Peers update automatically. No federation disruption.