upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfiatjaf <fiatjaf@gmail.com>2023-11-10 22:24:11 -0300
committerfiatjaf <fiatjaf@gmail.com>2024-02-23 20:51:46 -0300
commit5551f1f57ae8b6a87d775620c4a835718998a8ca (patch)
treee96e7489f4829891c503fd16db320aa54f63ed5a
parent513644d9204c209ad4b146c612e742042c868e38 (diff)
saner approach with multiple kinds for moderation.
-rw-r--r--29.md58
1 files changed, 33 insertions, 25 deletions
diff --git a/29.md b/29.md
index dfe7bee..481e4f5 100644
--- a/29.md
+++ b/29.md
@@ -28,6 +28,10 @@ In order to not be used out of context, events sent to these groups may contain
28 28
29This is a hack to prevent messages from being broadcasted to external relays that have forks of one group out of context. Relays are expected to reject any events that contain timeline references to events not found in their own database. Clients must also check these to keep relays honest about them. 29This is a hack to prevent messages from being broadcasted to external relays that have forks of one group out of context. Relays are expected to reject any events that contain timeline references to events not found in their own database. Clients must also check these to keep relays honest about them.
30 30
31## Late publication
32
33Relays should prevent late publication (messages published now with a timestamp from days or even hours ago) unless they are open to receive a group forked or moved from another relay.
34
31## Trimmed signatures 35## Trimmed signatures
32 36
33Relays must strip the signature of messages in groups that are `private` so they do not leak. 37Relays must strip the signature of messages in groups that are `private` so they do not leak.
@@ -62,6 +66,33 @@ Similar to `kind:11`, this is the basic unit of a chat message sent to a group.
62 ... 66 ...
63``` 67```
64 68
69- *moderation events* (`kinds:5;9000-9020`) (optional)
70
71Clients 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.
72
73```js
74{
75 "kind": 90xx,
76 "content": "",
77 "tags": [
78 ["h", "<group-id>"],
79 ["alt", "optional action description and/or reason"],
80 ["previous", ...]
81 ]
82}
83```
84
85Each moderation action uses a different kind and requires different arguments, which are given as tags. These are defined in the following table:
86
87| kind | name | tags |
88| --- | --- | --- |
89| 5 | `delete-event` | `e` (id hex) |
90| 9000 | `add-user` | `p` (pubkey hex) |
91| 9001 | `remove-user` | `p` (pubkey hex) |
92| 9002 | `edit-metadata` | `name`, `about`, `picture` (string) |
93| 9003 | `add-permission` | `p` (pubkey), `permission` (name) |
94| 9004 | `remove-permission` | `p` (pubkey), `permission` (name) |
95
65- *group metadata* (`kind:39000`) (optional) 96- *group metadata* (`kind:39000`) (optional)
66 97
67If this event does not exist, the group should be identified in the client UI by its identifier (i.e. "/flavors" or "pizza.com/flavors"). All tags are optional. Having the `"private"` tag means the group cannot be read and relays will use [NIP-42](42.md) `AUTH` messages to control who can read from it. The `"closed"` tag means the group can be read by anyone but only explicitly whitelisted pubkeys are allowed to post, again these enforcements happen at the relay level. 98If this event does not exist, the group should be identified in the client UI by its identifier (i.e. "/flavors" or "pizza.com/flavors"). All tags are optional. Having the `"private"` tag means the group cannot be read and relays will use [NIP-42](42.md) `AUTH` messages to control who can read from it. The `"closed"` tag means the group can be read by anyone but only explicitly whitelisted pubkeys are allowed to post, again these enforcements happen at the relay level.
@@ -92,7 +123,7 @@ The list of capabilities, as defined by this NIP, for now, is the following:
92- `add-user` 123- `add-user`
93- `edit-metadata` 124- `edit-metadata`
94- `delete-event` 125- `delete-event`
95- `ban-user` 126- `remove-user`
96- `add-permission` 127- `add-permission`
97- `remove-permission` 128- `remove-permission`
98 129
@@ -102,32 +133,9 @@ The list of capabilities, as defined by this NIP, for now, is the following:
102 "content": "list of admins for the pizza lovers group", 133 "content": "list of admins for the pizza lovers group",
103 "tags": [ 134 "tags": [
104 ["d", "<group-id>"], 135 ["d", "<group-id>"],
105 ["<pubkey1-as-hex>", "ceo", "add-user", "edit-metadata", "delete-event", "ban-user"], 136 ["<pubkey1-as-hex>", "ceo", "add-user", "edit-metadata", "delete-event", "remove-user"],
106 ["<pubkey2-as-hex>", "secretary", "add-user", "delete-event"] 137 ["<pubkey2-as-hex>", "secretary", "add-user", "delete-event"]
107 ] 138 ]
108 ... 139 ...
109} 140}
110``` 141```
111
112- *deletion event* (`kind:5`) (optional)
113
114This is the same event as described in [NIP-09](09.md), the difference is that if there are admins with `delete-event` capability for the relevant group their `kind:5` events must be honored by the relays.
115
116- *moderation event* (`kind:9000`) (optional)
117
118An event sent from a client to the relay in order to accomplish a moderation action (except `delete-event`, as that is the job of `kind:5`). The relay should read this event and act on it if the user sending the event has the required permissions and the date is close to the current date. The relay may discard the event after taking action or keep it as a way to expose a moderation log.
119
120```js
121{
122 "kind": 9000,
123 "content": "action description and/or reason",
124 "tags": [
125 ["h", "<group-id>"],
126 ["action", "add-user", "<pubkey-to-add>"],
127 ["action", "ban-user", "<pubkey-to-ban>"],
128 ["action", "edit-metadata", "<field-name>", "<field-value>"],
129 ["action", "add-permission", "<pubkey>", "<permission>"],
130 ["action", "remove-permission", "<pubkey>", "<permission>"],
131 ]
132}
133```