Skip to content

Commit e8faa8b

Browse files
author
Jonathan Staab
committed
Add NIP 43 for joining relays using a claim
1 parent 1cda2dc commit e8faa8b

1 file changed

Lines changed: 68 additions & 0 deletions

File tree

‎43.md‎

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
NIP-43
2+
======
3+
4+
Relay Access Requests
5+
---------------------
6+
7+
`draft` `optional`
8+
9+
This NIP defines a way for clients to request admission to relays enforcing
10+
authentication as defined in NIP 42 by signing an ephemeral event.
11+
12+
## Claim Event
13+
14+
This NIP defines kind `28934` events which are intended to allow clients to
15+
request admission to a relay. It MUST have a `claim` tag containing an invoice,
16+
invite code, or any other arbitrary string.
17+
18+
The event's `created_at` MUST be now, plus or minus a few minutes. Clients MAY
19+
send a claim at any time, but MUST check for relay support via NIP 11. This is
20+
to avoid non-compliant relays broadcasting invites to subscribers.
21+
22+
This event should be sent to a relay using the standard `EVENT` verb.
23+
24+
```jsonc
25+
{
26+
"kind": 28934,
27+
"tags": [
28+
["claim", "<invoice id, invite code, or something else>"]
29+
],
30+
// ...other fields
31+
}
32+
```
33+
34+
## Relay response
35+
36+
Upon receiving a claim, a relay MUST notify the client as to what the status
37+
of the claim is using an `OK` message. Failed claims SHOULD use the same
38+
standard `"restricted: "` prefix specified by NIP 42.
39+
40+
Some examples:
41+
42+
```
43+
["OK", <event-id>, false, "restricted: That invoice is expired."]
44+
["OK", <event-id>, false, "restricted: That is an unsupported claim."]
45+
["OK", <event-id>, true, "claim-ignored: You are already a member of this relay."]
46+
["OK", <event-id>, true, "claim-accepted: Welcome to wss://relay.bunk.skunk!"]
47+
```
48+
49+
## Claim Request
50+
51+
Users may request a claim string from a relay by making a request for `kind 28935`
52+
events. These events MUST NOT be considered valid unless signed by the same pubkey
53+
as exists in the relay's NIP 11 document.
54+
55+
```jsonc
56+
{
57+
"kind": 28935,
58+
"tags": [
59+
["claim", "<invoice, invite code, or something else>"]
60+
],
61+
// ...other fields
62+
}
63+
```
64+
65+
Note that these events are in the `ephemeral` range, which means relays must explicitly
66+
opt-in to this behavior by generating claims on the fly when requested. This allows relays
67+
to improve security by issuing a different claim for each request, only issuing claims
68+
to certain users, or expiring claims.

0 commit comments

Comments
 (0)