diff --git a/01.md b/01.md index 2ff81eb..9258d2f 100644 --- a/01.md +++ b/01.md @@ -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.