Skip to content

Conversation

@athexweb3
Copy link
Contributor

@athexweb3 athexweb3 commented Dec 15, 2025

This PR introduces react-native-quick-bip39, a high-performance, lightweight, and type-safe implementation of BIP39 that leverages react-native-quick-crypto for cryptographic primitives.

Unlike pure JS implementations (like bip39 or @scure/bip39) which block the JS thread during seed derivation, this package offloads the heavy PBKDF2 calculation to C++ via RNQC, resulting in ~100x faster performance on mobile devices.

Why a separate package?

I deliberately separated react-native-quick-bip39 from the core react-native-quick-crypto library to strictly control bundle size.

  • Wordlists are heavy: Including all 10 BIP39 wordlists would add ~300 KB to the bundle.
  • Pay-for-what-you-use: Most apps only need the English wordlist (or none at all if just using AES/Hashing).
  • Core Focus: react-native-quick-crypto stays a lightweight, low-level primitive library, while this package handles the higher-level BIP39 standard.

Features

  • ⚡️ Performance: Mnemonic-to-seed derivation is now lightning fast (~20ms vs ~1500ms on older devices).
  • 📦 Bundle Size Optimized:
    • Default size is ~19 KB (only includes English wordlist).
    • Other 9 languages are fully tree-shakeable and only bundled if imported.
  • 🌍 Full Multi-Language Support:
    • Includes all 10 standard BIP39 wordlists.
    • Correctly handles Japanese ideographic headers (\u3000 delimiter).
  • 📚 Documentation:
    • Added dedicated API Reference page: docs/api/bip39.
    • Updated Crypto Wallet Guide: docs/guides/crypto-wallet.
    • Professional README.md with responsive banners.

Changes

  • New Package: packages/react-native-quick-bip39 containing the source, tests, and build scripts.
  • Workspace: Added the new package to root package.json workspaces.
  • Docs:
    • Created docs/content/docs/api/bip39.mdx.
    • Updated docs/content/docs/guides/crypto-wallet.mdx to recommend this new package.
    • Added bip39 to docs/content/docs/api/meta.json.
  • Chore: Updated root .gitignore to properly ignore docs/.next, docs/.source, and docs/next-env.d.ts build artifacts.

Benchmarks

Operation Time (Pure JS) Time (RNQC/RNQB)
Mnemonic to Seed ~1500ms ~20ms

Bundle Size

Configuration Size (Minified)
Default (English) 18.9 KB
All Languages ~283 KB

Verification

  • Tested generateMnemonic (12 & 24 words).
  • Tested mnemonicToSeed (Async & Sync).
  • Verified Japanese delimiter handling.
  • Verified tree-shaking works (only imported wordlists are bundled).
  • bun test passes for all test suites.

@athexweb3
Copy link
Contributor Author

Needs to be added inside RNQC example app test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant