From 4757b1bf8e9c449368c132e05ba9be20ef0c28cd Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Sat, 1 Aug 2026 11:16:56 -0700 Subject: Add the NWC push notifier (step 1 of background wallet-connect) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A service worker cannot hold a relay socket open, so something must tell a closed browser "a request arrived". This watches the relays for NIP-47 requests addressed to the wallet-service pubkeys a device registers, and sends that device a Web Push. The service worker will do the actual work in the browser; keys never leave it. Scoped to leak as little as possible: the notifier learns the service pubkeys registered and the timing of requests to them, and nothing else. Request contents are encrypted to keys it doesn't hold, it never sees the wallet seed, and it cannot move funds — the worst it can do is fail to wake a device. No database or accounts: registrations live in one JSON file, expire if a device stops refreshing, and push endpoints that return 404/410 are dropped. Wake-ups are de-duplicated across relays and only fire for live traffic, so a replayed old request can't wake anyone. Co-Authored-By: Claude Fable 5 --- nwcpush/config.example.json | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 nwcpush/config.example.json (limited to 'nwcpush/config.example.json') diff --git a/nwcpush/config.example.json b/nwcpush/config.example.json new file mode 100644 index 0000000..6b1abd8 --- /dev/null +++ b/nwcpush/config.example.json @@ -0,0 +1,8 @@ +{ + "port": 8797, + "relays": ["wss://relay.coinos.io", "wss://relay.damus.io", "wss://nos.lol"], + "vapid": { "subject": "mailto:you@example.com", "publicKey": "REPLACE", "privateKey": "REPLACE" }, + "stateFile": "./data/registrations.json", + "maxPubkeysPerDevice": 20, + "staleDays": 30 +} -- cgit v1.2.3