From 30696049ccdc9f19b9f737b97290a78d0a64ba9c Mon Sep 17 00:00:00 2001 From: Jonathan Staab Date: Fri, 11 Aug 2023 13:09:17 -0700 Subject: Deprecate NIP 04 --- 44.md | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to '44.md') diff --git a/44.md b/44.md index 9d43698..c6fb69a 100644 --- a/44.md +++ b/44.md @@ -8,7 +8,7 @@ Encrypted Payloads (Versioned) The NIP introduces a versioned encryption data model, allowing multiple algorithm choices to exist simultaneously. -The algorithm described in NIP4 is potentially vulnerable to [padding oracle attacks](https://en.wikipedia.org/wiki/Padding_oracle_attack) and uses keys which are not indistinguishable from random. +The algorithm described in NIP-04 is potentially vulnerable to [padding oracle attacks](https://en.wikipedia.org/wiki/Padding_oracle_attack) and uses keys which are not indistinguishable from random. For more information, see [here](https://github.com/nostr-protocol/nips/pull/715#issuecomment-1675301250-). An encrypted payload MUST be encoded as a JSON object. Different versions may have different parameters. Every format has a `v` field specifying its version. @@ -17,10 +17,6 @@ Currently defined encryption algorithms: - `0x00` - Reserved - `0x01` - XChaCha with same key `sha256(ecdh)` per conversation -# Version 0 - -Version 0 is not defined, however implementations depending on this NIP MAY choose to support the payload described in NIP 04 in the same places a NIP 44 payload would otherwise be expected. This is intended to allow a smooth transition while clients and signing software adopt the new standard. - # Version 1 Params: @@ -38,11 +34,13 @@ Example: } ``` -**Note**: By default in the [libsecp256k1](https://github.com/bitcoin-core/secp256k1) ECDH implementation, the secret is the SHA256 hash of the shared point (both X and Y coordinates). We are using this exact implementation. In NIP4, unhashed shared point was used. +# Other Notes + +By default in the [libsecp256k1](https://github.com/bitcoin-core/secp256k1) ECDH implementation, the secret is the SHA256 hash of the shared point (both X and Y coordinates). We are using this exact implementation. In NIP-94, unhashed shared point was used. -## Code Samples +# Code Samples -### Javascript +## Javascript ```javascript import {xchacha20} from "@noble/ciphers/chacha" @@ -99,7 +97,7 @@ export function decrypt(privkey: string, pubkey: string, payload: string) { } ``` -### Kotlin +## Kotlin ```kotlin // implementation 'fr.acinq.secp256k1:secp256k1-kmp-jni-android:0.10.1' -- cgit v1.2.3