prettify and lint.

This commit is contained in:
fiatjaf
2023-12-16 12:39:24 -03:00
parent 0108e3b605
commit d16f3f77c3
6 changed files with 13 additions and 24 deletions

View File

@@ -3,11 +3,7 @@ import { wordlist } from '@scure/bip39/wordlists/english'
import { generateMnemonic, mnemonicToSeedSync, validateMnemonic } from '@scure/bip39'
import { HDKey } from '@scure/bip32'
export function privateKeyFromSeedWords(
mnemonic: string,
passphrase?: string,
accountIndex = 0
): string {
export function privateKeyFromSeedWords(mnemonic: string, passphrase?: string, accountIndex = 0): string {
let root = HDKey.fromMasterSeed(mnemonicToSeedSync(mnemonic, passphrase))
let privateKey = root.derive(`m/44'/1237'/${accountIndex}'/0/0`).privateKey
if (!privateKey) throw new Error('could not derive private key')