NIP-5 ๐Ÿ‘€

NIP-5 defines a way to map NOSTR keys to DNS-based internet identifiers, enabling clients to associate email-like identifiers with public keys and enabling user discovery.

NIP-5 provides a standard for associating Nostr keys with DNS-based internet identifiers, making it easier for users to discover and identify others on the network. In events with kind 0 (set_metadata), users can include a key "nip05" with an email-like address as its value, such as "bob@example.com".

Upon seeing this event, clients perform the following steps:

  1. Split the identifier into <local-part> and <domain>.

  2. Make a GET request to https://<domain>/.well-known/nostr.json?name=<local-part>.

The response should be a JSON object containing a "names" key, mapping names to hex-formatted public keys:

{ "names": { "bob": "b0635d6a9851d3aed0cd6c495b282167acf761729078d975fc341b22650b07b9" } }

An optional "relays" attribute can also be included, providing an object with public keys as properties and arrays of relay URLs as values. This helps clients learn about relays where a user may be found:

{ "names": { "bob": "b0635d6a9851d3aed0cd6c495b282167acf761729078d975fc341b22650b07b9" }, "relays": { "b0635d6a9851d3aed0cd6c495b282167acf761729078d975fc341b22650b07b9": [ "wss://relay.example.com", "wss://relay2.example.com" ] } }

If the public key from the response matches the one in the set_metadata event, clients consider the "nip05" identifier as valid and can display it.

Clients can also reverse the process to find users' public keys from their NIP-5 internet identifiers. They fetch the well-known URL, obtain the user's public key, and check for a matching "nip05" in the kind 0 event.

Last updated