upleb.uk

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

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--26.md50
1 files changed, 43 insertions, 7 deletions
diff --git a/26.md b/26.md
index 0131c46..7ccf453 100644
--- a/26.md
+++ b/26.md
@@ -4,25 +4,61 @@ NIP-26
4Relays List 4Relays List
5----------- 5-----------
6 6
7`draft` `optional` `author:fiatjaf` 7`draft` `optional` `author:fiatjaf` `author:cameri`
8 8
9A special event with kind `10001`, meaning "relay list" is defined as having a list of tags, one for each relay the author uses. 9A special event with kind `10001`, meaning "relay list" is defined as having a list of tags, one for each relay the author uses.
10 10
11The content is not used. 11The content is not used.
12 12
13The tags consist of arrays of 3 elements: the first is the relay URL, the second is the "read" condition -- which if set `"true"` means the client is reading events from that relay --, the third is the "write" condition -- which if set to `"true"` means the user is writing events to that relay. 13The tags consist of arrays of 3 elements: the first is the relay URL, the second is the "read" condition, the third is the "write" condition.
14 14
15In the future this NIP will be modified with more fine-grained conditions for writing and reading from relays, based on properties of the filter or of the event respectively, written as strings in a simple language. 15The "read" condition consists of a string containing a rule that follows a subset of the [runes](https://pypi.org/project/runes/) language. Specifically only the `|`, `&`, `!`, `>`, `<`, and `=` operators are allowed. When the rule is an empty string it evaluates to `true`. When it consists of a single naked `"!"` it evaluates to `false`. The `#` specifically must not be interpreted as a comment, but always as a tag attribute. All the operatores must be tested against all possible values in the case of filter values that consist of lists of values and also in the case of event tags that can have multiple values for the same tag -- in other words, the `=` may be interpreted as a `values.any(v => v == runeValue)` instead of an `values == runeValue` operator; the `<` may be interpreted as a `values.any(v => v < runeValue)` and so on. In the case of events tags must also be identified by the `#` prefix, just like in filters.
16 16
17Example: 17The `read` rule operates on the values of the [NIP-01](01.md) **filter** object, while the `write` rule operates on the values of the **event** object.
18
19When a `read` rule evaluates to `true` for a given **filter** the client SHOULD send a `REQ` message to the relay, otherwise it SHOULD NOT. When a `write` rule evaluates to `true` for a given **event** the client SHOULD send that event (in a `EVENT` message) to the relay, otherwise it MUST NOT.
20
21### Examples
22
23(Public keys are shortened to 3 characters for readability.)
24
25- Rule evaluation examples:
26
27 - **read**
28
29 - for the filter `{"kinds": [0, 1, 2, 3], "authors": ["abcd", "1234"]}`
30
31 - `<empty>`: `true`
32 - `!`: `false`
33 - `authors=7890`: `false`
34 - `authors=7890|authors=1234`: `true`
35 - `authors=7890&authors=1234`: `false`
36 - `#e!`: `true`
37 - `#e=5555`: `false`
38 - `kinds=1|kinds=4`: `true`
39 - `kinds<2`: `true`
40 - `kinds>7`: `false`
41
42 - **write**
43
44 - for the event `{"kind": 7, "content": "banana", "tags": ["p", "6677"], "created_at": 123456789, "pubkey": "e3e3"}`
45
46 - `<empty>`: `true`
47 - `!`: `false`
48 - `pubkey=7890`: `false`
49 - `pubkey=e3e3`: `true`
50 - `kind=7&#p=6677`: `true`
51 - `created_at>999999999|#e=5a5a`: `false`
52
53- Full example of a kind 10001 event:
18 54
19```json 55```json
20{ 56{
21 "kind": 10001, 57 "kind": 10001,
22 "tags": [ 58 "tags": [
23 ["wss://alicerelay.com/", "true", "false"], 59 ["wss://alicerelay.com/", "#", ""],
24 ["wss://bobrelay.com/", "true", "true"], 60 ["wss://bobrelay.com/", "authors=ef87", "#"],
25 ["wss://carolrelay.com/", "false", "true"], 61 ["wss://carolrelay.com/", "#", "#"],
26 ], 62 ],
27 "content": "", 63 "content": "",
28 ...other fields 64 ...other fields