diff options
| author | Asai Toshiya <to.asai.60@gmail.com> | 2024-12-21 01:34:43 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-12-21 01:34:43 +0900 |
| commit | 7e150faed4ccadfdcdc81265a406c4b6cdd39047 (patch) | |
| tree | 06383530bd2dedb26b7b730544dcb259b302a977 /44.md | |
| parent | 97bf5266d7760094ec55a66fe18d549de385768b (diff) | |
nip44: update some nits.
Diffstat (limited to '44.md')
| -rw-r--r-- | 44.md | 12 |
1 files changed, 6 insertions, 6 deletions
| @@ -8,11 +8,11 @@ Encrypted Payloads (Versioned) | |||
| 8 | 8 | ||
| 9 | The NIP introduces a new data format for keypair-based encryption. This NIP is versioned | 9 | The NIP introduces a new data format for keypair-based encryption. This NIP is versioned |
| 10 | to allow multiple algorithm choices to exist simultaneously. This format may be used for | 10 | to allow multiple algorithm choices to exist simultaneously. This format may be used for |
| 11 | many things, but MUST be used in the context of a signed event as described in NIP 01. | 11 | many things, but MUST be used in the context of a signed event as described in NIP-01. |
| 12 | 12 | ||
| 13 | *Note*: this format DOES NOT define any `kind`s related to a new direct messaging standard, | 13 | *Note*: this format DOES NOT define any `kind`s related to a new direct messaging standard, |
| 14 | only the encryption required to define one. It SHOULD NOT be used as a drop-in replacement | 14 | only the encryption required to define one. It SHOULD NOT be used as a drop-in replacement |
| 15 | for NIP 04 payloads. | 15 | for NIP-04 payloads. |
| 16 | 16 | ||
| 17 | ## Versions | 17 | ## Versions |
| 18 | 18 | ||
| @@ -41,7 +41,7 @@ On its own, messages sent using this scheme have a number of important shortcomi | |||
| 41 | - No post-compromise security: when a key is compromised, it is possible to decrypt all future conversations | 41 | - No post-compromise security: when a key is compromised, it is possible to decrypt all future conversations |
| 42 | - No post-quantum security: a powerful quantum computer would be able to decrypt the messages | 42 | - No post-quantum security: a powerful quantum computer would be able to decrypt the messages |
| 43 | - IP address leak: user IP may be seen by relays and all intermediaries between user and relay | 43 | - IP address leak: user IP may be seen by relays and all intermediaries between user and relay |
| 44 | - Date leak: `created_at` is public, since it is a part of NIP 01 event | 44 | - Date leak: `created_at` is public, since it is a part of NIP-01 event |
| 45 | - Limited message size leak: padding only partially obscures true message length | 45 | - Limited message size leak: padding only partially obscures true message length |
| 46 | - No attachments: they are not supported | 46 | - No attachments: they are not supported |
| 47 | 47 | ||
| @@ -86,7 +86,7 @@ NIP-44 version 2 has the following design characteristics: | |||
| 86 | - Content must be encoded from UTF-8 into byte array | 86 | - Content must be encoded from UTF-8 into byte array |
| 87 | - Validate plaintext length. Minimum is 1 byte, maximum is 65535 bytes | 87 | - Validate plaintext length. Minimum is 1 byte, maximum is 65535 bytes |
| 88 | - Padding format is: `[plaintext_length: u16][plaintext][zero_bytes]` | 88 | - Padding format is: `[plaintext_length: u16][plaintext][zero_bytes]` |
| 89 | - Padding algorithm is related to powers-of-two, with min padded msg size of 32bytes | 89 | - Padding algorithm is related to powers-of-two, with min padded msg size of 32 bytes |
| 90 | - Plaintext length is encoded in big-endian as first 2 bytes of the padded blob | 90 | - Plaintext length is encoded in big-endian as first 2 bytes of the padded blob |
| 91 | 5. Encrypt padded content | 91 | 5. Encrypt padded content |
| 92 | - Use ChaCha20, with key and nonce from step 3 | 92 | - Use ChaCha20, with key and nonce from step 3 |
| @@ -148,8 +148,8 @@ validation rules, refer to BIP-340. | |||
| 148 | - `x[i:j]`, where `x` is a byte array and `i, j <= 0` returns a `(j - i)`-byte array with a copy of the | 148 | - `x[i:j]`, where `x` is a byte array and `i, j <= 0` returns a `(j - i)`-byte array with a copy of the |
| 149 | `i`-th byte (inclusive) to the `j`-th byte (exclusive) of `x`. | 149 | `i`-th byte (inclusive) to the `j`-th byte (exclusive) of `x`. |
| 150 | - Constants `c`: | 150 | - Constants `c`: |
| 151 | - `min_plaintext_size` is 1. 1bytes msg is padded to 32bytes. | 151 | - `min_plaintext_size` is 1. 1 byte msg is padded to 32 bytes. |
| 152 | - `max_plaintext_size` is 65535 (64kB - 1). It is padded to 65536bytes. | 152 | - `max_plaintext_size` is 65535 (64kB - 1). It is padded to 65536 bytes. |
| 153 | - Functions | 153 | - Functions |
| 154 | - `base64_encode(string)` and `base64_decode(bytes)` are Base64 ([RFC 4648](https://datatracker.ietf.org/doc/html/rfc4648), with padding) | 154 | - `base64_encode(string)` and `base64_decode(bytes)` are Base64 ([RFC 4648](https://datatracker.ietf.org/doc/html/rfc4648), with padding) |
| 155 | - `concat` refers to byte array concatenation | 155 | - `concat` refers to byte array concatenation |