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:
authorPablo Fernandez <p@f7z.io>2023-11-23 17:52:48 +0200
committerGitHub <noreply@github.com>2023-11-23 17:52:48 +0200
commit60256a62675a165c4d4fd9811a19a9cbf6a9e7fd (patch)
tree5c450154d373caafc37f324dd01e20338308c9d6 /42.md
parent43d50ee42409252a1313928cd437d55fd7bf7bf4 (diff)
parent7822a8b12670312aff104ddc03066425882f739d (diff)
Merge branch 'master' into nip88
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