Wikifreedia
All versions

Label Nostr Profiles with string and/or Badge identifiers. Both publicly and privately.

Public Profile Label (kind 30382)

An event for publicly labeling a profile. The d tag contains the target public key in hex.

Private tags can be used and are JSON Stringified, NIP-44-encrypted to the signer’s keys and placed inside the .content of the event.

Example

{
  "id": "<event-id>",
  "pubkey": "<pubkey>",
  "created_at": 1675642635,
  "kind": 30382,
  "tags": [
    ["d", "e88a691e98d9987c964521dff60025f60700378a4879180dcbbb4a5027850411"],
    ["n", "My Network"],
    ["n", "6064460175057025"],
    ["a", "30009:communityName:member", "wss://relay.example.com"],
    ["a", "30009:bob:fren", "wss://relay.example.com"]
  ],
  "content": nip44Encrypt(JSON.stringify([
    ["petname", "NVK (Coldcard)"],
    ["summary", "Owes me a beer"]
  ])),
  "sig": "<signature>"
}

Label Categories

String Labels

The n tag ["n", "<identifier>"] serves as the primary way to label profiles with string identifiers. This allows clients to query by n and download all members of a set. The set identifier can be human readable and public or not.

My Network

Personal network

My Contacts

Private contacts

Any string

Custom label identifier

Badge Labels

The a tag ["a", "<kind>:<pubkey>:<d-identifier>", "<relay url>"] serves as the primary way to hand out Badges to profiles. This references addressable badge events (kind 30009) that define the badge.

30009:communityName:member

Community membership badge

30009:bob:fren

Friend badge from Bob

Any badge event

Reference to any addressable badge event

Private Profile Labels (kind 31382)

For labels that must remain private (e.g. private follows, client lists, etc.), the event kind 31382 uses a similar structure but with a hashed d tag using NIP-44’s hkdf function.

{
  "id": "<event-id>",
  "pubkey": "<pubkey>",
  "created_at": 1675642635,
  "kind": 31382,
  "tags": [
    ["d", sha256(hkdf(private_key, salt: 'nip81') || "<pubkey>")],
    ["n", "6064460175057025"]
  ],
  "content": nip44Encrypt(JSON.stringify([
    ["p", "<pubkey>", "<relay url>"],
    ["n", "client-list"],
    ["petname", "<My buddy>"],
    ["summary", "<Summary of the relationship>"]
  ])),
  "sig": "<signature>"
}

Label Acceptance

Profiles can accept labels by including them in their kind 0 (metadata) event. This serves as an explicit acknowledgment of the label. The accepted labels should be stored in a badges or labels tag within the kind 0 event.

{
  "id": "<event-id>",
  "pubkey": "<pubkey>",
  "created_at": 1675642635,
  "kind": 0,
  "tags": [
    ["name", "Alice"],
    ["about", "..."],
    ["badge", "<kind 30009 badge definition event id>", "<kind 30382 profile label event id>"],
    ["badge", "<kind 30009 badge definition event id>", "<kind 30382 profile label event id>"],
    ["label", "<kind 30382 label definition event id>"],
    ["label", "<kind 30382 label definition event id>"]
  ],
  "content": "",
  "sig": "<signature>"
}

When a profile accepts a label, clients SHOULD display it as an official part of their profile. Labels that haven’t been accepted MAY be displayed differently or with a visual indicator to show they are pending acceptance.