Skip to content

Commit

Permalink
change to a general list
Browse files Browse the repository at this point in the history
change from encrypted list to a general list that can have both private and public list items
  • Loading branch information
monlovesmango authored Jan 15, 2023
1 parent b6c3e0d commit 13a71ea
Showing 1 changed file with 30 additions and 13 deletions.
43 changes: 30 additions & 13 deletions 42.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
NIP-42
======

Encrypted Lists
Lists
-------------------------

`draft` `optional` `author:monlovesmango` `author:fiatjaf` `author:arcbtc`
`draft` `optional` `author:monlovesmango` `author:fiatjaf` `author:arcbtc` `author:eskema`

A special event with kind `30000`, meaning "encrypted list" is defined as having a list of tags encrypted and stored within the content field. This event kind would follow [NIP-33 - Parameterized Replaceable Events](33.md). The tag list SHOULD ONLY contain [generic tags](12.md) that are queryable by relays in lowercase HEX format. Encrypted lists SHOULD not mix different generic tags (ie. 'p' tags can't be included in the same list as 'e' tags)
An event kind of `30000` indicates a "list" event. A single list can hold both private and public list items. The public section of the list will be defined in the event's tags. the private section of the list will be defined in a list of tags encrypted within the event content. Event content MUST be equal to the base64-encoded, aes-256-cbc encrypted string of the list of private tags. Lists SHOULD NOT mix different tags (ie. 'p' tags can't be included in the same list as 'e' tags).

Commonly established parameters for this kind are:
- `mute` - an encrypted list of 'p' tags (or pubkeys) that the user wants to mute
- `follow` - an encrypted list of 'p' tags (or pubkeys) that the user wants to follow secretly
- `hashtag` - an encrypted list of `t` tags (or hashtag) that the user wants to follow
- `event` - an encrypted list of `e` tags (or event id) that the user wants to follow
This event kind would follow [NIP-33 - Parameterized Replaceable Events](33.md). The parameter of this kind would follow a convention of `<tag type>:<list name>` to allow for searching for lists by the type of items in the list.

Outside of the commonly established parameters users should be allowed to create encrypted lists with custom named parameters. This would allow users to group pubkeys, events, and hashtags into customized lists.
Commonly established list names for this kind are:
- `mute` - a list of items the user wants to mute
- `follow` - a list of items the user wants to follow

Each tag entry should contain the key for the profile, a relay URL where events from that key can be found (can be set to an empty string if not needed), and a local name (or "petname") for that profile (can also be set to an empty string or not provided), i.e., `["p", <32-bytes hex key>, <main relay URL>, <petname>]`. The `content` can be anything and should be ignored.
These commonly established list names can then be used for any event type being included in a list. For example `p:mute` would be a list of users to mute (because 'p' tags a user pubkey), `e:mute` would be a list of events to mute (because 'e' tags an event, `t:mute` would be a list of hashtags to mute (because 't' tags a hashtag). Similarly there will be `p:follow`, `e:follow`, and `t:follow`.

Outside of the commonly established list names users should be allowed to create lists with custom names. This would allow users to group pubkeys, events, and hashtags into customized lists, both in a public and private format.

For example, for a user with these keys (this is a dummy user for encryption validation):
- private: 4808aef8fd1450b48890ccd9e5cae06bbb3a49183e21ed0a61507b4389502c47
- public: 400fccf04bd150535af4922c77af41bc5e6c6b027b42011602763e2cabcce8d7

wants to put this list of users:
wanting to privately put this list of users:
```json
[
["p", "2df69cd0c6ab95e08f466abe7b39bb64e744ee31ffc3041f270bdfec2a37ec06"],
Expand All @@ -31,14 +31,31 @@ wants to put this list of users:
["p", "8c0da4862130283ff9e67d889df264177a508974e2feb96de139804ea66d6168"]
]
```
into a `mute` encrypted list, the list would be encrypted and put into the content of an event like this:
into a `mute` list, the list would be encrypted and put into the content of an event like this:

```json
{
"pubkey": "400fccf04bd150535af4922c77af41bc5e6c6b027b42011602763e2cabcce8d7",
"kind": 30000,
"tags": [["d", "mute"]],
"tags": [["d", "p:mute"]],
"content": "NegqBhVmXbFyOt1jnxI4qh+rau4tLYEQ7t6C+x30GC3Q3KGecgbm/NPT5+yaUGsURurBospGsZX0lSXtC3GezzGMwDxUAOkIdwt75ru9IzMuNIYlx7u/p47iQPCv1MN2WUoSBe8V1AOpTC2LeIgroQaZ6TqEFOworQmIGedseYEmbBjMy/fdEd3BuNefrJQ6ii+VXFfLXw3fl6Xac3Lsz+yrUT2X0lPdDOzcphv0wir0CZ/xMAvwvOSxSgqgisa2qBb7a1jlvzQKxsaWOLsWo05Vkfhhu55P4Jtrd9YizEnp/Gq0pSsLMvcgyiX+0JJx36uj968IieEP1H+PmnV9B1O2IAS9xSn+ijElomSr7qtsaxRpdpuRfRl5IyCdHXr+JvJLONODpoH71FnggEC/nw==?iv=FgtaQbOfA60Uzo6a4EE3kQ==",
...other fields
}
```
Alternatively, if the user wanted to publicly put this list of users into a `mute` list the event would look like this:
```json
{
"pubkey": "400fccf04bd150535af4922c77af41bc5e6c6b027b42011602763e2cabcce8d7",
"kind": 30000,
"tags": [
["d", "p:mute"],
["p", "2df69cd0c6ab95e08f466abe7b39bb64e744ee31ffc3041f270bdfec2a37ec06"],
["p", "3bf0c63fcb93463407af97a5e5ee64fa883d107ef9e558472c4eb9aaaefa459d"],
["p", "32e1827635450ebb3c5a7d12c1f8e7b2b514439ac10a67eef3d9fd9c5c68e245"],
["p", "8c0da4862130283ff9e67d889df264177a508974e2feb96de139804ea66d6168"]
],
"content": "",
...other fields
}
```

0 comments on commit 13a71ea

Please sign in to comment.