diff options
| author | Adam Soltys <[email protected]> | 2026-08-01 09:25:23 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-08-01 09:25:23 -0700 |
| commit | e09b76ea0ed13840426a56f031769f8d4154f34b (patch) | |
| tree | 8a1bdad05d4ab65f795673ba96c532abc0fd5944 /src/features/index.js | |
| parent | 4f7cfb911a12c2447a9cd18a83f0e806912db964 (diff) | |
| download | coinosv3-e09b76ea0ed13840426a56f031769f8d4154f34b.tar.gz coinosv3-e09b76ea0ed13840426a56f031769f8d4154f34b.zip | |
Add Nostr Wallet Connect (NIP-47) — hal as a wallet service
Other apps can connect over nostr and pay from this wallet without touching
its keys, within a per-payment and daily budget the user sets, revocable at
any time. hal holds no native Lightning balance, so every operation runs over
Ark: pay_invoice takes the swap bridge when configured and falls back to the
ASP's lightning-send, make_invoice mints on the ASP. NWC availability
therefore tracks Ark availability.
- kinds 13194/23194/23195, nip44_v2 and nip04, replying in whichever scheme
the request used; every request gets a reply so clients never hang
- each connection gets its own service keypair, so revoking one can't affect
the others and none is tied to the user's nostr identity
- budgets are checked BEFORE spending, not reconciled after
- requests are ignored unless signed by that connection's client key, and
replayed/stale events (>120s) can't re-trigger a payment
- Settings card to create, show (URI + QR) and revoke connections, and it
says plainly that this only works while a tab is open
tools/nwc-test.js drives it as a real client: both encryption schemes, budget
refusal with a genuine over-limit invoice, unsupported-method errors, and a
request from an unauthorized key being ignored.
Co-Authored-By: Claude Fable 5 <[email protected]>
Diffstat (limited to 'src/features/index.js')
| -rw-r--r-- | src/features/index.js | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/features/index.js b/src/features/index.js index e52b172..06d8d4d 100644 --- a/src/features/index.js +++ b/src/features/index.js @@ -10,11 +10,12 @@ import { arkFeature } from './ark.js'; import { zapsFeature } from './zaps.js'; import { spFeature } from './sp.js'; import { syncFeature } from './sync.js'; +import { nwcFeature } from './nwc.js'; // NB order is meaningful where hooks stack: gifts' receive takeover and // balance line come before ark's, matching the pre-plugin layout. zaps sits // after ark so an npub prefers an instant Ark zap and only falls through to a // Lightning zap when Ark can't serve it. export function buildFeatures(ctx) { - return [giftsFeature(ctx), swapsFeature(ctx), arkFeature(ctx), zapsFeature(ctx), spFeature(ctx), syncFeature(ctx)]; + return [giftsFeature(ctx), swapsFeature(ctx), arkFeature(ctx), zapsFeature(ctx), spFeature(ctx), nwcFeature(ctx), syncFeature(ctx)]; } |
