web3.news/scripts/generate-site-pubkey.ts

13 lines
402 B
TypeScript
Raw Normal View History

2023-12-28 06:40:20 +00:00
import { HDKey } from "ed25519-keygen/hdkey";
import * as bip39 from "@scure/bip39";
import { wordlist } from "@scure/bip39/wordlists/english";
const BIP44_PATH = "m/44'/1627'/0'/0'/0'";
const mn = bip39.generateMnemonic(wordlist);
console.log(mn);
const hdkey = HDKey.fromMasterSeed(await bip39.mnemonicToSeed(mn));
console.log(Buffer.from(hdkey.derive(BIP44_PATH).publicKeyRaw).toString("hex"));