mirror of
https://github.com/nostr-protocol/nips.git
synced 2025-12-10 09:08:50 +00:00
Deprecate NIP 04
This commit is contained in:
16
44.md
16
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
|
||||
|
||||
## Code Samples
|
||||
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.
|
||||
|
||||
### Javascript
|
||||
# Code Samples
|
||||
|
||||
## 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'
|
||||
|
||||
Reference in New Issue
Block a user