mirror of
https://github.com/nostr-protocol/nips.git
synced 2024-12-25 17:55:51 -05:00
Improves singing and verification procedures.
This commit is contained in:
parent
f2e016fadd
commit
6feac3ef8c
8
01.md
8
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).
|
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`
|
- backspace: `0x08` to `\b`
|
||||||
- form feed: `0x0C` to `\f`
|
- form feed: `0x0C` to `\f`
|
||||||
|
|
||||||
|
Then proceed to sign the `.id` with the user's private key.
|
||||||
|
|
||||||
## Verifying
|
## Verifying
|
||||||
|
|
||||||
To verify an event:
|
To verify an event:
|
||||||
1. Recalculate the hash and check against the `.id`
|
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
|
## Kinds
|
||||||
|
|
||||||
|
@ -138,7 +140,7 @@ To open, update, and close subscriptions, Clients MUST use the following formats
|
||||||
"#<tag-key2 (single-letter a-zA-Z)>": [<tag value1>, <tag value2>, ...],
|
"#<tag-key2 (single-letter a-zA-Z)>": [<tag value1>, <tag value2>, ...],
|
||||||
"since": <an integer unix timestamp in seconds, events must be newer than this to pass>,
|
"since": <an integer unix timestamp in seconds, events must be newer than this to pass>,
|
||||||
"until": <an integer unix timestamp in seconds, events must be older than this to pass>,
|
"until": <an integer unix timestamp in seconds, events must be older than this to pass>,
|
||||||
"limit": <maximum number of events to return, sorted by created_at>
|
"limit": <maximum number of events to return, sorted by created_at desc>
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user