diff options
Diffstat (limited to '51.md')
| -rw-r--r-- | 51.md | 120 |
1 files changed, 105 insertions, 15 deletions
| @@ -6,35 +6,64 @@ Lists | |||
| 6 | 6 | ||
| 7 | `draft` `optional` `author:fiatjaf` `author:arcbtc` `author:monlovesmango` `author:eskema` `author:gzuuus` | 7 | `draft` `optional` `author:fiatjaf` `author:arcbtc` `author:monlovesmango` `author:eskema` `author:gzuuus` |
| 8 | 8 | ||
| 9 | This NIP defines lists of things that users can create. Lists can contain references to anything, and these references can be **public** or **private**. | 9 | This NIP defines lists of things that users can create. Lists can contain references to anything, and these |
| 10 | references can be **public** or **private**. | ||
| 10 | 11 | ||
| 11 | Public items in a list are specified in the event `tags` array, while private items are specified in a JSON array that mimics the structure of the event `tags` array, but stringified and encrypted using the same scheme from [NIP-04](04.md) (the shared key is computed using the author's public and private key) and stored in the `.content`. | 12 | Public items in a list are specified in the event `tags` array, while private items are specified in a JSON |
| 13 | array that mimics the structure of the event `tags` array, but stringified and encrypted using the same | ||
| 14 | scheme from [NIP-04](04.md) (the shared key is computed using the author's public and private key) and | ||
| 15 | stored in the `.content`. | ||
| 12 | 16 | ||
| 13 | ## Generic lists | 17 | ## Types of lists |
| 14 | 18 | ||
| 15 | The kinds `30000` and `30001` have been reserved for generic lists. These must be accompanied by a `d` tag identifying the list, but these are generally client-specific, except in the standard cases specified below. | 19 | ### Generic lists |
| 16 | 20 | ||
| 17 | ### Standard lists | 21 | The kind `30001` has been reserved for generic lists. These must be accompanied by a `d` tag identifying the |
| 22 | list, but these have no standard meaning and are generally client-specific (except in the standard cases | ||
| 23 | specified below). | ||
| 18 | 24 | ||
| 19 | These are some standards that emerged in the wild: | 25 | ## Standard lists |
| 26 | |||
| 27 | Users are expected to have a single list of each of these types. They have special meaning and clients may | ||
| 28 | rely on them to augment the user profile or browsing experience. | ||
| 29 | |||
| 30 | For example, _mute lists_ can contain the public keys of spammers and bad actors users don't want to see in | ||
| 31 | their feeds or receive annoying notifications from. | ||
| 20 | 32 | ||
| 21 | | name | kind | "d" tag | description | expected tag items | | 33 | | name | kind | "d" tag | description | expected tag items | |
| 22 | | --- | --- | --- | --- | --- | | 34 | | --- | --- | --- | --- | --- | |
| 23 | | Mute list | 30000 | `"mute"` | things the user doesn't want to see in their feeds | `"p"` (pubkeys), `"t"` (hashtags) | | 35 | | Mute list | 10000 | | things the user doesn't want to see in their feeds | `"p"` (pubkeys), `"t"` (hashtags) | |
| 24 | | Bookmarks list | 30001 | `"bookmark"` | things the user intends to save for the future | `"e"` (kind:1 notes), `"a"` (kind:30023 articles) | | 36 | | Bookmarks list | 30001 | `"bookmark"` | things the user intends to save for the future | `"e"` (kind:1 notes), `"a"` (kind:30023 articles) | |
| 25 | | Pin list | 30001 | `"pin"` | events the user intends to showcase in their profile page | `"e"` (kind:1 notes) | | 37 | | Pin list | 30001 | `"pin"` | events the user intends to showcase in their profile page | `"e"` (kind:1 notes) | |
| 26 | | Communities list | 30001 | `"communities"` | [NIP-72](72.md) communities the user belongs to | `"a"` (kind:34550 community definitions) | | 38 | | Communities list | 30001 | `"communities"` | [NIP-72](72.md) communities the user belongs to | `"a"` (kind:34550 community definitions) | |
| 27 | 39 | ||
| 28 | ## Sets | 40 | ## Sets |
| 29 | 41 | ||
| 30 | Sets are lists with well-defined meaning and purpose and user-assigned `d` tags meant to be displayed in the UI. For example, _relay sets_ can be displayed in a dropdown UI to give users the option to switch to which relays they will publish an event or from which relays they will read the replies to an event; or _curation sets_ can be used by apps to showcase curations made by others tagged to different topics. | 42 | Sets are lists with well-defined meaning that can enhance the functionality and the UI of clients that rely |
| 43 | on them. Unlike standard lists, users are expected to have more than one set of each kind, therefore each of | ||
| 44 | them must be assigned a different `"d"` identifier. | ||
| 45 | |||
| 46 | For example, _relay sets_ can be displayed in a dropdown UI to give users the option to switch to which | ||
| 47 | relays they will publish an event or from which relays they will read the replies to an event; _curation sets_ | ||
| 48 | can be used by apps to showcase curations made by others tagged to different topics. | ||
| 49 | |||
| 50 | Aside from their main identifier, the `"d"` tag, sets can optionally have a `"title"`, an `"image"` and a | ||
| 51 | `"description"` tag that can be used to enhance their UI. | ||
| 52 | |||
| 53 | | name | kind | description | expected tag items | | ||
| 54 | | --- | --- | --- | --- | | ||
| 55 | | Relay sets | 30002 | user-defined relay groups the user can easily pick and choose from during variadic operations | `"relay"` (relay URLs) | | ||
| 56 | | Article Curation sets | 30004 | groups of articles picked by users as interesting and/or belonging to the same category | `"a"` (kind:30023 articles), `"e"` (kind:1 notes) | | ||
| 57 | |||
| 58 | ## Deprecated standard lists | ||
| 31 | 59 | ||
| 32 | Aside from their main identifier, the `"d"` tag, sets can optionally have a `"title"`, an `"image"` and a `"description"` tag that can be used to enhance their UI. | 60 | Some clients have used these lists in the past, but they should work on transitioning to the [standard formats](#standard-lists) above: |
| 33 | 61 | ||
| 34 | | name | kind | description | expected tag items | | 62 | - kind:30000 and `d` "mute" |
| 35 | | --- | --- | --- | --- | | 63 | |
| 36 | | Relay sets | 30002 | user-defined relay groups the user can easily pick and choose from during variadic operations | `"relay"` (relay URLs) | | 64 | | kind | "d" tag | use instead | |
| 37 | | Article Curation sets | 30003 | groups of articles picked by users as interesting and/or belonging to the same category | `"a"` (kind:30023 articles) | | 65 | | --- | --- | --- | |
| 66 | | 30000 | `"mute"` | kind 10000 _mute list_ | | ||
| 38 | 67 | ||
| 39 | ## Examples | 68 | ## Examples |
| 40 | 69 | ||
| @@ -45,9 +74,8 @@ Aside from their main identifier, the `"d"` tag, sets can optionally have a `"ti | |||
| 45 | "id": "a92a316b75e44cfdc19986c634049158d4206fcc0b7b9c7ccbcdabe28beebcd0", | 74 | "id": "a92a316b75e44cfdc19986c634049158d4206fcc0b7b9c7ccbcdabe28beebcd0", |
| 46 | "pubkey": "854043ae8f1f97430ca8c1f1a090bdde6488bd5115c7a45307a2a212750ae4cb", | 75 | "pubkey": "854043ae8f1f97430ca8c1f1a090bdde6488bd5115c7a45307a2a212750ae4cb", |
| 47 | "created_at": 1699597889, | 76 | "created_at": 1699597889, |
| 48 | "kind": 30000, | 77 | "kind": 10000, |
| 49 | "tags": [ | 78 | "tags": [ |
| 50 | ["d", "mute"], | ||
| 51 | ["p", "07caba282f76441955b695551c3c5c742e5b9202a3784780f8086fdcdc1da3a9"], | 79 | ["p", "07caba282f76441955b695551c3c5c742e5b9202a3784780f8086fdcdc1da3a9"], |
| 52 | ["p", "a55c15f5e41d5aebd236eca5e0142789c5385703f1a7485aa4b38d94fd18dcc4"] | 80 | ["p", "a55c15f5e41d5aebd236eca5e0142789c5385703f1a7485aa4b38d94fd18dcc4"] |
| 53 | ], | 81 | ], |
| @@ -56,6 +84,68 @@ Aside from their main identifier, the `"d"` tag, sets can optionally have a `"ti | |||
| 56 | } | 84 | } |
| 57 | ``` | 85 | ``` |
| 58 | 86 | ||
| 87 | ### A _communities list_ with just public items | ||
| 88 | |||
| 89 | ```json | ||
| 90 | { | ||
| 91 | "id": "da6b18c5452b5a60bf49588fc13ae4d1a047519c13e49a77b3184e6188c7bb1c", | ||
| 92 | "pubkey": "83fd07de9b763334cc9d46f2785c2558e6c2eabfe7d0c6ec214667cbaec50d47", | ||
| 93 | "created_at": 1689082210, | ||
| 94 | "kind": 30001, | ||
| 95 | "tags": [ | ||
| 96 | [ | ||
| 97 | "d", | ||
| 98 | "communities" | ||
| 99 | ], | ||
| 100 | [ | ||
| 101 | "a", | ||
| 102 | "34550:83fd07de9b763334cc9d46f2785c2558e6c2eabfe7d0c6ec214667cbaec50d47:meme" | ||
| 103 | ], | ||
| 104 | [ | ||
| 105 | "a", | ||
| 106 | "34550:b9a537523bba2fcdae857d90d8a760de4f2139c9f90d986f747ce7d0ec0d173d:NoBullshitBitcoin" | ||
| 107 | ] | ||
| 108 | ], | ||
| 109 | "content": "", | ||
| 110 | "sig": "e400cc8bf24955243137e4456b22142fdff400a7950cf0b0ac2ee86ed78671e2fddf9a9b40c77ccf8397f9c21d608b3fab3678ff13713fc3f97a4394cf766079" | ||
| 111 | } | ||
| 112 | ``` | ||
| 113 | |||
| 114 | ### A _curation set_ of articles and notes about yaks | ||
| 115 | |||
| 116 | ``` | ||
| 117 | { | ||
| 118 | "id": "567b41fc9060c758c4216fe5f8d3df7c57daad7ae757fa4606f0c39d4dd220ef", | ||
| 119 | "pubkey": "d6dc95542e18b8b7aec2f14610f55c335abebec76f3db9e58c254661d0593a0c", | ||
| 120 | "created_at": 1695327657, | ||
| 121 | "kind": 30004, | ||
| 122 | "tags": [ | ||
| 123 | [ | ||
| 124 | "d", | ||
| 125 | "jvdy9i4" | ||
| 126 | ], | ||
| 127 | [ | ||
| 128 | "title", | ||
| 129 | "Yaks" | ||
| 130 | ], | ||
| 131 | [ | ||
| 132 | "summary", | ||
| 133 | "The domestic yak, also known as the Tartary ox, grunting ox, or hairy cattle, is a species of long-haired domesticated cattle found throughout the Himalayan region of the Indian subcontinent, the Tibetan Plateau, Gilgit-Baltistan, Tajikistan and as far north as Mongolia and Siberia." | ||
| 134 | ], | ||
| 135 | [ | ||
| 136 | "image", | ||
| 137 | "https://cdn.britannica.com/40/188540-050-9AC748DE/Yak-Himalayas-Nepal.jpg" | ||
| 138 | ], | ||
| 139 | ["a", "30023:26dc95542e18b8b7aec2f14610f55c335abebec76f3db9e58c254661d0593a0c:95ODQzw3ajNoZ8SyMDOzQ"], | ||
| 140 | ["a", "30023:54af95542e18b8b7aec2f14610f55c335abebec76f3db9e58c254661d0593a0c:1-MYP8dAhramH9J5gJWKx"], | ||
| 141 | ["a", "30023:f8fe95542e18b8b7aec2f14610f55c335abebec76f3db9e58c254661d0593a0c:D2Tbd38bGrFvU0bIbvSMt"], | ||
| 142 | ["e", "d78ba0d5dce22bfff9db0a9e996c9ef27e2c91051de0c4e1da340e0326b4941e"] | ||
| 143 | ], | ||
| 144 | "content": "", | ||
| 145 | "sig": "a9a4e2192eede77e6c9d24ddfab95ba3ff7c03fbd07ad011fff245abea431fb4d3787c2d04aad001cb039cb8de91d83ce30e9a94f82ac3c5a2372aa1294a96bd" | ||
| 146 | } | ||
| 147 | ``` | ||
| 148 | |||
| 59 | ## Encryption process pseudocode | 149 | ## Encryption process pseudocode |
| 60 | 150 | ||
| 61 | ```scala | 151 | ```scala |