fix in order to support react native environment

This commit is contained in:
Jordan Baczuk 2020-01-15 13:23:09 -07:00 committed by Jordan Baczuk
parent ee2518544c
commit a53b45a815

View File

@ -47,7 +47,7 @@ not, since the functions are different and does
not convert using browserify */
function randomBytes(size) {
var arr = new Uint8Array(size);
if (typeof window === 'undefined') {
if (typeof browserCrypto.getRandomValues === 'undefined') {
return Buffer.from(nodeCrypto.randomBytes(size));
} else {
browserCrypto.getRandomValues(arr);