NIP-05: Mapping Nostr keys to DNS-based internet identifiers

As a part of the kind 0 metadata events the optional key nip05 is used to set and internet identifier value (e.g. TestName@rustNostr.com). Clients can then use this information to make GET requests with the form https://<domain>/.well-known/nostr.json?name=<local-part>.

Rust

TODO

Python

Using the Metadata class to build the metadata object and incorporate the NIP-05 identifier with the set_nip05() method.

For more details on metadata (or general) events please refer back to the examples provided for NIP-01.

# Create metadata object with name and NIP05
metadata = Metadata() \
    .set_name("TestName") \
    .set_nip05("TestName@rustNostr.com")

For verification of NIP-05 identifiers associated with a given PublicKey object we can the verify_nip05() function as follows:

print("Verify NIP-05:")
nip_05 = "yuki@yukikishimoto.com"
public_key = PublicKey.parse("npub1drvpzev3syqt0kjrls50050uzf25gehpz9vgdw08hvex7e0vgfeq0eseet")
proxy = None
if await verify_nip05(public_key, nip_05, proxy):
    print(f"     '{nip_05}' verified, for {public_key.to_bech32()}")
else:
    print(f"     Unable to verify NIP-05, for {public_key.to_bech32()}")

To get the NIP-05 profile data (ex. user public key and relays) the get_nip05_profile() function can be called:

print("Profile NIP-05:")
nip_05 = "yuki@yukikishimoto.com"
profile = await get_nip05_profile(nip_05)
print(f"     {nip_05} Public key: {profile.public_key().to_bech32()}")
JavaScript

Using the Metadata class to build the metadata object and incorporate the NIP-05 identifier with the nip05() method.

For more details on metadata (or general) events please refer back to the examples provided for NIP-01.

// Create metadata object with name and NIP05
let metadata = new Metadata()
    .name("TestName")
    .nip05("TestName@rustNostr.com");

For verification of NIP-05 identifiers associated with a given PublicKey object we can the verifyNip05() function as follows:

console.log("Verify NIP-05:");
let nip05 = "Rydal@gitlurker.info";
let publicKey = PublicKey.parse("npub1zwnx29tj2lnem8wvjcx7avm8l4unswlz6zatk0vxzeu62uqagcash7fhrf");
if (await verifyNip05(publicKey, nip05)) {
    console.log(`     '${nip05}' verified, for ${publicKey.toBech32()}`);
} else {
    console.log(`     Unable to verify NIP-05, for ${publicKey.toBech32()}`);
};

To get the NIP-05 profile data (ex. user public key and relays) the getNip05Profile() function can be called:

console.log("Get NIP-05 profile:");
let nip_05 = "yuki@yukikishimoto.com";
let profile = await getNip05Profile(nip_05);
console.log(`     ${nip_05} Public key: ${profile.publicKey().toBech32()}`);
Kotlin

TODO

Swift

TODO

Flutter

TODO