2023-09-04 15:35:30 +00:00
NIP-81
======
2024-02-12 16:42:10 +00:00
Relationship Status
-------------------
2023-09-04 15:35:30 +00:00
2024-02-07 22:54:20 +00:00
`draft` `optional`
2023-09-04 15:35:30 +00:00
2024-03-19 20:16:00 +00:00
This NIP defines two new event kinds (`30382` and `30383` ) to document the relationship between two keys.
2023-09-04 15:35:30 +00:00
2024-03-19 20:16:00 +00:00
Both kinds offer public and private tags to describe that relationship. Private tags are JSON Stringified, [NIP-44 ](44.md )-encrypted to the signer's keys and placed inside the `.content` of the event.
2024-02-07 22:59:27 +00:00
2024-03-19 20:16:00 +00:00
### Public Relationship Status
2024-05-11 00:01:11 +00:00
Event kind `30382` is used when the relationship itself is public. The `d` tag contains the target public key in hex.
2023-09-04 15:35:30 +00:00
```js
{
"kind": 30382,
"tags": [
2024-03-19 20:01:55 +00:00
["d", "e88a691e98d9987c964521dff60025f60700378a4879180dcbbb4a5027850411"],
2024-05-10 14:39:28 +00:00
["n", "follow"],
["n", "bitcoiner"],
2024-03-19 20:01:55 +00:00
["n", "6064460175057025"]
2023-09-04 15:35:30 +00:00
],
2024-02-12 16:42:10 +00:00
"content": nip44Encrypt(JSON.stringify([
2024-03-19 20:01:55 +00:00
["petname", "NVK (Coldcard)"],
["summary", "Owes me a beer"]
2024-02-12 16:42:10 +00:00
])),
2024-02-12 16:51:45 +00:00
// ...other fields
2023-09-04 15:35:30 +00:00
}
```
2024-05-11 00:01:11 +00:00
`petname` SHOULD be rendered instead of the person's display name in all interfaces when the signer of this event is logged in.
2024-02-12 17:17:06 +00:00
2024-03-19 20:01:55 +00:00
### Relationship Categories
2024-02-12 17:17:06 +00:00
2024-05-11 00:01:11 +00:00
Optional `n` tags `["n", "<identifier>"]` add the target key to event sets. This allows clients to query by `n` and download all members of a set.
2024-02-12 16:42:10 +00:00
2024-05-11 00:01:11 +00:00
Set `identifier` can be human readable and public or not.
For private cases, a new event kind named "Event Set Names" (`kind:10008`) uses `map` tags to store the set name. Clients SHOULD display the `name` instead of the `identifier` if the `identifier` is present in this event.
2024-02-12 16:42:10 +00:00
```js
{
2024-02-12 16:57:50 +00:00
"kind": 10008,
2024-02-12 16:42:10 +00:00
"content": nip44Encrypt(JSON.stringify([
2024-05-11 00:01:11 +00:00
["map", "< identifier > ", "< name > "],
2024-05-10 14:39:33 +00:00
["map", "bitcoiner", "bitcoiner"],
["map", "6064460175057025", "debtor"]
2024-02-12 16:42:10 +00:00
])),
// ...other fields
}
```
2024-03-19 20:01:55 +00:00
### Private Relationship Status
2024-02-12 16:42:10 +00:00
2024-05-11 00:01:11 +00:00
For relationships that must remain private (e.g private follows, client lists, etc), the event kind `30383` uses a similar structure but with a hashed `d` tag using [NIP-44 ](44.md )'s `hkdf` function.
2024-02-12 16:42:10 +00:00
2024-03-19 20:01:55 +00:00
```js
{
2024-03-19 20:16:00 +00:00
"kind": 30383,
2024-03-19 20:01:55 +00:00
"tags": [
["d", sha256(hkdf(private_key, salt: 'nip81') || "< pubkey > ")],
2024-03-19 20:16:00 +00:00
["n", "6064460175057025"],
2024-03-19 20:01:55 +00:00
],
"content": nip44Encrypt(JSON.stringify([
2024-05-11 00:01:11 +00:00
["p", "< pubkey > ", "< relay url > "],
["n", "client-list"],
2024-03-19 20:01:55 +00:00
["petname", "< My buddy > "],
["summary", "< Summary of the relationship > "],
])),
// ...other fields
}
2024-02-12 16:42:10 +00:00
```