From 5d06af8af53087db09daf2883b633d2d26ed8e66 Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Thu, 4 Jan 2024 10:59:22 -0500 Subject: [PATCH] Update 01.md Improves type definitions in each json --- 01.md | 49 +++++++++++++++++++++++++------------------------ 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/01.md b/01.md index 361706a8..54f69149 100644 --- a/01.md +++ b/01.md @@ -12,19 +12,19 @@ This NIP defines the mandatory part of the Nostr protocol. New NIPs may add new Event is the only object type available. It is a hashed and signed payload in the following format: -```json +```jsonc { - "id": <32-byte lowercase hex-encoded sha256 of the serialized event data>, - "pubkey": <32-byte lowercase hex-encoded public key used to sign>, - "created_at": , + "id": , + "pubkey": , + "created_at": , "kind": , "tags": [ - [, , ...], - [, , ...], + [, , ...], + [, , ...], ... ], - "content": , - "sig": <64-byte lowercase hex of the signature of the id> + "content": , + "sig": } ``` @@ -36,14 +36,14 @@ Signatures and encodings are done according to the [Schnorr signatures standard To assemble the `.id`, hex encode the result of a `sha256` of the UTF-8 byte array of a JSON-serialized string in the following structure: -``` +```js [ 0, - , - , - , - , - + , + , + , + , + ] ``` @@ -136,16 +136,17 @@ To open and update, and close subscriptions, Clients MUST use the following form `` is a JSON object that determines what events will be sent in that subscription, it can have the following attributes: -```json +```js { - "ids": [, , ...], - "authors": [, , ...], - "kinds": [, , ...], - "#": [, , ...], - "#": [, , ...], - "since": , - "until": , - "limit": + "ids": [, , ...], + "authors": [, , ...], + "kinds": [, , ...], + "#": [, , ...], + "#": [, , ...], + ..., + "since": , + "until": , + "limit": } ``` @@ -212,4 +213,4 @@ Some examples: * `["CLOSED", "sub1", "duplicate: sub1 already opened"]` * `["CLOSED", "sub1", "unsupported: filter contains unknown elements"]` * `["CLOSED", "sub1", "error: could not connect to the database"]` - * `["CLOSED", "sub1", "error: shutting down idle subscription"]` \ No newline at end of file + * `["CLOSED", "sub1", "error: shutting down idle subscription"]`