mirror of
https://github.com/nostr-protocol/nips.git
synced 2024-12-13 19:06:24 +00:00
Fix some typos and adds json type to code blocks
This commit is contained in:
parent
7f7da50636
commit
5980907797
14
01.md
14
01.md
@ -14,7 +14,7 @@ Each user has a keypair. Signatures, public key and encodings are done according
|
|||||||
|
|
||||||
The only object type that exists is the `event`, which has the following format on the wire:
|
The only object type that exists is the `event`, which has the following format on the wire:
|
||||||
|
|
||||||
```
|
```json
|
||||||
{
|
{
|
||||||
"id": <32-bytes sha256 of the the serialized event data>
|
"id": <32-bytes sha256 of the the serialized event data>
|
||||||
"pubkey": <32-bytes hex-encoded public key of the event creator>,
|
"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
|
|||||||
["e", <32-bytes hex of the id of another event>, <recommended relay URL>],
|
["e", <32-bytes hex of the id of another event>, <recommended relay URL>],
|
||||||
["p", <32-bytes hex of the key>, <recommended relay URL>],
|
["p", <32-bytes hex of the key>, <recommended relay URL>],
|
||||||
... // other kinds of tags may be included later
|
... // other kinds of tags may be included later
|
||||||
]
|
],
|
||||||
"content": <arbitrary string>,
|
"content": <arbitrary string>,
|
||||||
"sig": <64-bytes signature of the sha256 hash of the serialized event data, which is the same as the "id" field>,
|
"sig": <64-bytes signature of the sha256 hash of the serialized event data, which is the same as the "id" field>
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
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:
|
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:
|
||||||
|
|
||||||
```
|
```json
|
||||||
[
|
[
|
||||||
0,
|
0,
|
||||||
<pubkey, as a (lowercase) hex string>,
|
<pubkey, as a (lowercase) hex string>,
|
||||||
@ -51,15 +51,15 @@ Relays expose a websocket endpoint to which clients can connect.
|
|||||||
|
|
||||||
Clients can send 3 types of messages, which must be JSON arrays, according to the following patterns:
|
Clients can send 3 types of messages, which must be JSON arrays, according to the following patterns:
|
||||||
|
|
||||||
* `["EVENT", <event JSON as defined above>`], used to publish events.
|
* `["EVENT", <event JSON as defined above>]`, used to publish events.
|
||||||
* `["REQ", <subscription_id>, <filters JSON>...`], used to request events and subscribe to new updates.
|
* `["REQ", <subscription_id>, <filters JSON>...]`, used to request events and subscribe to new updates.
|
||||||
* `["CLOSE", <subscription_id>]`, used to stop previous subscriptions.
|
* `["CLOSE", <subscription_id>]`, used to stop previous subscriptions.
|
||||||
|
|
||||||
`<subscription_id>` is a random string that should be used to represent a subscription.
|
`<subscription_id>` is a random string that should be used to represent a subscription.
|
||||||
|
|
||||||
`<filters>` is a JSON object that determines what events will be sent in that subscription, it can have the following attributes:
|
`<filters>` is a JSON object that determines what events will be sent in that subscription, it can have the following attributes:
|
||||||
|
|
||||||
```
|
```json
|
||||||
{
|
{
|
||||||
"ids": <a list of event ids or prefixes>,
|
"ids": <a list of event ids or prefixes>,
|
||||||
"authors": <a list of pubkeys or prefixes, the pubkey of an event must be one of these>,
|
"authors": <a list of pubkeys or prefixes, the pubkey of an event must be one of these>,
|
||||||
|
Loading…
Reference in New Issue
Block a user