MnemonicService

interface MnemonicService

Service for BIP-39 mnemonic operations.

This interface abstracts the mnemonic generation and seed derivation, allowing for different implementations (e.g., bitcoin-kmp, @scure/bip39 port) to ensure compatibility with various wallet implementations.

Security Note:

  • Mnemonics and seeds are highly sensitive

  • Always wipe from memory after use

  • Never log or persist in plaintext

Inheritors

Functions

Link copied to clipboard
abstract fun entropyToMnemonic(entropy: ByteArray): String

Reconstructs a BIP-39 mnemonic phrase from raw entropy bytes.

Link copied to clipboard
abstract fun generateMnemonic(wordCount: Int = 24): String

Generates a random BIP-39 mnemonic phrase.

Link copied to clipboard
abstract fun mnemonicToEntropy(mnemonic: String): ByteArray

Extracts the raw entropy bytes from a BIP-39 mnemonic phrase.

Link copied to clipboard
abstract fun mnemonicToSeed(mnemonic: String, passphrase: String = ""): ByteArray

Converts a mnemonic phrase to a seed using PBKDF2-HMAC-SHA512.

Link copied to clipboard
abstract fun validateMnemonic(mnemonic: String): Boolean

Validates a BIP-39 mnemonic phrase.