pixa_bip39
v0.0.5
Published
WASM-ready BIP-39 mnemonic + base58 master key generator with brute-force resistance
Downloads
11
Readme
Pixa BIP39 WASM
Pixa BIP39 WASM is a WebAssembly-compatible Rust library that generates BIP-39 compliant mnemonics and converts them into a hardened 51-character Base58 master key. Designed for browser and Node environments with brute-force resistance using scrypt.
🔧 Features
- Generate BIP-39 mnemonics (12–24 words)
- Harden mnemonic with optional passphrase using
scrypt - Output a Base58 WIF (Wallet Import Format) master key (compatible with Steem/Hive-style keys)
- WebAssembly-ready using
wasm-bindgen - Brute-force resistance by slow key derivation
- 🔍 Autocomplete BIP-39 words in any supported language
📦 Usage (in JS after wasm-pack build)
import init, {
generate_mnemonic,
mnemonic_to_base58_master_key,
search_mnemonic_words
} from 'pixa_bip39';
await init();
// Generate a mnemonic
const phrase = generate_mnemonic(24, "english");
// Derive a base58 master key
const masterKey = await mnemonic_to_base58_master_key(phrase, "optional-passphrase");
// Search for valid BIP-39 words that start with a query string
const suggestions = search_mnemonic_words("ent", "english", 5);
console.log("Mnemonic:", phrase);
console.log("Master Key (Base58):", masterKey);
console.log("Suggestions:", suggestions);🧪 Supported Word Counts & Languages
Word Counts:
- 12 words (128 bits entropy)
- 15 words (160 bits)
- 18 words (192 bits)
- 21 words (224 bits)
- 24 words (256 bits)
Languages:
This module supports all BIP-39 standard wordlists:
- 🇬🇧 English —
"english" - 🇨🇿 Czech —
"czech" - 🇫🇷 French —
"french" - 🇮🇹 Italian —
"italian" - 🇯🇵 Japanese —
"japanese" - 🇰🇷 Korean —
"korean" - 🇵🇹 Portuguese —
"portuguese" - 🇪🇸 Spanish —
"spanish"
To use a specific language, pass its keyword as the second argument to generate_mnemonic.
🔍 Word Search Utility
search_mnemonic_words(query: string, lang: string, maxLength: number)
Returns a list of BIP-39 words (in the selected language) that begin with the query string. This is especially useful for autocomplete features or validating partially entered mnemonics.
Parameters:
query: A string with at least 1 character to match the beginning of valid words.lang: The language keyword (e.g.,"english").maxLength: Maximum number of matching words to return.
Example:
const words = search_mnemonic_words("tra", "english", 10);
console.log(words); // ["track", "trade", "traffic", ...]🛠 Build Instructions
wasm-pack build --target webAvailable targets: web, bundler, nodejs
📜 License
MIT OR Apache-2.0
© Affolter Matias
