add "communities" list and examples.

This commit is contained in:
fiatjaf 2023-11-15 00:47:15 -03:00
parent 5dc6071978
commit da05b5d915
No known key found for this signature in database
GPG Key ID: BAD43C4BE5C1A3A1

44
51.md
View File

@ -16,9 +16,41 @@ The kinds `30000` and `30001` have been reserved for generic lists. These must b
## Standard lists
| name | kind | "d" tag | description | expected tag items |
| --- | --- | --- | --- | --- |
| Muted list | 30000 | `"mute"` | things the user doesn't want to see in their feeds | `"p"` (pubkeys), `"t"` (hashtags) |
| Bookmarks list | 30001 | `"bookmark"` | things the user intends to save for the future | `"e"` (kind:1 notes), `"a"` (kind:30023 articles) |
| Pin list | 30001 | `"pin"` | events the user intends to showcase in their profile page | `"e"` (kind:1 notes) |
| Relay sets | 30002 | (user-defined) | user-defined relay groups the user can easily pick and choose from during variadic operations | `"relay"` (relay URLs) |
| name | kind | "d" tag | description | expected tag items |
| --- | --- | --- | --- | --- |
| Mute list | 30000 | `"mute"` | things the user doesn't want to see in their feeds | `"p"` (pubkeys), `"t"` (hashtags) |
| Bookmarks list | 30001 | `"bookmark"` | things the user intends to save for the future | `"e"` (kind:1 notes), `"a"` (kind:30023 articles) |
| Pin list | 30001 | `"pin"` | events the user intends to showcase in their profile page | `"e"` (kind:1 notes) |
| Communities list | 30001 | `"communities"` | [NIP-72](72.md) communities the user belongs to | `"a"` (kind:34550 community definitions) |
| Relay sets | 30002 | (user-defined) | user-defined relay groups the user can easily pick and choose from during variadic operations | `"relay"` (relay URLs) |
## Examples
### A _Mute list_ with some public items and some encrypted items
```json
{
"id": "a92a316b75e44cfdc19986c634049158d4206fcc0b7b9c7ccbcdabe28beebcd0",
"pubkey": "854043ae8f1f97430ca8c1f1a090bdde6488bd5115c7a45307a2a212750ae4cb",
"created_at": 1699597889,
"kind": 30000,
"tags": [
["d", "mute"],
["p", "07caba282f76441955b695551c3c5c742e5b9202a3784780f8086fdcdc1da3a9"],
["p", "a55c15f5e41d5aebd236eca5e0142789c5385703f1a7485aa4b38d94fd18dcc4"]
],
"content": "TJob1dQrf2ndsmdbeGU+05HT5GMnBSx3fx8QdDY/g3NvCa7klfzgaQCmRZuo1d3WQjHDOjzSY1+MgTK5WjewFFumCcOZniWtOMSga9tJk1ky00tLoUUzyLnb1v9x95h/iT/KpkICJyAwUZ+LoJBUzLrK52wNTMt8M5jSLvCkRx8C0BmEwA/00pjOp4eRndy19H4WUUehhjfV2/VV/k4hMAjJ7Bb5Hp9xdmzmCLX9+64+MyeIQQjQAHPj8dkSsRahP7KS3MgMpjaF8nL48Bg5suZMxJayXGVp3BLtgRZx5z5nOk9xyrYk+71e2tnP9IDvSMkiSe76BcMct+m7kGVrRcavDI4n62goNNh25IpghT+a1OjjkpXt9me5wmaL7fxffV1pchdm+A7KJKIUU3kLC7QbUifF22EucRA9xiEyxETusNludBXN24O3llTbOy4vYFsq35BeZl4v1Cse7n2htZicVkItMz3wjzj1q1I1VqbnorNXFgllkRZn4/YXfTG/RMnoK/bDogRapOV+XToZ+IvsN0BqwKSUDx+ydKpci6htDRF2WDRkU+VQMqwM0CoLzy2H6A2cqyMMMD9SLRRzBg==?iv=S3rFeFr1gsYqmQA7bNnNTQ==",
"sig": "1173822c53261f8cffe7efbf43ba4a97a9198b3e402c2a1df130f42a8985a2d0d3430f4de350db184141e45ca844ab4e5364ea80f11d720e36357e1853dba6ca"
}
```
## Encryption process pseudocode
```scala
val private_items = [
["p", "07caba282f76441955b695551c3c5c742e5b9202a3784780f8086fdcdc1da3a9"],
["a", "a55c15f5e41d5aebd236eca5e0142789c5385703f1a7485aa4b38d94fd18dcc4"],
]
val base64blob = nip04.encrypt(json.encode_to_string(private_items))
event.content = base64blob
```