bitcoinjs / bip39

JavaScript implementation of Bitcoin BIP39: Mnemonic code for generating deterministic keys
ISC License
1.11k stars 447 forks source link

Error while using bip39.generateMnemonic(128) in react native #189

Open rachna-khatnawlia opened 1 year ago

rachna-khatnawlia commented 1 year ago

enviromment doesn't have random bytes function while using bip39.generateMnemonic(128) in react native

rachna-khatnawlia commented 1 year ago

solution for this issue:

npm install react-native-crypto import { randomBytes } from 'react-native-crypto';

const entropy = randomBytes(16); const mnemonic = bip39.entropyToMnemonic(entropy);

Ekaanth commented 1 year ago

@rachna-khatnawlia I'm getting this error ` assert could not be found within the project or in these directories: node_modules 1 | var unorm = require('unorm')

2 | var assert = require('assert') ` did you get the same error ?

lumsdnb commented 1 year ago

@Ekaanth you might be missing assert library as a dependency

Somnath-Chattaraj commented 3 months ago

I am getting error while using bip39.generateMnemonic() in react. Below is the error image. Please help.

Screenshot 2024-08-17 at 10 20 28 PM