diff options
| author | emeceve <emeceve@outlook.com> | 2022-06-20 22:08:36 -0300 |
|---|---|---|
| committer | fiatjaf <fiatjaf@gmail.com> | 2022-06-21 08:07:05 -0300 |
| commit | 5980907797231b3efb7fc1c43c4206fd11fbd947 (patch) | |
| tree | 5295bdd7effecde3aab97a8cc01688db3b8c2f0e | |
| parent | 7f7da50636a26ccdf110f608b64c880d502386e5 (diff) | |
Fix some typos and adds json type to code blocks
| -rw-r--r-- | 01.md | 14 |
1 files changed, 7 insertions, 7 deletions
| @@ -14,7 +14,7 @@ Each user has a keypair. Signatures, public key and encodings are done according | |||
| 14 | 14 | ||
| 15 | The only object type that exists is the `event`, which has the following format on the wire: | 15 | The only object type that exists is the `event`, which has the following format on the wire: |
| 16 | 16 | ||
| 17 | ``` | 17 | ```json |
| 18 | { | 18 | { |
| 19 | "id": <32-bytes sha256 of the the serialized event data> | 19 | "id": <32-bytes sha256 of the the serialized event data> |
| 20 | "pubkey": <32-bytes hex-encoded public key of the event creator>, | 20 | "pubkey": <32-bytes hex-encoded public key of the event creator>, |
| @@ -24,15 +24,15 @@ The only object type that exists is the `event`, which has the following format | |||
| 24 | ["e", <32-bytes hex of the id of another event>, <recommended relay URL>], | 24 | ["e", <32-bytes hex of the id of another event>, <recommended relay URL>], |
| 25 | ["p", <32-bytes hex of the key>, <recommended relay URL>], | 25 | ["p", <32-bytes hex of the key>, <recommended relay URL>], |
| 26 | ... // other kinds of tags may be included later | 26 | ... // other kinds of tags may be included later |
| 27 | ] | 27 | ], |
| 28 | "content": <arbitrary string>, | 28 | "content": <arbitrary string>, |
| 29 | "sig": <64-bytes signature of the sha256 hash of the serialized event data, which is the same as the "id" field>, | 29 | "sig": <64-bytes signature of the sha256 hash of the serialized event data, which is the same as the "id" field> |
| 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 indentation or extra spaces) 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 (with no indentation or extra spaces) of the following structure: |
| 34 | 34 | ||
| 35 | ``` | 35 | ```json |
| 36 | [ | 36 | [ |
| 37 | 0, | 37 | 0, |
| 38 | <pubkey, as a (lowercase) hex string>, | 38 | <pubkey, as a (lowercase) hex string>, |
| @@ -51,15 +51,15 @@ Relays expose a websocket endpoint to which clients can connect. | |||
| 51 | 51 | ||
| 52 | Clients can send 3 types of messages, which must be JSON arrays, according to the following patterns: | 52 | Clients can send 3 types of messages, which must be JSON arrays, according to the following patterns: |
| 53 | 53 | ||
| 54 | * `["EVENT", <event JSON as defined above>`], used to publish events. | 54 | * `["EVENT", <event JSON as defined above>]`, used to publish events. |
| 55 | * `["REQ", <subscription_id>, <filters JSON>...`], used to request events and subscribe to new updates. | 55 | * `["REQ", <subscription_id>, <filters JSON>...]`, used to request events and subscribe to new updates. |
| 56 | * `["CLOSE", <subscription_id>]`, used to stop previous subscriptions. | 56 | * `["CLOSE", <subscription_id>]`, used to stop previous subscriptions. |
| 57 | 57 | ||
| 58 | `<subscription_id>` is a random string that should be used to represent a subscription. | 58 | `<subscription_id>` is a random string that should be used to represent a subscription. |
| 59 | 59 | ||
| 60 | `<filters>` is a JSON object that determines what events will be sent in that subscription, it can have the following attributes: | 60 | `<filters>` is a JSON object that determines what events will be sent in that subscription, it can have the following attributes: |
| 61 | 61 | ||
| 62 | ``` | 62 | ```json |
| 63 | { | 63 | { |
| 64 | "ids": <a list of event ids or prefixes>, | 64 | "ids": <a list of event ids or prefixes>, |
| 65 | "authors": <a list of pubkeys or prefixes, the pubkey of an event must be one of these>, | 65 | "authors": <a list of pubkeys or prefixes, the pubkey of an event must be one of these>, |