- NIP-46 remote signer in the page (bunker:// and nostrconnect:// pairing) - Chrome extension (NIP-07) with per-site permission prompts, unlocked by the site via externally_connectable; downloadable from the page - Passkey (WebAuthn PRF) encryption of the Drive key file - NIP-49 backups: download or save to Drive; reveal nsec - Fix: oldest key file wins when two devices sign up at once - Fix: never overwrite an existing kind-0 because a relay was slow - Fix: EOSE tracking; relays reconnect with backoff; verify event signatures - One-click re-sign-in (consent only the first time) - Vendored, pinned nostr-tools; CSP; no third-party scripts but Google's Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
13 lines
520 B
JavaScript
13 lines
520 B
JavaScript
// Bridge between the page (provider.js) and the background worker.
|
|
window.addEventListener("message", async (e) => {
|
|
if (e.source !== window || e.data?.__goostr !== "req") return;
|
|
const { id, method, params } = e.data;
|
|
let reply;
|
|
try {
|
|
reply = await chrome.runtime.sendMessage({ type: "nip07", method, params });
|
|
} catch (err) {
|
|
reply = { error: String(err?.message || err) };
|
|
}
|
|
window.postMessage({ __goostr: "res", id, ...(reply || { error: "No response from Goostr" }) }, location.origin);
|
|
});
|