diff --git a/lib/core/utils/uuid.js b/lib/core/utils/uuid.js index cf2d2e5f9b..de8a9eb66e 100644 --- a/lib/core/utils/uuid.js +++ b/lib/core/utils/uuid.js @@ -23,15 +23,6 @@ if (!_rng && _crypto && _crypto.getRandomValues) { }; } -try { - if (!_rng) { - const nodeCrypto = require('crypto'); - _rng = () => nodeCrypto.randomBytes(16); - } -} catch (e) { - /* do nothing */ -} - if (!_rng) { // Math.random()-based (RNG) // diff --git a/test/node/uuid.js b/test/node/uuid.js deleted file mode 100644 index 905a114722..0000000000 --- a/test/node/uuid.js +++ /dev/null @@ -1,19 +0,0 @@ -var assert = require('chai').assert; -var sinon = require('sinon'); -var proxyquire = require('proxyquire'); -var crypto = require('crypto'); // Node package - -// 16 byte array, all 0's -var returnVal = new Array(16).fill(0); -var cryptoStub = sinon.stub(crypto, 'randomBytes').returns(returnVal); - -describe('uuid.v4', function() { - var axe = proxyquire('../../', { crypto: cryptoStub }); - var uuidV4 = axe.utils.uuid.v4; - - it('uses node crypto', function() { - var uuid = uuidV4(); - assert.isTrue(cryptoStub.randomBytes.called); - assert.deepEqual(uuid, '00000000-0000-4000-8000-000000000000'); - }); -});