aboutsummaryrefslogtreecommitdiffstats
path: root/src/sw-nwc.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-08-01 20:46:12 -0700
committerAdam Soltys <[email protected]>2026-08-01 20:46:12 -0700
commited1d996f9dbd6cedc18ec293daba0cfcd745ae2b (patch)
tree6d552796e899314d402dc92f6f80886405e296b5 /src/sw-nwc.js
parent5986cbf5337593eb11fd984d284bd41da7719a87 (diff)
downloadcoinosv3-ed1d996f9dbd6cedc18ec293daba0cfcd745ae2b.tar.gz
coinosv3-ed1d996f9dbd6cedc18ec293daba0cfcd745ae2b.zip
Zappable offer codes and per-name Lightning offers
CLINK offers (noffer): every wallet gets a static offer keypair (synced across devices, first-minted wins) answering kind-21001 invoice requests — from open tabs and from the service worker while closed, which mints against the mirrored state (the record now carries chain-4 and chain-5 key windows) and raises an open-to-receive notification. Zap requests ride along and their kind-9735 receipts publish once the payment is claimed. The code is shown in the payment-address card for pasting into a Nostr profile; the notifier watches and relays kind 21001 alongside NWC. Payment names also gain a Lightning offer: the registrar creates a BOLT 12 offer per name on the node and appends lno= to the DNS record; a settle-forwarder pushes each received payment on to the name's ark destination from a small float wallet (custody window: seconds between Lightning settle and the ark send). Name resolution now runs full client-side DNSSEC validation (src/dnssec.js): binary DoH, root-anchor chain walk, RSA + ECDSA via WebCrypto — the resolver is untrusted transport, verified against live signed zones including the canonical BIP-353 test name. Co-Authored-By: Claude Fable 5 <[email protected]>
Diffstat (limited to 'src/sw-nwc.js')
-rw-r--r--src/sw-nwc.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/sw-nwc.js b/src/sw-nwc.js
index 8267b6b..968be91 100644
--- a/src/sw-nwc.js
+++ b/src/sw-nwc.js
@@ -29,6 +29,17 @@ self.addEventListener('push', (e) => {
} catch (err) {
console.warn('[sw-nwc] auto-answer failed:', err && err.message);
}
+ // handled-with-a-heads-up: e.g. an invoice was minted while closed and
+ // the user should open Hal to complete the receive
+ if (handled && handled.notify) {
+ await self.registration.showNotification(handled.notify.title, {
+ body: handled.notify.body,
+ icon: 'icon-192.png', badge: 'icon-192.png',
+ tag: 'nwc-incoming', renotify: true,
+ data: { url: './' },
+ });
+ return;
+ }
if (handled) return;
await self.registration.showNotification('Payment request', {
body: 'An app is asking your wallet to pay. Open Hal to approve.',