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 17:01:41 -0300
committerfiatjaf <fiatjaf@gmail.com>2024-02-23 20:51:46 -0300
commit513644d9204c209ad4b146c612e742042c868e38 (patch)
treea23916bceef5ed4b6cdba357b95e26be393ff933
parenta91798ba396535878005045039885a8e059dd189 (diff)
flesh out the entire thing.
-rw-r--r--29.md40
1 files changed, 30 insertions, 10 deletions
diff --git a/29.md b/29.md
index 65517da..dfe7bee 100644
--- a/29.md
+++ b/29.md
@@ -8,21 +8,35 @@ Relay-based Groups
8 8
9This NIP defines a standard for groups that are only writable by a closed set of users. They can be public for reading by external users or not. 9This NIP defines a standard for groups that are only writable by a closed set of users. They can be public for reading by external users or not.
10 10
11Groups are identified by a random string of any length that serves as an _id_.
12
13There is no way to create a group, what happens is just that relays (most likely when asked by users) create rules around some specific ids so these ids can serve as an actual group, henceforth messages sent to that group will be subject to these rules.
14
15Normally a group will originally belong to one specific relay, but the community may choose to move the group to other relays or even fork the group so it exists in different forms -- still using the same _id_ -- across different relays.
16
17## Relay-generated events
18
19Relays 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.
20
21## The `h` tag
22
23Events sent by users to groups (chat messages, text notes, moderation events etc) must have an `h` tag with the value set to the group _id_.
24
11## Timeline references 25## Timeline references
12 26
13In order to not be used out of context, events sent to these groups may contain a reference to previous events seen from the same relay. 27In order to not be used out of context, events sent to these groups may contain references to previous events seen from the same relay in the `previous` tag. The choice of which previous events to pick belongs to the clients.
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.
14 30
15## Trimmed signatures 31## Trimmed signatures
16 32
17For private groups that are not intended to be read by external users, relays must strip the signatures before sending the events to clients. 33Relays must strip the signature of messages in groups that are `private` so they do not leak.
18 34
19### Event definitions 35### Event definitions
20 36
21- *text note* (`kind:11`) 37- *text note* (`kind:11`)
22 38
23This is the basic unit of a text note sent to a group. 39This is the basic unit of a "microblog" text note sent to a group.
24
25It must commit in the `h` tag to the subgroup path and may also commit to up to the last 3 events of the same kind seen in the group.
26 40
27```js 41```js
28 "kind": 11, 42 "kind": 11,
@@ -36,7 +50,7 @@ It must commit in the `h` tag to the subgroup path and may also commit to up to
36 50
37- *chat message* (`kind:9`) 51- *chat message* (`kind:9`)
38 52
39Similar to kind 11, this is the basic unit of a chat message sent to a group. 53Similar to `kind:11`, this is the basic unit of a chat message sent to a group.
40 54
41```js 55```js
42 "kind": 9, 56 "kind": 9,
@@ -67,6 +81,8 @@ If this event does not exist, the group should be identified in the client UI by
67} 81}
68``` 82```
69 83
84The [NIP-19](19.md) `naddr` pointer for this event including with a mandatory relay can be used as the canonical group identifier.
85
70- *group admins* (`kind:39001`) (optional) 86- *group admins* (`kind:39001`) (optional)
71 87
72Each admin gets a label that is only used for display purposes, and a list of permissions it has are listed afterwards. These permissions can inform client building UI, but ultimately are evaluated by the relay in order to become effective. 88Each admin gets a label that is only used for display purposes, and a list of permissions it has are listed afterwards. These permissions can inform client building UI, but ultimately are evaluated by the relay in order to become effective.
@@ -86,23 +102,27 @@ The list of capabilities, as defined by this NIP, for now, is the following:
86 "content": "list of admins for the pizza lovers group", 102 "content": "list of admins for the pizza lovers group",
87 "tags": [ 103 "tags": [
88 ["d", "<group-id>"], 104 ["d", "<group-id>"],
89 ["<pubkey1-as-hex>", "admin", "add-user", "edit-metadata", "delete-event", "ban-user"], 105 ["<pubkey1-as-hex>", "ceo", "add-user", "edit-metadata", "delete-event", "ban-user"],
90 ["<pubkey2-as-hex>", "mod", "add-user", "delete-event"] 106 ["<pubkey2-as-hex>", "secretary", "add-user", "delete-event"]
91 ] 107 ]
92 ... 108 ...
93} 109}
94``` 110```
95 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
96- *moderation event* (`kind:9000`) (optional) 116- *moderation event* (`kind:9000`) (optional)
97 117
98An event sent from a client to the relay in order to accomplish a moderation action. 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. This is similar to the `kind:9` event in its structure. 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.
99 119
100```js 120```js
101{ 121{
102 "kind": 9000, 122 "kind": 9000,
103 "content": "action description and/or reason", 123 "content": "action description and/or reason",
104 "tags": [ 124 "tags": [
105 ["g", "<group-id>"], 125 ["h", "<group-id>"],
106 ["action", "add-user", "<pubkey-to-add>"], 126 ["action", "add-user", "<pubkey-to-add>"],
107 ["action", "ban-user", "<pubkey-to-ban>"], 127 ["action", "ban-user", "<pubkey-to-ban>"],
108 ["action", "edit-metadata", "<field-name>", "<field-value>"], 128 ["action", "edit-metadata", "<field-name>", "<field-value>"],