// Don't do this in production. You're going to want to patch in
// https://github.com/mvayngrib/react-native-randombytes or similar.
global.crypto = {
getRandomValues(byteArray) {
for (let i = 0; i < byteArray.length; i++) {
byteArray[i] = Math.floor(256 * Math.random());
}
},
};
What is the proper way to patch in react-native-randombytes in production as referred to above?
There is also a react-natvie-crypto by the same author derived from crypto-browserify and using react-native-randombytes. It currently uses rn-nodify, generates a bunch of shim code. Could this be used the ReactNativify way, maybe be a better alternative?
Hi, thanks for ReactNativify!
In global.js#L13 the comment mentions:
in transformer.js there is:
I have 2 questions related to this:
What is the proper way to patch in
react-native-randombytes
in production as referred to above?There is also a react-natvie-crypto by the same author derived from
crypto-browserify
and usingreact-native-randombytes
. It currently usesrn-nodify
, generates a bunch of shim code. Could this be used the ReactNativify way, maybe be a better alternative?I have asked the second question on the
react-native-crypto
project as well: https://github.com/mvayngrib/react-native-crypto/issues/16Thanks.
PS I have also posted this on stackoverflow: https://stackoverflow.com/q/45301900/8295283