From 0bcdd7a07953d3c34d5eb0da1921f1c19050e86b Mon Sep 17 00:00:00 2001 From: hodlbod Date: Mon, 29 Jun 2026 11:11:05 -0700 Subject: [PATCH] Add relay roles event (#2390) --- 43.md | 38 ++++++++++++++++++++++++++++++++++++-- 86.md | 15 +++++++++++++++ 2 files changed, 51 insertions(+), 2 deletions(-) diff --git a/43.md b/43.md index 3b77d6c5..1e74d5df 100644 --- a/43.md +++ b/43.md @@ -8,6 +8,40 @@ Relay Access Metadata and Requests This NIP defines a way for relays to advertise membership lists, and for clients to request admission to relays on behalf of users. +## Role Definitions + +Relays MAY publish a `kind 33534` event which defines a role which may be assigned to members. This event MUST be signed by the pubkey specified in the `self` field of the relay's [NIP 11](./11.md) document. + +The following tags are required: + +- A [NIP 70](./70.md) `-` tag +- The event's `d` tag defines the role id. + +The following tags are optional: + +- `label` - a label for the role. +- `description` - a description of the role. +- `color` - a `hue` value from `0` to `360` for the role. +- `order` - a `order` integer for the role (for client display only). + +```yaml +{ + "kind": 33534, + "pubkey": "", + "tags": [ + ["-"], + ["d", "28b7e50f"], + ["label", "king"], + ["description", "ruler of the relay"], + ["color", "37"], + ["order", "1"], + ], + // ...other fields +} +``` + +Relays MAY treat members with a given role differently in terms of relay access policies, but no mechanism for introspection is defined at this time. + ## Membership Lists Relays MAY publish a `kind 13534` event which indicates pubkeys that have access to a given relay. This event MUST be signed by the pubkey specified in the `self` field of the relay's [NIP 11](./11.md) document. @@ -15,7 +49,7 @@ Relays MAY publish a `kind 13534` event which indicates pubkeys that have access The following tags are required: - A [NIP 70](./70.md) `-` tag -- A `member` tag containing a hex pubkey should be included for each member +- A `member` tag containing a hex pubkey should be included for each member. Assigned roles may be included as subsequent arguments. This list should not be considered exhaustive or authoritative. To determine membership, both a `kind 13534` event by the relay, and a `kind 10010` event by the member should be consulted. @@ -28,7 +62,7 @@ Example: "tags": [ ["-"], ["member", "c308e1f882c1f1dff2a43d4294239ddeec04e575f2d1aad1fa21ea7684e61fb5"], - ["member", "ee1d336e13779e4d4c527b988429d96de16088f958cbf6c074676ac9cfd9c958"] + ["member", "ee1d336e13779e4d4c527b988429d96de16088f958cbf6c074676ac9cfd9c958", "28b7e50f"] ], // ...other fields } diff --git a/86.md b/86.md index b9a8cc24..ffc4423e 100644 --- a/86.md +++ b/86.md @@ -49,6 +49,21 @@ This is the list of **methods** that may be supported: * `listallowedpubkeys`: - params: `[]` - result: `[{"pubkey": "<32-byte-hex>", "reason": ""}, ...]`, an array of objects +* `createrole`: + - params: `[id, label, description, color, order]` + - result: `true` (boolean true) +* `editrole`: + - params: `[id, label, description, color, order]` + - result: `true` (boolean true) +* `deleterole`: + - params: `[id]` + - result: `true` (boolean true) +* `assignrole`: + - params: `["<32-byte-hex-public-key>", ""]` + - result: `true` (a boolean always set to `true`) +* `unassignrole`: + - params: `["<32-byte-hex-public-key>", ""]` + - result: `true` (a boolean always set to `true`) * `listeventsneedingmoderation`: - params: `[]` - result: `[{"id": "<32-byte-hex>", "reason": ""}]`, an array of objects