diff --git a/packages/hdwallet-native/src/crypto/isolation/engines/default/bip39.ts b/packages/hdwallet-native/src/crypto/isolation/engines/default/bip39.ts index beeb2438f..565c1d93a 100644 --- a/packages/hdwallet-native/src/crypto/isolation/engines/default/bip39.ts +++ b/packages/hdwallet-native/src/crypto/isolation/engines/default/bip39.ts @@ -1,19 +1,16 @@ /// -import * as core from "@shapeshiftoss/hdwallet-core"; -import * as bip32crypto from "bip32/src/crypto"; import { createSHA512, pbkdf2 } from "hash-wasm"; import { TextEncoder } from "web-encoding"; -import * as BIP32 from "../../core/bip32"; -import * as BIP39 from "../../core/bip39"; -import { safeBufferFrom } from "../../types"; -import * as BIP32Engine from "./bip32"; +import type { Seed as SeedType } from "../../core/bip32"; +import type { Mnemonic as Bip39Mnemonic } from "../../core/bip39"; +import { Seed } from "./bip32"; import { Revocable, revocable } from "./revocable"; export * from "../../core/bip39"; -export class Mnemonic extends Revocable(class {}) implements BIP39.Mnemonic { +export class Mnemonic extends Revocable(class {}) implements Bip39Mnemonic { readonly #mnemonic: string; protected constructor(mnemonic: string) { @@ -21,18 +18,18 @@ export class Mnemonic extends Revocable(class {}) implements BIP39.Mnemonic { this.#mnemonic = mnemonic.normalize("NFKD"); } - static async create(mnemonic: string): Promise { + static async create(mnemonic: string): Promise { const obj = new Mnemonic(mnemonic); return revocable(obj, (x) => obj.addRevoker(x)); } - async toSeed(passphrase?: string): Promise { + async toSeed(passphrase?: string): Promise { if (passphrase !== undefined && typeof passphrase !== "string") throw new Error("bad passphrase type"); const mnemonic = this.#mnemonic; const salt = new TextEncoder().encode(`mnemonic${passphrase ?? ""}`.normalize("NFKD")); - const out = await BIP32Engine.Seed.create( + const out = await Seed.create( Buffer.from( await pbkdf2({ password: mnemonic,