mirror of
https://github.com/nostr-protocol/nips.git
synced 2024-12-23 00:45:53 -05:00
84 lines
2.5 KiB
Markdown
84 lines
2.5 KiB
Markdown
NIP-81
|
|
======
|
|
|
|
Relationship Status
|
|
-------------------
|
|
|
|
`draft` `optional`
|
|
|
|
Event `kind:30382` documents a "Relationship Status" between two pubkeys and uses private and public tags to enhance the description of that relationship. Since statuses change over time, this event is defined as a _parameterized replaceable event_ with a single `d` tag that identifies each pair of keys.
|
|
|
|
Optional `n` tags add the target key to unbound lists.
|
|
|
|
The private tags are JSON Stringified, [NIP-44](44.md)-encrypted and placed inside the `.content` of the event.
|
|
|
|
Example of Public Status
|
|
|
|
```js
|
|
{
|
|
"kind": 30382,
|
|
"tags": [
|
|
["d", "<randomUUID>"],
|
|
["n", "Clients"],
|
|
["n", "Developers"],
|
|
["p", "<pubkey>", "relay"],
|
|
["trust_level", "1"],
|
|
["nickname", "<My buddy>"],
|
|
["summary", "<Summary of the relationship>"]
|
|
],
|
|
"content": "",
|
|
// ...other fields
|
|
}
|
|
```
|
|
|
|
Example of Private Status
|
|
|
|
```js
|
|
{
|
|
"kind": 30382,
|
|
"tags": [
|
|
["d", "<randomUUID>"],
|
|
["n", "Clients"],
|
|
["n", "6064460175057025"], // see private n-tags below
|
|
],
|
|
"content": nip44Encrypt(JSON.stringify([
|
|
["p", "<pubkey>", "relay"],
|
|
["nickname", "<My buddy>"],
|
|
["summary", "<Summary of the relationship>"],
|
|
["nip82secret", "<secret used to decrypt medical data for this pubkey>"]
|
|
])),
|
|
// ...other fields
|
|
}
|
|
```
|
|
|
|
`nickname` SHOULD be used instead of the person's display name in all interfaces
|
|
|
|
Profile screens MAY display the summary of the relationship and allow the user to change the tags of this event.
|
|
|
|
Clients MAY filter by `kind:30382`, with or without `n` tags, to determine how to assemble feeds, group messages, and when to display content.
|
|
|
|
### Private `n`-tags
|
|
|
|
Clients MAY hide human readable `n`-tags behind a code and list their code maps in the new "Unbound List Names" event kind (`kind:10008`), using the `map` tag from code to name.
|
|
|
|
```js
|
|
{
|
|
"kind": 10008,
|
|
"content": nip44Encrypt(JSON.stringify([
|
|
["map", "<Code used in other events>", "<Human readable name>"],
|
|
["map", "Clients", "Clients"], // public list of my Clients
|
|
["map", "6064460175057025", "Idiots"] // private list of idiots
|
|
])),
|
|
// ...other fields
|
|
}
|
|
```
|
|
|
|
### Deterministic `d`-Tags.
|
|
|
|
For private use cases that must contain deterministic d-Tags, the recommendation is to use [NIP-44](44.md)'s `hkdf` function and use a hash between the user's private key and the pubkey of the `p` tag.
|
|
|
|
```
|
|
nip81_key = hkdf(private_key, salt: 'nip81')
|
|
bobs_d_tag = sha256(nip81_key || bobs_pub)
|
|
kates_d_tag = sha256(nip81_key || kates_pub)
|
|
``` |