Skip to content

Security model ​

ThreatMitigation
Parent page JS reading your nsecKey lives only in a cross-origin iframe; Same-Origin Policy makes it unreachable
Owner of the clientId obtaining users' keysNot prevented. The owner controls the Web3Auth project's allowlist, so they can run Web3Auth on a page of their own and get the key of any user who signs in there (true of every Web3Auth embedded wallet). Users trust the app owner with the identity they create in that app; users who don't sign in with their own extension or bunker
Browser extension / XSS on parent pageSame isolation — the iframe context is physically separate
Domain spoofing to steal Web3Auth quotaThe page origin must be in the NIP-33 registry on Nostr or in the clientId's Web3Auth allowlist (only its owner can edit it); the registrar only registers allowlisted origins. The registry's root key is built into the signer, so a page can't point the signer at a registry it signed itself. Shared sign-in is open to every site by design
A site obtaining shared-mode users' keysThe shared project's Web3Auth allowlist lists only the signer's origin, so no site can run Web3Auth with its clientId. If someone adds a site there, the signer pauses new shared sign-ins and a check every 6 hours alerts the operator (Watching the shared project)
Rogue iframe injected by attackerevent.source === window.parent check + _parentOrigin derived from document.ancestorOrigins (not URL params)
Host page hiding or covering a prompt (clickjacking)Approve, Allow, Unlock and reveal-key buttons react only 0.7 s after they appear, after the iframe is resized, or after the tab becomes visible again; in Chromium, also only while the browser vouches that nothing covers or hides them. In shared sign-in, where any site may embed the signer, decrypts, profile, follow-list and relay-list replacements, deletions, Evolustr app keys and key export are shown in a popup on the signer's own origin, which no page can frame or style (two clicks). Moving the iframe under the cursor without resizing it isn't detected in the iframe itself
A third site framing the appThe signer refuses to run when the page that embeds it is itself inside a frame (NESTED_FRAME): only the direct parent's origin is known
null-origin postMessage attacksAll window.addEventListener("message") handlers reject event.origin === "null" unconditionally

Production Hardening Checklist ​

One-time setup

  • [ ] Set the repository variable ROOT_PUBKEY_HEX (and optionally REGISTRY_RELAYS)
  • [ ] Run wrangler secret put ROOT_PRIVATE_KEY_HEX — never commit the private key
  • [ ] Create both KV namespaces (REGISTRY_KV, CHALLENGES_KV) and update wrangler.toml IDs
  • [ ] Add CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID as GitHub repository secrets
  • [ ] Enable GitHub Pages (Settings → Pages → Source: GitHub Actions)
  • [ ] Update registrarUrl (and portalClientId) in site-config.js
  • [ ] Shared sign-in: set VITE_SHARED_CLIENT_ID to a Web3Auth project of your own whose allowlist lists only your signer's origin (SHARED_CLIENT_ID in bunker/src/lib/shared.ts is the hosted signer's, used only on its origins), or leave it empty for none; list that origin in scripts/sharedProjectExpected.json (production)

After first deploy

  • [ ] Pass bunkerOrigin (your signer's origin) to NostrBridge.init() — otherwise the hosted signer is used
  • [ ] Add SRI hashes to CDN <script> tags in signer.html
  • [ ] Restrict Access-Control-Allow-Origin in registrar-worker.js to your admin origins
  • [ ] Configure REGISTRY_RELAYS in signer.html to relays you control or trust
  • [ ] Set up Cloudflare Rate Limiting rules on the registrar endpoints
  • [ ] Configure your Web3Auth dashboard verifiers to match your clientId

MIT licensed. The signer runs at signer.shardsigner.com; this site never holds keys.