diff options
| author | Kieran <kieran@harkin.me> | 2024-10-15 11:15:54 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-15 11:15:54 +0100 |
| commit | 1e2f19863ca56754daa2466881eb22087a71b17d (patch) | |
| tree | 4f7be759dce290fea1d3ae10c403260b466ee16c /29.md | |
| parent | 53afaaece61f02e92b5ef9c3e9c32945c7ebf522 (diff) | |
| parent | e381b577c997b849fa544eea7dc9f08b360b4a33 (diff) | |
Merge branch 'master' into nip71-imeta
Diffstat (limited to '29.md')
| -rw-r--r-- | 29.md | 45 |
1 files changed, 31 insertions, 14 deletions
| @@ -16,7 +16,7 @@ Normally a group will originally belong to one specific relay, but the community | |||
| 16 | 16 | ||
| 17 | ## Relay-generated events | 17 | ## Relay-generated events |
| 18 | 18 | ||
| 19 | Relays are supposed to generate the events that describe group metadata and group admins. These are parameterized replaceable events signed by the relay keypair directly, with the group _id_ as the `d` tag. | 19 | Relays are supposed to generate the events that describe group metadata and group admins. These are _addressable_ events signed by the relay keypair directly, with the group _id_ as the `d` tag. |
| 20 | 20 | ||
| 21 | ## Group identifier | 21 | ## Group identifier |
| 22 | 22 | ||
| @@ -42,14 +42,14 @@ Relays should prevent late publication (messages published now with a timestamp | |||
| 42 | 42 | ||
| 43 | This is the basic unit of a "microblog" root text note sent to a group. | 43 | This is the basic unit of a "microblog" root text note sent to a group. |
| 44 | 44 | ||
| 45 | ```js | 45 | ```jsonc |
| 46 | "kind": 11, | 46 | "kind": 11, |
| 47 | "content": "hello my friends lovers of pizza", | 47 | "content": "hello my friends lovers of pizza", |
| 48 | "tags": [ | 48 | "tags": [ |
| 49 | ["h", "<group-id>"], | 49 | ["h", "<group-id>"], |
| 50 | ["previous", "<event-id-first-chars>", "<event-id-first-chars>", ...] | 50 | ["previous", "<event-id-first-chars>", "<event-id-first-chars>", /*...*/] |
| 51 | ] | 51 | ] |
| 52 | ... | 52 | // other fields... |
| 53 | ``` | 53 | ``` |
| 54 | 54 | ||
| 55 | - *threaded text reply* (`kind:12`) | 55 | - *threaded text reply* (`kind:12`) |
| @@ -63,14 +63,14 @@ This is the basic unit of a "microblog" reply note sent to a group. It's the sam | |||
| 63 | 63 | ||
| 64 | This is the basic unit of a _chat message_ sent to a group. | 64 | This is the basic unit of a _chat message_ sent to a group. |
| 65 | 65 | ||
| 66 | ```js | 66 | ```jsonc |
| 67 | "kind": 9, | 67 | "kind": 9, |
| 68 | "content": "hello my friends lovers of pizza", | 68 | "content": "hello my friends lovers of pizza", |
| 69 | "tags": [ | 69 | "tags": [ |
| 70 | ["h", "<group-id>"], | 70 | ["h", "<group-id>"], |
| 71 | ["previous", "<event-id-first-chars>", "<event-id-first-chars>", ...] | 71 | ["previous", "<event-id-first-chars>", "<event-id-first-chars>", /*...*/] |
| 72 | ] | 72 | ] |
| 73 | ... | 73 | // other fields... |
| 74 | ``` | 74 | ``` |
| 75 | 75 | ||
| 76 | - *chat message threaded reply* (`kind:10`) | 76 | - *chat message threaded reply* (`kind:10`) |
| @@ -83,7 +83,7 @@ Similar to `kind:12`, this is the basic unit of a chat message sent to a group. | |||
| 83 | 83 | ||
| 84 | Any user can send one of these events to the relay in order to be automatically or manually added to the group. If the group is `open` the relay will automatically issue a `kind:9000` in response adding this user. Otherwise group admins may choose to query for these requests and act upon them. | 84 | Any user can send one of these events to the relay in order to be automatically or manually added to the group. If the group is `open` the relay will automatically issue a `kind:9000` in response adding this user. Otherwise group admins may choose to query for these requests and act upon them. |
| 85 | 85 | ||
| 86 | ```js | 86 | ```json |
| 87 | { | 87 | { |
| 88 | "kind": 9021, | 88 | "kind": 9021, |
| 89 | "content": "optional reason", | 89 | "content": "optional reason", |
| @@ -93,17 +93,31 @@ Any user can send one of these events to the relay in order to be automatically | |||
| 93 | } | 93 | } |
| 94 | ``` | 94 | ``` |
| 95 | 95 | ||
| 96 | - *leave request* (`kind:9022`) | ||
| 97 | |||
| 98 | Any user can send one of these events to the relay in order to be automatically removed from the group. The relay will automatically issue a `kind:9001` in response removing this user. | ||
| 99 | |||
| 100 | ```json | ||
| 101 | { | ||
| 102 | "kind": 9022, | ||
| 103 | "content": "optional reason", | ||
| 104 | "tags": [ | ||
| 105 | ["h", "<group-id>"] | ||
| 106 | ] | ||
| 107 | } | ||
| 108 | ``` | ||
| 109 | |||
| 96 | - *moderation events* (`kinds:9000-9020`) (optional) | 110 | - *moderation events* (`kinds:9000-9020`) (optional) |
| 97 | 111 | ||
| 98 | Clients can send these events to a relay in order to accomplish a moderation action. Relays must check if the pubkey sending the event is capable of performing the given action. The relay may discard the event after taking action or keep it as a moderation log. | 112 | Clients can send these events to a relay in order to accomplish a moderation action. Relays must check if the pubkey sending the event is capable of performing the given action. The relay may discard the event after taking action or keep it as a moderation log. |
| 99 | 113 | ||
| 100 | ```js | 114 | ```json |
| 101 | { | 115 | { |
| 102 | "kind": 90xx, | 116 | "kind": 90xx, |
| 103 | "content": "optional reason", | 117 | "content": "optional reason", |
| 104 | "tags": [ | 118 | "tags": [ |
| 105 | ["h", "<group-id>"], | 119 | ["h", "<group-id>"], |
| 106 | ["previous", ...] | 120 | ["previous", /*...*/] |
| 107 | ] | 121 | ] |
| 108 | } | 122 | } |
| 109 | ``` | 123 | ``` |
| @@ -119,6 +133,8 @@ Each moderation action uses a different kind and requires different arguments, w | |||
| 119 | | 9004 | `remove-permission` | `p` (pubkey), `permission` (name) | | 133 | | 9004 | `remove-permission` | `p` (pubkey), `permission` (name) | |
| 120 | | 9005 | `delete-event` | `e` (id hex) | | 134 | | 9005 | `delete-event` | `e` (id hex) | |
| 121 | | 9006 | `edit-group-status` | `public` or `private`, `open` or `closed` | | 135 | | 9006 | `edit-group-status` | `public` or `private`, `open` or `closed` | |
| 136 | | 9007 | `create-group` | | | ||
| 137 | | 9008 | `delete-group` | | | ||
| 122 | 138 | ||
| 123 | - *group metadata* (`kind:39000`) (optional) | 139 | - *group metadata* (`kind:39000`) (optional) |
| 124 | 140 | ||
| @@ -126,7 +142,7 @@ This event defines the metadata for the group -- basically how clients should di | |||
| 126 | 142 | ||
| 127 | If the group is forked and hosted in multiple relays, there will be multiple versions of this event in each different relay and so on. | 143 | If the group is forked and hosted in multiple relays, there will be multiple versions of this event in each different relay and so on. |
| 128 | 144 | ||
| 129 | ```js | 145 | ```jsonc |
| 130 | { | 146 | { |
| 131 | "kind": 39000, | 147 | "kind": 39000, |
| 132 | "content": "", | 148 | "content": "", |
| @@ -138,7 +154,7 @@ If the group is forked and hosted in multiple relays, there will be multiple ver | |||
| 138 | ["public"], // or ["private"] | 154 | ["public"], // or ["private"] |
| 139 | ["open"] // or ["closed"] | 155 | ["open"] // or ["closed"] |
| 140 | ] | 156 | ] |
| 141 | ... | 157 | // other fields... |
| 142 | } | 158 | } |
| 143 | ``` | 159 | ``` |
| 144 | 160 | ||
| @@ -159,8 +175,9 @@ The list of capabilities, as defined by this NIP, for now, is the following: | |||
| 159 | - `add-permission` | 175 | - `add-permission` |
| 160 | - `remove-permission` | 176 | - `remove-permission` |
| 161 | - `edit-group-status` | 177 | - `edit-group-status` |
| 178 | - `delete-group` | ||
| 162 | 179 | ||
| 163 | ```js | 180 | ```json |
| 164 | { | 181 | { |
| 165 | "kind": 39001, | 182 | "kind": 39001, |
| 166 | "content": "list of admins for the pizza lovers group", | 183 | "content": "list of admins for the pizza lovers group", |
| @@ -169,7 +186,7 @@ The list of capabilities, as defined by this NIP, for now, is the following: | |||
| 169 | ["p", "<pubkey1-as-hex>", "ceo", "add-user", "edit-metadata", "delete-event", "remove-user"], | 186 | ["p", "<pubkey1-as-hex>", "ceo", "add-user", "edit-metadata", "delete-event", "remove-user"], |
| 170 | ["p", "<pubkey2-as-hex>", "secretary", "add-user", "delete-event"] | 187 | ["p", "<pubkey2-as-hex>", "secretary", "add-user", "delete-event"] |
| 171 | ] | 188 | ] |
| 172 | ... | 189 | // other fields... |
| 173 | } | 190 | } |
| 174 | ``` | 191 | ``` |
| 175 | 192 | ||