mirror of
https://github.com/nostr-protocol/nips.git
synced 2024-12-26 10:15:52 -05:00
Formatting change
This commit is contained in:
parent
f0d0fb4640
commit
3fa03a1aea
22
01.md
22
01.md
|
@ -27,7 +27,11 @@ Event is the only object type available. It is a hashed and signed payload with
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
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).
|
Each user has a keypair and is identified by their public key.
|
||||||
|
|
||||||
|
## Signing
|
||||||
|
|
||||||
|
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 with the following structure:
|
To obtain the hash `.id`, we `sha256` the UTF-8 byte array of a JSON-serialized string with the following structure:
|
||||||
|
|
||||||
|
@ -45,13 +49,15 @@ To obtain the hash `.id`, we `sha256` the UTF-8 byte array of a JSON-serialized
|
||||||
The JSON serialization MUST follow this rules:
|
The JSON serialization MUST follow this rules:
|
||||||
- Minified: No whitespace, line breaks, or other unnecessary formatting used
|
- Minified: No whitespace, line breaks, or other unnecessary formatting used
|
||||||
- Escape Set: ONLY the following characters MUST be escaped:
|
- Escape Set: ONLY the following characters MUST be escaped:
|
||||||
- line break, `0x0A`, as `\n`
|
- line break: `0x0A` -> `\n`
|
||||||
- double quote, `0x22`, as `\"`
|
- double quote: `0x22` -> `\"`
|
||||||
- backslash, `0x5C`, as `\\`
|
- backslash: `0x5C` -> `\\`
|
||||||
- carriage return, `0x0D`, as `\r`
|
- carriage return: `0x0D` -> `\r`
|
||||||
- tab character, `0x09`, as `\t`
|
- tab character: `0x09` -> `\t`
|
||||||
- backspace, `0x08`, as `\b`
|
- backspace: `0x08` -> `\b`
|
||||||
- form feed, `0x0C`, as `\f`
|
- form feed: `0x0C` -> `\f`
|
||||||
|
|
||||||
|
## 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`
|
||||||
|
|
Loading…
Reference in New Issue
Block a user