mirror of
https://github.com/nbd-wtf/nostr-tools.git
synced 2025-12-08 16:28:49 +00:00
feat(nip06): add passphrase optional param
This commit is contained in:
4
nip06.ts
4
nip06.ts
@@ -7,8 +7,8 @@ import {
|
||||
} from '@scure/bip39'
|
||||
import {HDKey} from '@scure/bip32'
|
||||
|
||||
export function privateKeyFromSeedWords(mnemonic: string): string {
|
||||
let root = HDKey.fromMasterSeed(mnemonicToSeedSync(mnemonic))
|
||||
export function privateKeyFromSeedWords(mnemonic: string, passphrase?: string): string {
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user