From 39067a27e0ce24386aa6f08c78e9a916e1c8a202 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Sat, 1 Aug 2026 22:38:43 -0700 Subject: Never spin on a claim that can only fail MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After a reload the extension signer is gone, so claiming the user's real npub name was signed by the wallet key — which the anti-squatting rule rightly refuses, and the retry loop then span forever. An installed extension is now silently re-attached when possible (keeping the address tied to the real identity across reloads), refusals are treated as permanent rather than retried, and anything unresumable falls back to the wallet's own npub so an address always appears. Co-Authored-By: Claude Fable 5 --- src/features/nostrlogin.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/features/nostrlogin.js') diff --git a/src/features/nostrlogin.js b/src/features/nostrlogin.js index c5369e9..cea13b4 100644 --- a/src/features/nostrlogin.js +++ b/src/features/nostrlogin.js @@ -176,6 +176,21 @@ export function nostrLoginFeature(ctx) { if (!st.pubkey) return null; return { pubkey: st.pubkey, npub: npubOf(st.pubkey), signer: live }; }, + // A page reload loses the signer. An installed extension can usually be + // re-attached without prompting, which is what lets the payment address + // stay tied to the user's real identity across reloads. Returns null for + // signers we cannot silently reattach (pasted keys, bunkers). + async nostrLoginResume() { + if (live) return live; + const st = load(); + if (!st.pubkey || typeof window === 'undefined' || !window.nostr) return null; + try { + const s = await extensionSigner(); + if (s.pubkey !== st.pubkey) return null; + live = s; + return s; + } catch { return null; } + }, unlockExtra() { return unlockExtra(); }, settingsCards() { return [settingsCard()]; }, }; -- cgit v1.2.3