mirror of
https://github.com/nostr-protocol/nips.git
synced 2024-11-10 06:09:08 -05:00
some corrections
This commit is contained in:
parent
afa93ffb26
commit
cbcc8de803
6
xx.md
6
xx.md
|
@ -5,7 +5,7 @@ Nostr-Specific Deterministic Private Key Generation from Ethereum Wallet Signatu
|
||||||
|
|
||||||
## Abstract
|
## Abstract
|
||||||
|
|
||||||
This specification provides an optional method for Nostr clients to generate deterministic private keys from Ethereum wallet signatures. This NIP proposes HMAC Key Derivation Function (HKDF) coupled with SHA-256 from ECDSA signatures (EIP-191) as an alternative to the Schnorr signatures (BIP-340), allowing Nostr to interact with Ethereum ecosystem.
|
This specification provides an optional method for Nostr clients to generate deterministic private keys from Ethereum wallet signatures. This NIP proposes HMAC Key Derivation Function (HKDF) coupled with SHA-256 from ECDSA signatures (EIP-191) as an alternative to the Schnorr signatures (BIP-340), allowing Nostr to interact with Ethereum ecosystem, and vice-versa.
|
||||||
|
|
||||||
## Terminology
|
## Terminology
|
||||||
### a) Username
|
### a) Username
|
||||||
|
@ -36,7 +36,7 @@ let message = `Login to Nostr as ${username}\n\nImportant: Please verify the int
|
||||||
### d) Signature
|
### d) Signature
|
||||||
Signature is the deterministic signature from connected Ethereum wallet. Ethereum signatures `(v,r,s)` are 65 bytes long, i.e. `bytes1(v) + bytes32(r) + bytes32(s)`,
|
Signature is the deterministic signature from connected Ethereum wallet. Ethereum signatures `(v,r,s)` are 65 bytes long, i.e. `bytes1(v) + bytes32(r) + bytes32(s)`,
|
||||||
```js
|
```js
|
||||||
let signature = wallet.signMessage(message);
|
let signature = wallet.signMessage(message); // implements ethereum-native ECDSA signatures in format (v,r,s)
|
||||||
```
|
```
|
||||||
### e) HKDF (HMAC Key Derivation Function)
|
### e) HKDF (HMAC Key Derivation Function)
|
||||||
HKDF-SHA-256 is used to derive the 42 bytes long hash key: `hkdf(sha256, inputKey, salt, info, dkLen = 42)`
|
HKDF-SHA-256 is used to derive the 42 bytes long hash key: `hkdf(sha256, inputKey, salt, info, dkLen = 42)`
|
||||||
|
@ -58,7 +58,7 @@ HKDF-SHA-256 is used to derive the 42 bytes long hash key: `hkdf(sha256, inputKe
|
||||||
```js
|
```js
|
||||||
let dkLen = 42;
|
let dkLen = 42;
|
||||||
```
|
```
|
||||||
FIPS 186/4 B.4.1 requires hash length to be ≥ n+8, where n is the length of final private key, such that 42 ≥ 32 + 8.
|
FIPS 186/4 B.4.1 requires hash length to be `>= n + 8`, where n is the length of final private key, such that `42 >= 32 + 8`.
|
||||||
|
|
||||||
- `hashToPrivateKey` function is FIPS 186-4 B.4.1 implementation to convert hash keys derived using HKDF to valid `secp256k1` private keys. This function is implemented in JavaScript library `@noble/secp256k1` as `hashToPrivateKey()`.
|
- `hashToPrivateKey` function is FIPS 186-4 B.4.1 implementation to convert hash keys derived using HKDF to valid `secp256k1` private keys. This function is implemented in JavaScript library `@noble/secp256k1` as `hashToPrivateKey()`.
|
||||||
```js
|
```js
|
||||||
|
|
Loading…
Reference in New Issue
Block a user