aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-08-01 23:08:02 -0700
committerAdam Soltys <[email protected]>2026-08-01 23:08:02 -0700
commitbabac497c1f44892b646b30be4d3ad035b461386 (patch)
tree2ce0adabbdc625edfd5086de35e041af9fbfb5ba /src
parent83ad00a39863bb6a61e15977202fe2feea2ca696 (diff)
downloadcoinosv3-babac497c1f44892b646b30be4d3ad035b461386.tar.gz
coinosv3-babac497c1f44892b646b30be4d3ad035b461386.zip
Fix bunker (NIP-46) login: the pointer goes through fromBunker
nostr-tools' BunkerSigner constructor takes (clientSecretKey, params) — passing the bunker pointer as the second argument left the signer with no pointer at all, so connecting died on "reading 'pubkey'" before any network call. Use the static fromBunker, and reject an address that lists no relays with something a human can act on. Covered by a test using a real Amethyst-issued address. Co-Authored-By: Claude Fable 5 <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/nostr-login.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/nostr-login.js b/src/nostr-login.js
index 00106c4..7addfc5 100644
--- a/src/nostr-login.js
+++ b/src/nostr-login.js
@@ -90,8 +90,11 @@ export async function extensionSigner() {
export async function bunkerSigner(uri, { onAuth } = {}) {
const bp = await parseBunkerInput(String(uri || '').trim());
if (!bp) throw new Error('not a bunker:// address');
+ if (!bp.relays || !bp.relays.length) throw new Error('that bunker address lists no relays');
const local = generateSecretKey();
- const signer = new BunkerSigner(local, bp, {
+ // NB the pointer goes through fromBunker — the constructor takes params
+ // only, and passing the pointer there leaves the signer without one.
+ const signer = BunkerSigner.fromBunker(local, bp, {
onauth: (url) => { if (onAuth) onAuth(url); else if (typeof window !== 'undefined') window.open(url, '_blank'); },
});
await signer.connect();