# nostr-shard-signer > Drop-in NIP-07 signer for web apps. One ` ``` ## Rules - Load `nostr-bridge.js` with a plain `` (also `data-nostr-only`, `data-layout`, `data-button-size`, `data-mount-selector`, `data-bunker-origin`, `data-force-iframe`, `data-powered-by`). Any of these attributes starts init. - All options are optional. Leave out `bunkerOrigin` unless you self-host the signer. - Without `clientId` (shared sign-in): Google/Apple/X works on any site with no setup (Web3Auth's panel in the widget; account screens such as Welcome back, linking or backup open a small window on the signer's origin; `login()` opens the widget's sign-in), through the hosted signer's own Web3Auth project, and a user gets the same npub on every site using it. It is free while donations cover it and may later be limited per site or become paid; moving a live site to its own `clientId` then gives its OAuth users new npubs. Whoever runs the hosted signer can obtain shared-mode users' keys. The console says (info) that the page uses it. Prefer it for prototypes and small apps; suggest an own `clientId` when the app needs its own keys or predictable costs. `nostrOnly: true` turns Google/Apple/X off (extension and bunker only). - With your own `clientId`, the Web3Auth project's Allowlist URLs (Web3Auth dashboard → Project Settings → Domains) must list `https://signer.shardsigner.com`, and the page's exact origin must be registered in the portal (https://saintego.github.io/nostr-shard-signer/portal/), which only accepts origins that are also in that allowlist. An origin in only one of the two still works, with a console warning (`NOT_IN_REGISTRY` / `NOT_ALLOWLISTED`). localhost can't be registered in the portal but works when it is in the allowlist. - The user signs in with the widget's "Sign in" button (bottom-right by default), or an app button calling `NostrBridge.login()`. `window.nostr` calls reject with "nostr-bridge: user is not logged in" until then; don't rely on them to open a login prompt. Use `NostrBridge.onAuthChange` (or the `nostr-bridge:auth` window event) instead of polling. - Legacy: auth and error events are also `message` events on `window` with `event.origin === ""`. If you listen to those, check the origin. - The bridge signs and encrypts only. Publishing to relays is the app's job (e.g. nostr-tools `SimplePool`). - With shared sign-in a user may have several identities on one site and switch between them in the widget: `onAuthChange` then fires with the new `pubkey`. Don't cache the pubkey beyond that, and leave `pubkey` out of `signEvent` (one for another identity is refused). - With your own `clientId`, the widget shows Sign up and Sign in; users choose an account only for your site or their global account (`globalLogin: "offer" | "off" | "require"`). Don't build your own chooser around it. - Pubkeys are hex, not npub. Convert with nostr-tools `nip19` if needed. - Never ask for or handle the user's nsec. - Google/Apple/X keys are scoped to the Web3Auth project: the same account gets a different npub under another `clientId` (shared sign-in is one more project), and Google, Apple and X give different keys. Never suggest changing the `clientId` of a live app, adding one to a live app that used shared sign-in, or removing it; OAuth users would get new, empty identities. Users can export their nsec from the widget's profile menu (with shared sign-in, "Export key" opens the signer's window). The `clientId` owner can obtain OAuth users' keys (they control which sites may use the project); don't claim otherwise. - Setup problems appear as `SIGNER_ERROR` events and as console errors with a fix hint; non-fatal ones as console warnings. - A user can choose their own signer in the widget ("Use my own signer"): the bridge then frames it instead of `bunkerOrigin`, without your `clientId`. Nothing to do in your code. - In Safari and every browser on iPhone/iPad, users are signed out of a site when the browser quits (it deletes the widget's data); they sign in again and get the same identities (the widget offers "Continue with Google", from the provider the bridge remembers in `localStorage` `nostr-bridge:provider`). Don't treat that as a lost account. - Self-hosting: one click on Vercel (README, "Self-host the signer on Vercel"), then pass `bunkerOrigin` and load `nostr-bridge.js` from your signer. ## Docs - [Full reference for agents](https://saintego.github.io/nostr-shard-signer/llms-full.txt): all options, events, error codes and troubleshooting in one file - [npm package](https://www.npmjs.com/package/nostr-shard-signer): `loadNostrBridge()` plus types for `NostrBridge` (and `/// ` for `window.nostr`, if no other library types it) - [TypeScript declarations](https://raw.githubusercontent.com/saintego/nostr-shard-signer/main/nostr-bridge.d.ts): the same types as standalone files, for pages without npm - [Minimal example](https://saintego.github.io/nostr-shard-signer/examples/minimal.html): sign in, show pubkey, publish a note - [README](https://github.com/saintego/nostr-shard-signer#readme): architecture, security model, self-hosting ## Optional - [Developer portal](https://saintego.github.io/nostr-shard-signer/portal/): register a clientId and its domains - [Specification](https://github.com/saintego/nostr-shard-signer/blob/main/SPECIFICATION.md)