Skip to content

bip39 is an enhancement proposal for the Bitcoin network, enabling the generation of a private key through a set of 12-24 mnemonic words

License

Notifications You must be signed in to change notification settings

kitzen-io/bip39-react-native

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

npm version from kitzen with Love GitHub license contributions welcome test Known Vulnerabilities

Bip39 with android support

Bip39 is an enhancement proposal for the Bitcoin network, enabling the generation of a private key through a set of 12-24 mnemonic words

Why we need this instead of npm's bip39?

Original bip39 js library requires runtime implementation of crypto, e.g. v8 provides globalThis.crypto, but Hermes doesn't. So this library comes with polyfills for

As native implementation for both from Android and IOS. It was forked from react-native-bip39, but original version have issues with

  • Dependencies, which are resolved here. E.g. require changed from original code.
  • Installation tips
  • Typescript support

Installation

  1. Copy paste this block to your package.json:
{  
  "dependencies": {
    "react-native-crypto": "*",
    "react-native-randombytes": "*"
  },
  "resolutions": {
    "@kitzen/react-native-bip39/react-native-crypto/pbkdf2": "3.1.2",
    "@kitzen/react-native-bip39/react-native-crypto/public-encrypt/parse-asn1/pbkdf2": "3.1.2",
    "@kitzen/react-native-bip39/react-native-random-bytes/buffer": "^6.0.3"
  }
}

This is required!

  • Resolutions are not applied from nested modules. So manual setup is required
  • Duplicating dependencies is required so react could pull up list of packages it needs to check as native modules, otherwise you'll get undefined RNRandomBytes.seed
  1. Install the library
yarn add @kitzen/react-native-bip39
yarn add buffer ^6.0.3
# You must run this manually before running MetroJs server
# Otherwise you'll get: "Cannot read properties of undefined (reading 'seed')"
cd ./android
./gradlew build
cd .. && npm start
# metro will not automatically apply native changes. Thus please press 'A' to deploy android
  1. Open your yarn.lock file and make sure that dependencies are resolved according to package.json resolutions section.

Contributing

We deeply appreciate the valuable contributions made by our community. To provide feedback or report bugs, kindly open a GitHub issue. For code contributions, explore our "Contributing" guidelines and become part of our open-source community.

Thank you to all the dedicated individuals who contribute; your passion drives our success. Together, we shape the future of web3 industry.

About

bip39 is an enhancement proposal for the Bitcoin network, enabling the generation of a private key through a set of 12-24 mnemonic words

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published