diff --git a/86.md b/86.md index 6f64eee7..b82631e1 100644 --- a/86.md +++ b/86.md @@ -17,7 +17,7 @@ When a relay receives an HTTP(s) request with a `Content-Type` header of `applic } ``` -Then it should return a response in the format +Then it should return a response in the below format: ```json { @@ -26,65 +26,159 @@ Then it should return a response in the format } ``` -This is the list of **methods** that may be supported: +## Standard Methods -* `supportedmethods`: - - params: `[]` - - result: `["", "", ...]` (an array with the names of all the other supported methods) -* `banpubkey`: - - params: `["<32-byte-hex-public-key>", ""]` - - result: `true` (a boolean always set to `true`) -* `listbannedpubkeys`: - - params: `[]` - - result: `[{"pubkey": "<32-byte-hex>", "reason": ""}, ...]`, an array of objects -* `allowpubkey`: - - params: `["<32-byte-hex-public-key>", ""]` - - result: `true` (a boolean always set to `true`) -* `listallowedpubkeys`: - - params: `[]` - - result: `[{"pubkey": "<32-byte-hex>", "reason": ""}, ...]`, an array of objects -* `listeventsneedingmoderation`: - - params: `[]` - - result: `[{"id": "<32-byte-hex>", "reason": ""}]`, an array of objects -* `allowevent`: - - params: `["<32-byte-hex-event-id>", ""]` - - result: `true` (a boolean always set to `true`) -* `banevent`: - - params: `["<32-byte-hex-event-id>", ""]` - - result: `true` (a boolean always set to `true`) -* `listbannedevents`: - - params: `[]` - - result: `[{"id": "<32-byte hex>", "reason": ""}, ...]`, an array of objects -* `changerelayname`: - - params: `[""]` - - result: `true` (a boolean always set to `true`) -* `changerelaydescription`: - - params: `[""]` - - result: `true` (a boolean always set to `true`) -* `changerelayicon`: - - params: `[""]` - - result: `true` (a boolean always set to `true`) -* `allowkind`: - - params: `[]` - - result: `true` (a boolean always set to `true`) -* `disallowkind`: - - params: `[]` - - result: `true` (a boolean always set to `true`) -* `listallowedkinds`: - - params: `[]` - - result: `[, ...]`, an array of numbers -* `blockip`: - - params: `["", ""]` - - result: `true` (a boolean always set to `true`) -* `unblockip`: - - params: `[""]` - - result: `true` (a boolean always set to `true`) -* `listblockedips`: - - params: `[]` - - result: `[{"ip": "", "reason": ""}, ...]`, an array of objects +Here is a list of **methods** that MAY be supported: + +* `supportedmethods`: + - **params:** `[]` + - **result:** `["", "", /* rest of method names... */ ]` + +Extra fields MAY be sent from the relay depending on implementation. + +--- + +* `stats`: + - **params:** `[]` + - **result:** + ```jsonc + { + "num_connections": , + "uptime": , + "bytes_received": , + "bytes_sent": , + "num_events": , + "event_bytes": , + "num_files": , + "file_bytes": + // and more... + } + ``` + +Extra fields MAY be sent from the relay depending on implementation. + +--- + +* `listeventsneedingmoderation`: + - **params:** `[]` + - **result:** `[{ "id": "<32-byte-hex>", "reason": "" }, ...]` + +Relay MAY return reported, muted profiles, and similar events as a result. + +--- + +* `banpubkey`: + - **params:** `["<32-byte-hex-public-key>", ""]` + - **result:** `true` (a boolean always set to `true`) + +The relay MAY remove events sent by `pubkey` and prevent new events from being written. + +--- + +* `listbannedpubkeys`: + - **params:** `[]` + - **result:** `[{"pubkey": "<32-byte-hex>", "reason": ""}, ...]` (an array of objects) + +--- + +* `allowpubkey`: + - **params:** `["<32-byte-hex-public-key>", ""]` + - **result:** `true` (a boolean always set to `true`) + +--- + +* `listallowedpubkeys`: + - **params:** `[]` + - **result:** `[{"pubkey": "<32-byte-hex>", "reason": ""}, ...]` (an array of objects) + +--- + +* `banevent`: + - **params:** `["<32-byte-hex-event-id>", ""]` + - **result:** `true` (a boolean always set to `true`) + +Relay SHOULD delete and prevent re-broadcasting of event. + +--- + +* `listbannedevents`: + - **params:** `[]` + - **result:** `[{"id": "<32-byte-hex>", "reason": ""}, ...]` (an array of objects) + +--- + +* `allowevent`: + - **params:** `["<32-byte-hex-event-id>", ""]` + - **result:** `true` (a boolean always set to `true`) + +--- + +* `listallowedevents`: + - **params:** `[]` + - **result:** `[{"id": "<32-byte-hex>", "reason": ""}, ...]` (an array of objects) + +--- + +* `allowkind`: + - **params:** `[]` + - **result:** `true` (a boolean always set to `true`) + +--- + +* `disallowkind`: + - **params:** `[]` + - **result:** `true` (a boolean always set to `true`) + +--- + +* `listdisallowedkinds`: + - **params:** `[]` + - **result:** `[, , /* and more... */]` (an array of objects) + +--- + +* `listallowedkinds`: + - **params:** `[]` + - **result:** `[, , /* and more... */]` (an array of objects) + +--- + +* `blockip`: + - **params:** `["", ""]` + - **result:** `true` (a boolean always set to `true`) + +--- + +* `unblockip`: + - **params:** `[""]` + - **result:** `true` (a boolean always set to `true`) + +--- + +* `listblockedips`: + - **params:** `[]` + - **result:** `[{"ip": "", "reason": ""}, ...]` (an array of objects) + +--- + +* `grantadmin`: + - **params:** `["<32-byte-hex-public-key>", { "allowed_methods": [...]}]` + - **result:** `true` (a boolean always set to `true`) + +If the admin right is already granted, the allowed methods list must be rewritten. + +--- + +* `revokeadmin`: + - **params:** `["<32-byte-hex-public-key>", { "disallowed_methods": [...]}]` + - **result:** `true` (a boolean always set to `true`) + +If the resulting `allowed_methods` list for admin was empty, admin can be removed. + +--- ### Authorization -The 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. +The 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. -If `Authorization` is not provided or is invalid, the endpoint should return a 401 response. +If `Authorization` is not provided or is invalid, the endpoint should return a response with a 401 status code.