diff options
| author | Leo Wandersleb <leo@leowandersleb.de> | 2022-08-04 00:06:25 -0400 |
|---|---|---|
| committer | fiatjaf <fiatjaf@gmail.com> | 2022-08-04 06:01:23 -0300 |
| commit | 01931bd643e549a2327cc13c1cad24af2321d939 (patch) | |
| tree | 99a81688ea586912c8596500a44451fa32224383 | |
| parent | db5b671f3e2d6fca7388fcc387a6f8fb3d06885c (diff) | |
improve wording
| -rw-r--r-- | 21.md | 8 |
1 files changed, 4 insertions, 4 deletions
| @@ -6,15 +6,15 @@ Non-public encrypted messages | |||
| 6 | 6 | ||
| 7 | `draft` `optional` `author:fiatjaf` | 7 | `draft` `optional` `author:fiatjaf` |
| 8 | 8 | ||
| 9 | This NIP defines a method for relays to verify the identity of the client that is requesting ["encrypted directed messages"](04.md) messages and only allow these clients to see messages authored by them or targeted to them. | 9 | This NIP defines a method for relays to verify the identity of the client that is requesting ["encrypted directed messages"](04.md) and only allow these clients to see messages authored by them or intended for them. |
| 10 | 10 | ||
| 11 | When connecting to relays that support this NIP, clients SHOULD send a an event of kind `20001`, meaning "client identification", with the content set to `"client identification for <relay hostname>"`. | 11 | When connecting to relays that support this NIP, clients SHOULD send an event of kind `20001`, meaning "client identification", with the content set to `"client identification for <relay hostname>"`. |
| 12 | 12 | ||
| 13 | The relay MUST then use the event to verify the identity of the client and discard it afterwards. In the verification process the relay MUST check: | 13 | The relay MUST then use the event to verify the identity of the client and discard it afterwards. In the verification process the relay MUST check: |
| 14 | 14 | ||
| 15 | 1. if event signature is valid; | 15 | 1. if event signature is valid; |
| 16 | 2. if the content phrase matches the canonical phrase with the actual relay hostname in it; | 16 | 2. if the content phrase matches the canonical phrase with the actual relay hostname in it; |
| 17 | 3. if the event timestamp is not too far from the relay current timestamp. | 17 | 3. if the event timestamp is not too far from the relay's current timestamp. |
| 18 | 18 | ||
| 19 | If all is well, then the relay can use the identified pubkey to validate further requests for kind-4 events and only return kind-4 events that were either authored by the identified pubkey (`"pubkey": ...`) or are addressed to the identified pubkey (`"tags": ["p", ...]`). | 19 | If all is well, then the relay can use the identified pubkey to validate further requests for kind-4 events and only return kind-4 events that were either authored by the identified pubkey (`"pubkey": ...`) or are addressed to the identified pubkey (`"tags": ["p", ...]`). |
| 20 | 20 | ||
| @@ -23,7 +23,7 @@ If all is well, then the relay can use the identified pubkey to validate further | |||
| 23 | 1. Client connects to `wss://chat.relay.nostr.com/` | 23 | 1. Client connects to `wss://chat.relay.nostr.com/` |
| 24 | 2. Client sends `["EVENT", {"id": "...", "pubkey": "aeae...", "sig": "...", "kind": 20001, "tags": [], "created_at": 1609470000, "content": "client identification for chat.relay.nostr.com"}]` | 24 | 2. Client sends `["EVENT", {"id": "...", "pubkey": "aeae...", "sig": "...", "kind": 20001, "tags": [], "created_at": 1609470000, "content": "client identification for chat.relay.nostr.com"}]` |
| 25 | 3. Client sends `["REQ", "my-dms", {"kinds": [4], "#p": ["aeae..."]}, {"kinds": [4],"authors": ["aeae"]}]` | 25 | 3. Client sends `["REQ", "my-dms", {"kinds": [4], "#p": ["aeae..."]}, {"kinds": [4],"authors": ["aeae"]}]` |
| 26 | 5. Relay sends `["EVENT", "my-dms", {"id": "...", "pubkey": "aeae", "kind": 4, "content": "<encrypted>", "sig": "...", "tags": ["p", "786b..."]}]` | 26 | 5. Relay sends `["EVENT", "my-dms", {"id": "...", "pubkey": "aeae...", "kind": 4, "content": "<encrypted>", "sig": "...", "tags": ["p", "786b..."]}]` |
| 27 | 5. Relay sends `["EVENT", "my-dms", {"id": "...", "pubkey": "786b...", "kind": 4, "content": "<encrypted>", "sig": "...", "tags": ["p", "aeae..."]}]` | 27 | 5. Relay sends `["EVENT", "my-dms", {"id": "...", "pubkey": "786b...", "kind": 4, "content": "<encrypted>", "sig": "...", "tags": ["p", "aeae..."]}]` |
| 28 | 28 | ||
| 29 | Ids and signatures omitted and pubkeys shortened for readability. | 29 | Ids and signatures omitted and pubkeys shortened for readability. |