UNPKG

orionsoft-react-scripts

Version:

Orionsoft Configuration and scripts for Create React App.

27 lines (25 loc) 800 B
(function() { var g = ('undefined' === typeof window ? global : window) || {} _crypto = ( g.crypto || g.msCrypto || require('crypto') ) module.exports = function(size) { // Modern Browsers if(_crypto.getRandomValues) { var bytes = new Buffer(size); //in browserify, this is an extended Uint8Array /* This will not work in older browsers. * See https://developer.mozilla.org/en-US/docs/Web/API/window.crypto.getRandomValues */ _crypto.getRandomValues(bytes); return bytes; } else if (_crypto.randomBytes) { return _crypto.randomBytes(size) } else throw new Error( 'secure random number generation not supported by this browser\n'+ 'use chrome, FireFox or Internet Explorer 11' ) } }())