2023-09-04 11:35:30 -04:00
NIP-81
======
2024-02-12 11:42:10 -05:00
Relationship Status
-------------------
2023-09-04 11:35:30 -04:00
2024-02-07 17:54:20 -05:00
`draft` `optional`
2023-09-04 11:35:30 -04:00
2024-02-12 11:46:33 -05:00
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.
2023-09-04 11:35:30 -04:00
2024-02-12 11:46:33 -05:00
Optional `n` tags add the target key to unbound lists.
2024-02-07 17:59:27 -05:00
2024-02-12 11:46:33 -05:00
The private tags are JSON Stringified, [NIP-44 ](44.md )-encrypted and placed inside the `.content` of the event.
2023-09-04 11:35:30 -04:00
2024-02-12 11:46:33 -05:00
Example of public Status
2024-02-12 11:42:10 -05:00
```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
}
```
2024-02-12 11:46:33 -05:00
Example of private Status
2023-09-04 11:35:30 -04:00
```js
{
"kind": 30382,
"tags": [
2024-02-07 18:33:15 -05:00
["d", "< randomUUID > "],
2024-02-12 11:48:35 -05:00
["n", "Clients"],
["n", "6064460175057025"], // see private n-tags below
2023-09-04 11:35:30 -04:00
],
2024-02-12 11:42:10 -05:00
"content": nip44Encrypt(JSON.stringify([
2024-02-07 17:54:20 -05:00
["p", "< pubkey > ", "relay"]
2023-09-04 11:41:59 -04:00
["nickname", "< My buddy > "]
2023-09-04 11:35:30 -04:00
["summary", "< Summary of the relationship > "],
2024-02-07 18:00:19 -05:00
["nip82secret", "< secret used to decrypt medical data for this pubkey > "]
2024-02-12 11:42:10 -05:00
])),
2023-09-04 11:35:30 -04:00
...other fields
}
```
2023-09-04 11:41:59 -04:00
`nickname` SHOULD be used instead of the person's display name in all interfaces
2023-09-04 11:35:30 -04:00
Profile screens MAY display the summary of the relationship and allow the user to change the tags of this event.
2024-02-07 17:54:20 -05:00
Clients MAY filter by `kind:30382` , with or without `n` tags, to determine how to assemble feeds, group messages, and when to display content.
2024-02-12 11:42:10 -05:00
### Private `n`-tags
Clients MAY hide human readable `n` -tags behind a code and list their code maps in `kind:10007` using the `n_name` tag.
```js
{
"kind": 10007,
"content": nip44Encrypt(JSON.stringify([
["n_name", "< Code used in other events > ", "< Name > "],
["n_name", "Clients", "Clients"] // public list of my Clients
2024-02-12 11:46:33 -05:00
["n_name", "6064460175057025", "Idiots"] // private list of idiots
2024-02-12 11:42:10 -05:00
])),
// ...other fields
}
```
2024-02-12 11:46:33 -05:00
### Deterministic `d`-Tags.
2024-02-12 11:42:10 -05:00
2024-02-12 11:46:33 -05:00
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.
2024-02-12 11:42:10 -05:00
```
nip81_key = hkdf(private_key, salt: 'nip81')
2024-02-12 11:46:33 -05:00
bobs_d_tag = sha256(nip81_key || bobs_pub)
kates_d_tag = sha256(nip81_key || kates_pub)
2024-02-12 11:42:10 -05:00
```