diff options
Diffstat (limited to '01.md')
| -rw-r--r-- | 01.md | 10 |
1 files changed, 9 insertions, 1 deletions
| @@ -30,7 +30,7 @@ The only object type that exists is the `event`, which has the following format | |||
| 30 | } | 30 | } |
| 31 | ``` | 31 | ``` |
| 32 | 32 | ||
| 33 | To obtain the `event.id`, we `sha256` the serialized event. The serialization is done over the UTF-8 JSON-serialized string (with no white space or line breaks) of the following structure: | 33 | To obtain the `event.id`, we `sha256` the serialized event. The serialization is done over the UTF-8 JSON-serialized string (which is described below) of the following structure: |
| 34 | 34 | ||
| 35 | ```json | 35 | ```json |
| 36 | [ | 36 | [ |
| @@ -43,6 +43,14 @@ To obtain the `event.id`, we `sha256` the serialized event. The serialization is | |||
| 43 | ] | 43 | ] |
| 44 | ``` | 44 | ``` |
| 45 | 45 | ||
| 46 | To prevent implementation differences from creating a different event ID for the same event, the following rules MUST be followed while serializing: | ||
| 47 | - No whitespace, line breaks or other unnecessary formatting should be included in the output JSON. | ||
| 48 | - No characters except the following should be escaped, and instead should be included verbatim: | ||
| 49 | - The line break, `0x0A`, as `\n` | ||
| 50 | - A double quote, `0x22`, as `\"` | ||
| 51 | - A backspace, `0x5C`, as `\\` | ||
| 52 | - UTF-8 should be used for encoding. | ||
| 53 | |||
| 46 | ## Communication between clients and relays | 54 | ## Communication between clients and relays |
| 47 | 55 | ||
| 48 | Relays expose a websocket endpoint to which clients can connect. | 56 | Relays expose a websocket endpoint to which clients can connect. |