This commit is contained in:
Vitor Pamplona 2024-12-10 18:11:30 -03:00 committed by GitHub
commit 4ac023057e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 79 additions and 0 deletions

75
81.md Normal file
View File

@ -0,0 +1,75 @@
NIP-81
======
Relationship Status
-------------------
`draft` `optional`
This NIP defines two new event kinds (`30382` and `31382`) 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. The `d` tag contains the target public key in hex.
```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 rendered instead of the person's display name in all interfaces when the signer of this event is logged in.
### Relationship Categories
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.
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.
```js
{
"kind": 10008,
"content": nip44Encrypt(JSON.stringify([
["map", "<identifier>", "<name>"],
["map", "bitcoiner", "bitcoiner"],
["map", "6064460175057025", "debtor"]
])),
// ...other fields
}
```
### Private Relationship Status
For relationships that must remain private (e.g private follows, client lists, etc), the event kind `31382` uses a similar structure but with a hashed `d` tag using [NIP-44](44.md)'s `hkdf` function.
```js
{
"kind": 31382,
"tags": [
["d", sha256(hkdf(private_key, salt: 'nip81') || "<pubkey>")],
["n", "6064460175057025"],
],
"content": nip44Encrypt(JSON.stringify([
["p", "<pubkey>", "<relay url>"],
["n", "client-list"],
["petname", "<My buddy>"],
["summary", "<Summary of the relationship>"],
])),
// ...other fields
}
```

View File

@ -86,6 +86,7 @@ They exist to document what may be implemented by [Nostr](https://github.com/nos
- [NIP-73: External Content IDs](73.md)
- [NIP-75: Zap Goals](75.md)
- [NIP-78: Application-specific data](78.md)
- [NIP-81: Relationship Status](81.md)
- [NIP-84: Highlights](84.md)
- [NIP-86: Relay Management API](86.md)
- [NIP-89: Recommended Application Handlers](89.md)
@ -168,6 +169,7 @@ They exist to document what may be implemented by [Nostr](https://github.com/nos
| `10005` | Public chats list | [51](51.md) |
| `10006` | Blocked relays list | [51](51.md) |
| `10007` | Search relays list | [51](51.md) |
| `10008` | Event Set Names | [81](81.md) |
| `10009` | User groups | [51](51.md), [29](29.md) |
| `10015` | Interests list | [51](51.md) |
| `10019` | Nutzap Mint Recommendation | [61](61.md) |
@ -206,6 +208,7 @@ They exist to document what may be implemented by [Nostr](https://github.com/nos
| `30078` | Application-specific Data | [78](78.md) |
| `30311` | Live Event | [53](53.md) |
| `30315` | User Statuses | [38](38.md) |
| `30382` | Public Relationship Status | [81](81.md) |
| `30388` | Slide Set | [Corny Chat][cornychat-slideset] |
| `30402` | Classified Listing | [99](99.md) |
| `30403` | Draft Classified Listing | [99](99.md) |
@ -213,6 +216,7 @@ They exist to document what may be implemented by [Nostr](https://github.com/nos
| `30618` | Repository state announcements | [34](34.md) |
| `30818` | Wiki article | [54](54.md) |
| `30819` | Redirects | [54](54.md) |
| `31382` | Private Relationship Status | [81](81.md) |
| `31388` | Link Set | [Corny Chat][cornychat-linkset] |
| `31890` | Feed | [NUD: Custom Feeds][NUD: Custom Feeds] |
| `31922` | Date-Based Calendar Event | [52](52.md) |