https://github.com/potato-coin/react-native-potato-crypto
react native bip39 c++ module
https://github.com/potato-coin/react-native-potato-crypto
bip39 c-plus-plus react-native
Last synced: 7 months ago
JSON representation
react native bip39 c++ module
- Host: GitHub
- URL: https://github.com/potato-coin/react-native-potato-crypto
- Owner: potato-coin
- Created: 2019-04-01T10:12:38.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-03-04T03:57:25.000Z (over 2 years ago)
- Last Synced: 2025-03-18T13:13:58.077Z (7 months ago)
- Topics: bip39, c-plus-plus, react-native
- Language: C++
- Homepage:
- Size: 2.13 MB
- Stars: 4
- Watchers: 1
- Forks: 2
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# react-native-potato-crypto
## Getting started
`$ npm install react-native-potato-crypto --save`
### Mostly automatic installation
`$ react-native link react-native-potato-crypto`
### Manual installation
#### iOS
1. In XCode, in the project navigator, right click `Libraries` ➜ `Add Files to [your project's name]`
2. Go to `node_modules` ➜ `react-native-potato-crypto` and add `PotatoCrypto.xcodeproj`
3. In XCode, in the project navigator, select your project. Add `libPotatoCrypto.a` to your project's `Build Phases` ➜ `Link Binary With Libraries`
4. Run your project (`Cmd+R`)<#### Android
1. 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 the `getPackages()` method
2. Append the following lines to `android/settings.gradle`:
```
include ':react-native-potato-crypto'
project(':react-native-potato-crypto').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-potato-crypto/android')
```
3. Insert the following lines inside the dependencies block in `android/app/build.gradle`:
```
compile project(':react-native-potato-crypto')
```## Usage
```javascript
import PotatoCrypto from 'react-native-potato-crypto';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);```