mirror of
https://github.com/nostr-protocol/nips.git
synced 2024-11-09 22:09:06 -05:00
Clarify JSON serialization for the id
field
This commit is contained in:
parent
e0fc913719
commit
b5a7b67d78
10
01.md
10
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.
|
||||
|
|
Loading…
Reference in New Issue
Block a user