$ npm install react-native-rn-bip39 --save
$ react-native link react-native-rn-bip39
- In XCode, in the project navigator, right click
Libraries
➜Add Files to [your project's name]
- Go to
node_modules
➜react-native-rn-bip39
and addPotatoCrypto.xcodeproj
- In XCode, in the project navigator, select your project. Add
libPotatoCrypto.a
to your project'sBuild Phases
➜Link Binary With Libraries
- Run your project (
Cmd+R
)<
- Open up
android/app/src/main/java/[...]/MainApplication.java
- Add
import com.potato.crypto.PotatoCryptoPackage;
to the imports at the top of the file - Add
new PotatoCryptoPackage()
to the list returned by thegetPackages()
method
- Append the following lines to
android/settings.gradle
:include ':react-native-rn-bip39' project(':react-native-rn-bip39').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-rn-bip39/android')
- Insert the following lines inside the dependencies block in
android/app/build.gradle
:compile project(':react-native-rn-bip39')
import PotatoCrypto from 'react-native-rn-bip39';
const langs = await PotatoCrypto.getLanguages();
const mnemonic = await PotatoCrypto.generate('zhs', entropy.BIP39_ENTROPY_LEN_128);
const isValidate = await PotatoCrypto.validateMnemonic(mnemonic.mnemonic, 'zhs');
const seedHex = await PotatoCrypto.mnemonicToBip39SeedHex(mnemonic.mnemonic);