User clicks "Login with Nostr"
The button checks if a Nostr key manager (like NostrKey) is installed in the browser.
Add passwordless authentication to your website in 2 lines of code. No emails, no passwords, no OAuth providers. Users own their identity.
One script tag. Loads from the CDN, self-initializes.
The script is small and does one job. These are the same habits you would use for any code that touches login.
login.js is one file of about 8 KB with no dependencies. Download it or fork it on GitHub, read it, and host it on your own domain. Then nothing on your site changes unless you change it.https://nostrkey.com only if you use the hosted copy. Fewer script sources means fewer ways for someone else's code to run on your login page.nostr:login event tells your page who clicked. It is not proof, because any script on the page can fire it. Before you create a session, verify a NIP-98 signature on your server, as shown under Events. Ready-made server code for Node and Python is in the repo.Drop a div anywhere on your page. The script renders the button.
When the user authenticates, you get their public key. That's their identity.
If you have NostrKey installed, click the button below.
Your bot deserves its own identity and wallet. NostrKey gives it cryptographic identity. NostrWalletConnect gives it Lightning wallet access. Both are plain Python libraries with no agent-framework dependency. Add them however your platform adds skills.
A bunker URL routes signing requests through a relay so your private key never leaves your device. Use it when direct key access isn't ideal.
| Scenario | NIP-07 (direct) |
Bunker URL (NIP-46) |
|---|---|---|
| Your own browser, trusted site | Yes | Either |
| Shared or public computer | No | Yes |
| Site you're trying for the first time | Maybe | Yes |
| Automated or long-running session | No | Yes |
| Mobile browser without extension support | No | Yes |
The button runs in the browser and talks directly to the user's key manager. Your server only needs to check a signature: no accounts table of passwords, no OAuth provider.
Users authenticate with cryptographic keys. Nothing to leak, nothing to reset, nothing to brute force.
Nostr identities are portable. Users aren't locked to your platform or any single provider. Open protocol.
The same identity works on every Nostr-enabled site. Users log in once with their key manager, use it everywhere.
No email required. No tracking cookies. No third-party OAuth. The user's public key is all you need.
Desktop (Chrome, Safari, Firefox). Mobile (iOS, Android). The button adapts and guides users to install if needed.
The button checks if a Nostr key manager (like NostrKey) is installed in the browser.
If installed, the key manager provides the user's public key. If not, the user is guided to install one. No friction either way.
A nostr:login event fires with the user's public key. Store it, use it as a user ID, look up their profile. It's a permanent, cryptographic identity.
No password to store and no OAuth token to refresh. You still set your own session length, and you can ask for a fresh signature whenever it matters. The private key never leaves the user's device.
Customize the button appearance and behavior.
Listen for authentication state changes.
Nostr is an open protocol for decentralized identity and communication. Think of it as a universal login system where users own their identity through cryptographic keys. No company controls it.
A Nostr key manager like NostrKey (browser extension or mobile app). If they don't have one, the button guides them through setup. It takes about 30 seconds.
Just the public key (a 64-character hex string). That's the user's unique identifier. No password hashing, no email verification, no OAuth tokens to manage.
Ask them to sign a NIP-98 auth event (kind 27235). It carries the exact URL and HTTP method it was signed for, plus a timestamp, so the signature cannot be replayed against a different endpoint or reused later. Verify it on your server against their public key.
Never accept a bare public key as proof of identity. Public keys are public, so anyone can send you someone else's.
Nostr uses secp256k1 elliptic curve cryptography (the same as Bitcoin). Private keys never leave the user's device. There's no central server to breach, no password database to leak.
No. The script is free and open source. NostrKey is free. Nostr is an open protocol with no usage fees.
Yes. Add data-relay="wss://your-relay.com" to the button div. When users log in, the relay is automatically added to their key manager.
A bunker URL (NIP-46) lets you log into Nostr apps without giving them your private key. Instead, signing requests are routed through a relay back to your key manager. You stay in control. Your keys never leave your browser.
Two lines of code. No backend changes. No vendor lock-in.