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>2024-11-25 13:21:47 -0300
committerGitHub <noreply@github.com>2024-11-25 13:21:47 -0300
commit73f65133fcdcbf9f4d27cc7097963797c6250cd7 (patch)
tree71f2d1a3234e17071f96eadea015d28ce62d1f3b
parente145577b0b1f54c45b4485cd841fbb4655d589c9 (diff)
add NIP-86: Relay Management API (#1325)
Co-authored-by: Alex Gleason <alex@alexgleason.me>
-rw-r--r--86.md90
-rw-r--r--README.md1
2 files changed, 91 insertions, 0 deletions
diff --git a/86.md b/86.md
new file mode 100644
index 0000000..6f64eee
--- /dev/null
+++ b/86.md
@@ -0,0 +1,90 @@
1NIP-86
2======
3
4Relay Management API
5--------------------
6
7`draft` `optional`
8
9Relays may provide an API for performing management tasks. This is made available as a JSON-RPC-like request-response protocol over HTTP, on the same URI as the relay's websocket.
10
11When a relay receives an HTTP(s) request with a `Content-Type` header of `application/nostr+json+rpc` to a URI supporting WebSocket upgrades, it should parse the request as a JSON document with the following fields:
12
13```json
14{
15 "method": "<method-name>",
16 "params": ["<array>", "<of>", "<parameters>"]
17}
18```
19
20Then it should return a response in the format
21
22```json
23{
24 "result": {"<arbitrary>": "<value>"},
25 "error": "<optional error message, if the call has errored>"
26}
27```
28
29This is the list of **methods** that may be supported:
30
31* `supportedmethods`:
32 - params: `[]`
33 - result: `["<method-name>", "<method-name>", ...]` (an array with the names of all the other supported methods)
34* `banpubkey`:
35 - params: `["<32-byte-hex-public-key>", "<optional-reason>"]`
36 - result: `true` (a boolean always set to `true`)
37* `listbannedpubkeys`:
38 - params: `[]`
39 - result: `[{"pubkey": "<32-byte-hex>", "reason": "<optional-reason>"}, ...]`, an array of objects
40* `allowpubkey`:
41 - params: `["<32-byte-hex-public-key>", "<optional-reason>"]`
42 - result: `true` (a boolean always set to `true`)
43* `listallowedpubkeys`:
44 - params: `[]`
45 - result: `[{"pubkey": "<32-byte-hex>", "reason": "<optional-reason>"}, ...]`, an array of objects
46* `listeventsneedingmoderation`:
47 - params: `[]`
48 - result: `[{"id": "<32-byte-hex>", "reason": "<optional-reason>"}]`, an array of objects
49* `allowevent`:
50 - params: `["<32-byte-hex-event-id>", "<optional-reason>"]`
51 - result: `true` (a boolean always set to `true`)
52* `banevent`:
53 - params: `["<32-byte-hex-event-id>", "<optional-reason>"]`
54 - result: `true` (a boolean always set to `true`)
55* `listbannedevents`:
56 - params: `[]`
57 - result: `[{"id": "<32-byte hex>", "reason": "<optional-reason>"}, ...]`, an array of objects
58* `changerelayname`:
59 - params: `["<new-name>"]`
60 - result: `true` (a boolean always set to `true`)
61* `changerelaydescription`:
62 - params: `["<new-description>"]`
63 - result: `true` (a boolean always set to `true`)
64* `changerelayicon`:
65 - params: `["<new-icon-url>"]`
66 - result: `true` (a boolean always set to `true`)
67* `allowkind`:
68 - params: `[<kind-number>]`
69 - result: `true` (a boolean always set to `true`)
70* `disallowkind`:
71 - params: `[<kind-number>]`
72 - result: `true` (a boolean always set to `true`)
73* `listallowedkinds`:
74 - params: `[]`
75 - result: `[<kind-number>, ...]`, an array of numbers
76* `blockip`:
77 - params: `["<ip-address>", "<optional-reason>"]`
78 - result: `true` (a boolean always set to `true`)
79* `unblockip`:
80 - params: `["<ip-address>"]`
81 - result: `true` (a boolean always set to `true`)
82* `listblockedips`:
83 - params: `[]`
84 - result: `[{"ip": "<ip-address>", "reason": "<optional-reason>"}, ...]`, an array of objects
85
86### Authorization
87
88The request must contain an `Authorization` header with a valid [NIP-98](./98.md) event, except the `payload` tag is required. The `u` tag is the relay URL.
89
90If `Authorization` is not provided or is invalid, the endpoint should return a 401 response.
diff --git a/README.md b/README.md
index 5d1a47d..9ef9fec 100644
--- a/README.md
+++ b/README.md
@@ -86,6 +86,7 @@ They exist to document what may be implemented by [Nostr](https://github.com/nos
86- [NIP-75: Zap Goals](75.md) 86- [NIP-75: Zap Goals](75.md)
87- [NIP-78: Application-specific data](78.md) 87- [NIP-78: Application-specific data](78.md)
88- [NIP-84: Highlights](84.md) 88- [NIP-84: Highlights](84.md)
89- [NIP-86: Relay Management API](86.md)
89- [NIP-89: Recommended Application Handlers](89.md) 90- [NIP-89: Recommended Application Handlers](89.md)
90- [NIP-90: Data Vending Machines](90.md) 91- [NIP-90: Data Vending Machines](90.md)
91- [NIP-92: Media Attachments](92.md) 92- [NIP-92: Media Attachments](92.md)