-
Notifications
You must be signed in to change notification settings - Fork 447
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error while using bip39.generateMnemonic(128) in react native #189
Comments
solution for this issue: npm install react-native-crypto const entropy = randomBytes(16); |
@rachna-khatnawlia I'm getting this error
|
@Ekaanth you might be missing assert library as a dependency |
I recommend using Expo's Crypto module: https://docs.expo.dev/versions/latest/sdk/crypto My use case was something like this: global.Buffer = require('buffer').Buffer;
import { entropyToMnemonic } from 'bip39';
import * as Crypto from 'expo-crypto';
export function generateMnemonicList(): string[] {
const entropy = Buffer.from(Crypto.getRandomBytes(32));
return entropyToMnemonic(entropy).split(' ');
} It works pretty good on IOS. |
enviromment doesn't have random bytes function while using bip39.generateMnemonic(128) in react native
The text was updated successfully, but these errors were encountered: