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-03-19 16:01:55 -04:00
Event `kind:30382` documents a "Relationship Status" between two keys and uses private and public tags to describe that relationship.
2023-09-04 11:35:30 -04:00
2024-03-19 16:01:55 -04:00
Since statuses change over time, this event is defined as a _parameterized replaceable event_ with a single `d` tag that identifies the target key.
2024-02-07 17:59:27 -05:00
2024-03-19 16:01:55 -04:00
When the relationship is public, the `d` tag is the same as the `p` -tag.
2023-09-04 11:35:30 -04:00
```js
{
"kind": 30382,
"tags": [
2024-03-19 16:01:55 -04:00
["d", "e88a691e98d9987c964521dff60025f60700378a4879180dcbbb4a5027850411"],
["n", "Follow"],
["n", "Bitcoiners"],
["n", "6064460175057025"]
["p", "e88a691e98d9987c964521dff60025f60700378a4879180dcbbb4a5027850411", "< relay > "],
2023-09-04 11:35:30 -04:00
],
2024-02-12 11:42:10 -05:00
"content": nip44Encrypt(JSON.stringify([
2024-03-19 16:01:55 -04:00
["petname", "NVK (Coldcard)"],
["summary", "Owes me a beer"]
2024-02-12 11:42:10 -05:00
])),
2024-02-12 11:51:45 -05:00
// ...other fields
2023-09-04 11:35:30 -04:00
}
```
2024-03-19 16:01:55 -04:00
The 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-12 12:17:06 -05:00
2024-03-19 16:01:55 -04:00
`petname` SHOULD be used instead of the person's display name in all interfaces
2024-02-12 12:17:06 -05:00
2024-03-19 16:01:55 -04:00
### Relationship Categories
2024-02-12 12:17:06 -05:00
2024-03-19 16:01:55 -04:00
Optional `n` tags `["n", "<list code>"]` add the target key to unbound lists. This allows clients to query by `n` and download all members of a list.
2024-02-12 11:42:10 -05:00
2024-03-19 16:01:55 -04:00
List `codes` can be human readable or not. A new event kind named "Unbound List Names" (`kind:10008`) uses `map` tags to display the list name. Clients SHOULD display the `name` instead of the `code` if the `code` is present in this list.
2024-02-12 11:42:10 -05:00
```js
{
2024-02-12 11:57:50 -05:00
"kind": 10008,
2024-02-12 11:42:10 -05:00
"content": nip44Encrypt(JSON.stringify([
2024-03-19 16:01:55 -04:00
["map", "< code > ", "< name > "],
["map", "Bitcoiners", "Bitcoiners"],
["map", "6064460175057025", "Debtors"]
2024-02-12 11:42:10 -05:00
])),
// ...other fields
}
```
2024-03-19 16:01:55 -04:00
### Private Relationship Status
2024-02-12 11:42:10 -05:00
2024-03-19 16:01:55 -04:00
For relationships that MUST remain private, a deterministic `d` -Tag is calculated using [NIP-44 ](44.md )'s `hkdf` function and a `sha256` hash between the signer's private key and the pubkey of the `p` tag.
2024-02-12 11:42:10 -05:00
2024-03-19 16:01:55 -04:00
```js
{
"kind": 30382,
"tags": [
["d", sha256(hkdf(private_key, salt: 'nip81') || "< pubkey > ")],
],
"content": nip44Encrypt(JSON.stringify([
["p", "< pubkey > ", "relay"],
["n", "Clients List"],
["petname", "< My buddy > "],
["summary", "< Summary of the relationship > "],
])),
// ...other fields
}
2024-02-12 11:42:10 -05:00
```