BitcoinJMnemonicService

Implementation of MnemonicService using BitcoinJ library.

This implementation uses the BitcoinJ library which implements standard BIP-39 (same algorithm as @scure/bip39 used by midnight-wallet SDK).

Compatibility:

  • Compatible with any standard BIP-39 implementation

  • Same algorithm as midnight-wallet SDK (@scure/bip39)

  • Should produce identical outputs for same inputs

  • Battle-tested in Bitcoin wallets since 2013

Security:

  • Uses cryptographically secure random number generation

  • Implements standard PBKDF2-HMAC-SHA512 with 2048 iterations

  • Wipes sensitive entropy from memory after use

  • Based on official BIP-39 specification

Android Compatibility:

  • Works correctly on Android (verified on Android 16)

  • Includes defensive fallback for unusual configurations

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
object Companion

Functions

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

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

Link copied to clipboard
open override fun generateMnemonic(wordCount: Int): String

Generates a random BIP-39 mnemonic phrase.

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

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

Link copied to clipboard
open override fun mnemonicToSeed(mnemonic: String, passphrase: String): ByteArray

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

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

Validates a BIP-39 mnemonic phrase.