diff --git a/86.md b/86.md new file mode 100644 index 0000000..6f64eee --- /dev/null +++ b/86.md @@ -0,0 +1,90 @@ +NIP-86 +====== + +Relay Management API +-------------------- + +`draft` `optional` + +Relays 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. + +When 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: + +```json +{ + "method": "", + "params": ["", "", ""] +} +``` + +Then it should return a response in the format + +```json +{ + "result": {"": ""}, + "error": "" +} +``` + +This is the list of **methods** that may be supported: + +* `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 + +### 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. + +If `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 - [NIP-75: Zap Goals](75.md) - [NIP-78: Application-specific data](78.md) - [NIP-84: Highlights](84.md) +- [NIP-86: Relay Management API](86.md) - [NIP-89: Recommended Application Handlers](89.md) - [NIP-90: Data Vending Machines](90.md) - [NIP-92: Media Attachments](92.md)