diff options
| author | fiatjaf <fiatjaf@gmail.com> | 2023-01-04 10:24:37 -0300 |
|---|---|---|
| committer | fiatjaf <fiatjaf@gmail.com> | 2023-01-04 10:24:37 -0300 |
| commit | 50faceef0965042714e7f50a45b102f35c5231ca (patch) | |
| tree | 0aded45604ddf8888e9500197c7aa899ac698a6b | |
| parent | 4a5202646a86ce63a85a50b560d1a2fbce277df6 (diff) | |
clarify `created_at` and auth session duration.
| -rw-r--r-- | 42.md | 9 |
1 files changed, 5 insertions, 4 deletions
| @@ -43,7 +43,8 @@ WebSocket URL of the relay. `created_at` should be the current time. Example: | |||
| 43 | ``` | 43 | ``` |
| 44 | 44 | ||
| 45 | The client may send an auth message right before performing an action for which it knows authentication will be required -- for example, right | 45 | The client may send an auth message right before performing an action for which it knows authentication will be required -- for example, right |
| 46 | before requesting `kind: 4` chat messages --, or it may do right on connection start or at some other moment it deems best. | 46 | before requesting `kind: 4` chat messages --, or it may do right on connection start or at some other moment it deems best. The authentication |
| 47 | is expected to last for the duration of the WebSocket connection. | ||
| 47 | 48 | ||
| 48 | Upon receiving a message from an unauthenticated user it can't fulfill without authentication, a relay may choose to notify the client. For | 49 | Upon receiving a message from an unauthenticated user it can't fulfill without authentication, a relay may choose to notify the client. For |
| 49 | that it can use a `NOTICE` message with a standard prefix `"restricted: "` that is readable both by humans and machines, for example: | 50 | that it can use a `NOTICE` message with a standard prefix `"restricted: "` that is readable both by humans and machines, for example: |
| @@ -62,7 +63,7 @@ or it can return an `OK` message noting the reason an event was not written usin | |||
| 62 | 63 | ||
| 63 | To verify `AUTH` messages, relays must ensure: | 64 | To verify `AUTH` messages, relays must ensure: |
| 64 | 65 | ||
| 65 | - that the `kind` is `22242` | 66 | - that the `kind` is `22242`; |
| 66 | - that the event was recently signed (~10 minutes, by `created_at`) | 67 | - that the event `created_at` is close (e.g. within ~10 minutes) of the current time; |
| 67 | - that the `content` field matches the relay URL | 68 | - that the `content` field matches the relay URL: |
| 68 | - URL normalization techniques can be applied. For most cases just checking if the domain name is correct should be enough. | 69 | - URL normalization techniques can be applied. For most cases just checking if the domain name is correct should be enough. |