nips/81.md
Vitor Pamplona a5ff486989
Update 81.md
Co-authored-by: arthurfranca <arthur.a.franca@gmail.com>
2024-05-10 10:39:33 -04:00

73 lines
2.1 KiB
Markdown

NIP-81
======
Relationship Status
-------------------
`draft` `optional`
This NIP defines two new event kinds (`30382` and `30383`) to document the relationship between two keys.
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.
### Public Relationship Status
Event kind `30382` is used when the relationship itself is public, with the `d` tag receiving the public key each target key.
```js
{
"kind": 30382,
"tags": [
["d", "e88a691e98d9987c964521dff60025f60700378a4879180dcbbb4a5027850411"],
["n", "follow"],
["n", "bitcoiner"],
["n", "6064460175057025"]
],
"content": nip44Encrypt(JSON.stringify([
["petname", "NVK (Coldcard)"],
["summary", "Owes me a beer"]
])),
// ...other fields
}
```
`petname` SHOULD be used instead of the person's display name in all interfaces.
### Relationship Categories
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.
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.
```js
{
"kind": 10008,
"content": nip44Encrypt(JSON.stringify([
["map", "<code>", "<name>"],
["map", "bitcoiner", "bitcoiner"],
["map", "6064460175057025", "debtor"]
])),
// ...other fields
}
```
### Private Relationship Status
For relationships that MUST remain private, Event kind `30383` uses a similar structure but with a hashed `d` tag using [NIP-44](44.md)'s `hkdf` function.
```js
{
"kind": 30383,
"tags": [
["d", sha256(hkdf(private_key, salt: 'nip81') || "<pubkey>")],
["n", "6064460175057025"],
],
"content": nip44Encrypt(JSON.stringify([
["p", "<pubkey>", "relay"],
["n", "clients-list"],
["petname", "<My buddy>"],
["summary", "<Summary of the relationship>"],
])),
// ...other fields
}
```