From 69997b1cf47470bbe098ca042b5b64ef5e8873e6 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Thu, 19 Nov 2026 21:53:03 -0700 Subject: A browser extension that signs for nostr sites without asking twice, and pays from a Coinos wallet. "I'm using Sidecar right now, and I don't like how I have to reauthorize it. It prompts me too much. I just want it to automatically sign all the time with my key" (Adam, 2026-11-19). The extension (extension/, Chrome, Manifest V3) gives every page window.nostr (NIP-07: getPublicKey, signEvent, nip04, nip44) and window.webln. A site is asked once: "Always allow" is remembered with no expiry until the site is removed in the popup, "Never for this site" blocks it, and closing the window refuses that one call. Signing and paying are separate permissions. The key is an nsec or a wallet's twelve words (NIP-06), kept in the extension's storage unencrypted so it can sign without a prompt. The wallet is the person's own Coinos wallet over Nostr Wallet Connect: the extension holds a connection string, the wallet enforces that connection's budget, and the popup shows the balance and recent payments. Build with `bun extension/build.js` and load extension/dist unpacked. New extension-test loads the built extension into Chrome with its own relay and wallet service and passes (28 checks). Co-Authored-By: Claude Fable 5.2 Claude-Session: https://claude.ai/code/session_01VMan6WFVA5qCuTtny8PRL6 --- extension/src/prompt.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 extension/src/prompt.js (limited to 'extension/src/prompt.js') diff --git a/extension/src/prompt.js b/extension/src/prompt.js new file mode 100644 index 0000000..6637f70 --- /dev/null +++ b/extension/src/prompt.js @@ -0,0 +1,20 @@ +// The one question a site ever gets asked: may it use the key (or the +// wallet)? "Always allow" is remembered; the site is not asked again. +const q = new URLSearchParams(location.search); +const origin = q.get('origin') || ''; +const kind = q.get('kind') === 'pay' ? 'pay' : 'sign'; +const $ = (id) => document.getElementById(id); +$('origin').textContent = origin.replace(/^https:\/\//, ''); +$('what').textContent = kind === 'pay' ? 'Let this site use your wallet?' : 'Let this site use your nostr key?'; +$('detail').textContent = kind === 'pay' + ? 'It will be able to see your balance, create invoices and send payments without asking, within the limit you set on the wallet connection.' + : 'It will be able to see your public key, sign as you and read your private messages, without asking again.'; +const answer = async (choice) => { + for (const b of document.querySelectorAll('button')) b.disabled = true; + await chrome.runtime.sendMessage({ type: 'answer', id: q.get('id'), origin, kind, choice }); + window.close(); +}; +$('allow').onclick = () => answer('always'); +$('deny').onclick = () => answer('deny'); +$('never').onclick = () => answer('never'); +$('allow').focus(); -- cgit v1.2.3