Skip to the content.

Get started with Nostr Connect

Nostr Connect (NIP46) is a remote key access protocol.

If you need continuous access to users’ Nostr keys, you have these options:

This guide is for you if you want to implement Nostr Connect.

If you are looking for a more general login with Nostr guide, check out nostrlogin.org

How to get started with Nostr Connect?

Before we start, to test your Nostr Connect client you should get yourself a server first - try nsec.app or nsecbunker.com or Gossip nostr client.

Now, if you’re building a web app, the best place to start would be nostr-login or window.nostr.js.

These are drop-in scripts that provide the UI for users to log in with Nostr Connect, while exposing a window.nostr object for your app to work with.

It super easy!

Just call signEvent and other methods on the window.nostr object and these libs will handle the rest.

Because there’s actually a lot to handle…

How to implement login with Nostr Connect?

If you just want your own Nostr Connect UI you should probably use NDK or nostr-tools@v2 to avoid implementing the full nip46 protocol yourself.

However, even with one of these libraries, the flow will be quite complex:

Wow, we made it!

Well hopefully we didn’t miss anything and it actually worked.

How to access keys with Nostr Connect?

Here is what happens next:

Cool, we’re accessing those keys now!

How to implement signup with Nostr Connect?

Sign up differs from login in that there is no remote user pubkey yet.

Instead, we will use the remote signer pubkey to send a create_account request to the nip46 server.

Here is how it will look with nostr-tools or NDK:

Now that was really hard, even with a help of some libraries. Hopefully, we get wider and more polished support for create_account method, for now - it is what it is.

How to implement the Nostr Connect client protocol?

This is really out of scope of a Getting started guide (just use libraries), but here are some hints:

How to implement the Nostr Connect server protocol?

Some hints here too:

Still have questions?

Submit an issue for this repo, we will do our best to help. And please submit PRs if you have something to contribute.