fix in order to support react native environment
This commit is contained in:
parent
ee2518544c
commit
a53b45a815
|
@ -47,7 +47,7 @@ not, since the functions are different and does
|
||||||
not convert using browserify */
|
not convert using browserify */
|
||||||
function randomBytes(size) {
|
function randomBytes(size) {
|
||||||
var arr = new Uint8Array(size);
|
var arr = new Uint8Array(size);
|
||||||
if (typeof window === 'undefined') {
|
if (typeof browserCrypto.getRandomValues === 'undefined') {
|
||||||
return Buffer.from(nodeCrypto.randomBytes(size));
|
return Buffer.from(nodeCrypto.randomBytes(size));
|
||||||
} else {
|
} else {
|
||||||
browserCrypto.getRandomValues(arr);
|
browserCrypto.getRandomValues(arr);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user