From 6feac3ef8cb04d7d5aeb0444c81bde5809822ca8 Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Wed, 3 Jan 2024 13:54:10 -0500 Subject: [PATCH] Improves singing and verification procedures. --- 01.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/01.md b/01.md index cde8453..87dd912 100644 --- a/01.md +++ b/01.md @@ -34,7 +34,7 @@ Each user has a keypair and is identified by their public key. Signatures and encodings are done according to the [Schnorr signatures standard for the curve `secp256k1`](https://bips.xyz/340). -To obtain the hash `.id`, we `sha256` the UTF-8 byte array of a JSON-serialized string in the following structure: +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: ``` [ @@ -58,11 +58,13 @@ The JSON serialization MUST follow these rules: - backspace: `0x08` to `\b` - form feed: `0x0C` to `\f` +Then proceed to sign the `.id` with the user's private key. + ## Verifying To verify an event: 1. Recalculate the hash and check against the `.id` -2. Verify if the signature is valid for the `.id`. +2. Verify if the signature is valid for the `.id` and `.pubkey`. ## Kinds @@ -138,7 +140,7 @@ To open, update, and close subscriptions, Clients MUST use the following formats "#": [, , ...], "since": , "until": , - "limit": + "limit": } ```