Files
portfolio/node_modules/.cache/babel-loader/242b65a1c8e6b78606eb90fe1e267fac.json
2021-09-20 16:54:47 -04:00

1 line
4.7 KiB
JSON

{"ast":null,"code":"'use strict'; // limit of Crypto.getRandomValues()\n// https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues\n\nvar MAX_BYTES = 65536; // Node supports requesting up to this number of bytes\n// https://github.com/nodejs/node/blob/master/lib/internal/crypto/random.js#L48\n\nvar MAX_UINT32 = 4294967295;\n\nfunction oldBrowser() {\n throw new Error('Secure random number generation is not supported by this browser.\\nUse Chrome, Firefox or Internet Explorer 11');\n}\n\nvar Buffer = require('safe-buffer').Buffer;\n\nvar crypto = global.crypto || global.msCrypto;\n\nif (crypto && crypto.getRandomValues) {\n module.exports = randomBytes;\n} else {\n module.exports = oldBrowser;\n}\n\nfunction randomBytes(size, cb) {\n // phantomjs needs to throw\n if (size > MAX_UINT32) throw new RangeError('requested too many random bytes');\n var bytes = Buffer.allocUnsafe(size);\n\n if (size > 0) {\n // getRandomValues fails on IE if size == 0\n if (size > MAX_BYTES) {\n // this is the max bytes crypto.getRandomValues\n // can do at once see https://developer.mozilla.org/en-US/docs/Web/API/window.crypto.getRandomValues\n for (var generated = 0; generated < size; generated += MAX_BYTES) {\n // buffer.slice automatically checks if the end is past the end of\n // the buffer so we don't have to here\n crypto.getRandomValues(bytes.slice(generated, generated + MAX_BYTES));\n }\n } else {\n crypto.getRandomValues(bytes);\n }\n }\n\n if (typeof cb === 'function') {\n return process.nextTick(function () {\n cb(null, bytes);\n });\n }\n\n return bytes;\n}","map":{"version":3,"sources":["/Users/tylerkoenig/Code/personal/react-scss2/node_modules/randombytes/browser.js"],"names":["MAX_BYTES","MAX_UINT32","oldBrowser","Error","Buffer","require","crypto","global","msCrypto","getRandomValues","module","exports","randomBytes","size","cb","RangeError","bytes","allocUnsafe","generated","slice","process","nextTick"],"mappings":"AAAA,a,CAEA;AACA;;AACA,IAAIA,SAAS,GAAG,KAAhB,C,CAEA;AAC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\n\n// limit of Crypto.getRandomValues()\n// https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues\nvar MAX_BYTES = 65536\n\n// Node supports requesting up to this number of bytes\n// https://github.com/nodejs/node/blob/master/lib/internal/crypto/random.js#L48\nvar MAX_UINT32 = 4294967295\n\nfunction oldBrowser () {\n throw new Error('Secure random number generation is not supported by this browser.\\nUse Chrome, Firefox or Internet Explorer 11')\n}\n\nvar Buffer = require('safe-buffer').Buffer\nvar crypto = global.crypto || global.msCrypto\n\nif (crypto && crypto.getRandomValues) {\n module.exports = randomBytes\n} else {\n module.exports = oldBrowser\n}\n\nfunction randomBytes (size, cb) {\n // phantomjs needs to throw\n if (size > MAX_UINT32) throw new RangeError('requested too many random bytes')\n\n var bytes = Buffer.allocUnsafe(size)\n\n if (size > 0) { // getRandomValues fails on IE if size == 0\n if (size > MAX_BYTES) { // this is the max bytes crypto.getRandomValues\n // can do at once see https://developer.mozilla.org/en-US/docs/Web/API/window.crypto.getRandomValues\n for (var generated = 0; generated < size; generated += MAX_BYTES) {\n // buffer.slice automatically checks if the end is past the end of\n // the buffer so we don't have to here\n crypto.getRandomValues(bytes.slice(generated, generated + MAX_BYTES))\n }\n } else {\n crypto.getRandomValues(bytes)\n }\n }\n\n if (typeof cb === 'function') {\n return process.nextTick(function () {\n cb(null, bytes)\n })\n }\n\n return bytes\n}\n"]},"metadata":{},"sourceType":"script"}