Clarify JSON serialization for the id field

This commit is contained in:
Semisol 2023-07-03 18:02:15 +03:00 committed by GitHub
parent e0fc913719
commit b5a7b67d78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

10
01.md
View File

@ -30,7 +30,7 @@ The only object type that exists is the `event`, which has the following format
}
```
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:
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:
```json
[
@ -43,6 +43,14 @@ To obtain the `event.id`, we `sha256` the serialized event. The serialization is
]
```
To prevent implementation differences from creating a different event ID for the same event, the following rules MUST be followed while serializing:
- No whitespace, line breaks or other unnecessary formatting should be included in the output JSON.
- No characters except the following should be escaped, and instead should be included verbatim:
- The line break, `0x0A`, as `\n`
- A double quote, `0x22`, as `\"`
- A backspace, `0x5C`, as `\\`
- UTF-8 should be used for encoding.
## Communication between clients and relays
Relays expose a websocket endpoint to which clients can connect.