upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/42.md
diff options
context:
space:
mode:
authorSemisol <45574030+Semisol@users.noreply.github.com>2023-11-19 01:45:41 +0100
committerGitHub <noreply@github.com>2023-11-19 01:45:41 +0100
commitda19c078ab892b578a5c35968443205c9e8ac27f (patch)
tree17a9f4f3105acdae234d3bc67e42571aed261fa2 /42.md
parent4d709d1804de45bab3739ce814d4b0c0b211c273 (diff)
parent5dcfe85306434f21ecb1e7a47edd92b2e3e64f9a (diff)
Merge branch 'master' into clarify-json-serialization
Diffstat (limited to '42.md')
-rw-r--r--42.md16
1 files changed, 6 insertions, 10 deletions
diff --git a/42.md b/42.md
index 9b0c45b..e380e89 100644
--- a/42.md
+++ b/42.md
@@ -4,7 +4,7 @@ NIP-42
4Authentication of clients to relays 4Authentication of clients to relays
5----------------------------------- 5-----------------------------------
6 6
7`draft` `optional` `author:Semisol` `author:fiatjaf` 7`draft` `optional`
8 8
9This NIP defines a way for clients to authenticate to relays by signing an ephemeral event. 9This NIP defines a way for clients to authenticate to relays by signing an ephemeral event.
10 10
@@ -24,13 +24,13 @@ A relay may want to require clients to authenticate to access restricted resourc
24This NIP defines a new message, `AUTH`, which relays can send when they support authentication and clients can send to relays when they want 24This NIP defines a new message, `AUTH`, which relays can send when they support authentication and clients can send to relays when they want
25to authenticate. When sent by relays, the message is of the following form: 25to authenticate. When sent by relays, the message is of the following form:
26 26
27``` 27```json
28["AUTH", <challenge-string>] 28["AUTH", <challenge-string>]
29``` 29```
30 30
31And, when sent by clients, of the following form: 31And, when sent by clients, of the following form:
32 32
33``` 33```json
34["AUTH", <signed-event-json>] 34["AUTH", <signed-event-json>]
35``` 35```
36 36
@@ -41,16 +41,12 @@ Relays MUST exclude `kind: 22242` events from being broadcasted to any client.
41 41
42```json 42```json
43{ 43{
44 "id": "...",
45 "pubkey": "...",
46 "created_at": 1669695536,
47 "kind": 22242, 44 "kind": 22242,
48 "tags": [ 45 "tags": [
49 ["relay", "wss://relay.example.com/"], 46 ["relay", "wss://relay.example.com/"],
50 ["challenge", "challengestringhere"] 47 ["challenge", "challengestringhere"]
51 ], 48 ],
52 "content": "", 49 ...
53 "sig": "..."
54} 50}
55``` 51```
56 52
@@ -67,13 +63,13 @@ is expected to last for the duration of the WebSocket connection.
67Upon receiving a message from an unauthenticated user it can't fulfill without authentication, a relay may choose to notify the client. For 63Upon receiving a message from an unauthenticated user it can't fulfill without authentication, a relay may choose to notify the client. For
68that it can use a `NOTICE` or `OK` message with a standard prefix `"restricted: "` that is readable both by humans and machines, for example: 64that it can use a `NOTICE` or `OK` message with a standard prefix `"restricted: "` that is readable both by humans and machines, for example:
69 65
70``` 66```json
71["NOTICE", "restricted: we can't serve DMs to unauthenticated users, does your client implement NIP-42?"] 67["NOTICE", "restricted: we can't serve DMs to unauthenticated users, does your client implement NIP-42?"]
72``` 68```
73 69
74or it can return an `OK` message noting the reason an event was not written using the same prefix: 70or it can return an `OK` message noting the reason an event was not written using the same prefix:
75 71
76``` 72```json
77["OK", <event-id>, false, "restricted: we do not accept events from unauthenticated users, please sign up at https://example.com/"] 73["OK", <event-id>, false, "restricted: we do not accept events from unauthenticated users, please sign up at https://example.com/"]
78``` 74```
79 75