Switch from noble-secp256k1 to noble-curves

This commit is contained in:
Paul Miller
2023-04-14 16:26:33 +00:00
committed by fiatjaf_
parent f17ab41d72
commit 204ae0eff1
10 changed files with 648 additions and 804 deletions

View File

@@ -1,4 +1,4 @@
import * as secp256k1 from '@noble/secp256k1'
import {bytesToHex} from '@noble/hashes/utils'
import {wordlist} from '@scure/bip39/wordlists/english.js'
import {
generateMnemonic,
@@ -14,7 +14,7 @@ export function privateKeyFromSeedWords(
let root = HDKey.fromMasterSeed(mnemonicToSeedSync(mnemonic, passphrase))
let privateKey = root.derive(`m/44'/1237'/0'/0/0`).privateKey
if (!privateKey) throw new Error('could not derive private key')
return secp256k1.utils.bytesToHex(privateKey)
return bytesToHex(privateKey)
}
export function generateSeedWords(): string {