diff options
Diffstat (limited to 'node_modules/randomfill')
-rw-r--r-- | node_modules/randomfill/.travis.yml | 15 | ||||
-rw-r--r-- | node_modules/randomfill/.zuul.yml | 1 | ||||
-rw-r--r-- | node_modules/randomfill/LICENSE | 21 | ||||
-rw-r--r-- | node_modules/randomfill/README.md | 15 | ||||
-rw-r--r-- | node_modules/randomfill/browser.js | 108 | ||||
-rw-r--r-- | node_modules/randomfill/index.js | 7 | ||||
-rw-r--r-- | node_modules/randomfill/package.json | 37 | ||||
-rw-r--r-- | node_modules/randomfill/test.js | 28 |
8 files changed, 0 insertions, 232 deletions
diff --git a/node_modules/randomfill/.travis.yml b/node_modules/randomfill/.travis.yml deleted file mode 100644 index 69fdf7130..000000000 --- a/node_modules/randomfill/.travis.yml +++ /dev/null @@ -1,15 +0,0 @@ -sudo: false -language: node_js -matrix: - include: - - node_js: '7' - env: TEST_SUITE=test - - node_js: '6' - env: TEST_SUITE=test - - node_js: '5' - env: TEST_SUITE=test - - node_js: '4' - env: TEST_SUITE=test - - node_js: '4' - env: TEST_SUITE=phantom -script: "npm run-script $TEST_SUITE" diff --git a/node_modules/randomfill/.zuul.yml b/node_modules/randomfill/.zuul.yml deleted file mode 100644 index 96d9cfbd3..000000000 --- a/node_modules/randomfill/.zuul.yml +++ /dev/null @@ -1 +0,0 @@ -ui: tape diff --git a/node_modules/randomfill/LICENSE b/node_modules/randomfill/LICENSE deleted file mode 100644 index fea9d48a4..000000000 --- a/node_modules/randomfill/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2017 crypto-browserify - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/node_modules/randomfill/README.md b/node_modules/randomfill/README.md deleted file mode 100644 index 1ae13adfa..000000000 --- a/node_modules/randomfill/README.md +++ /dev/null @@ -1,15 +0,0 @@ -randomfill -=== - -[![Version](http://img.shields.io/npm/v/randomfill.svg)](https://www.npmjs.org/package/randomfill) - -randomfill from node that works in the browser. In node you just get crypto.randomBytes, but in the browser it uses .crypto/msCrypto.getRandomValues - -```js -var randomFill = require('randomfill'); -var buf -randomFill.randomFillSync(16);//get 16 random bytes -randomFill.randomFill(16, function (err, resp) { - // resp is 16 random bytes -}); -``` diff --git a/node_modules/randomfill/browser.js b/node_modules/randomfill/browser.js deleted file mode 100644 index ce34a693e..000000000 --- a/node_modules/randomfill/browser.js +++ /dev/null @@ -1,108 +0,0 @@ -'use strict' - -function oldBrowser () { - throw new Error('secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11') -} -var safeBuffer = require('safe-buffer') -var randombytes = require('randombytes') -var Buffer = safeBuffer.Buffer -var kBufferMaxLength = safeBuffer.kMaxLength -var crypto = global.crypto || global.msCrypto -var kMaxUint32 = Math.pow(2, 32) - 1 -function assertOffset (offset, length) { - if (typeof offset !== 'number' || offset !== offset) { // eslint-disable-line no-self-compare - throw new TypeError('offset must be a number') - } - - if (offset > kMaxUint32 || offset < 0) { - throw new TypeError('offset must be a uint32') - } - - if (offset > kBufferMaxLength || offset > length) { - throw new RangeError('offset out of range') - } -} - -function assertSize (size, offset, length) { - if (typeof size !== 'number' || size !== size) { // eslint-disable-line no-self-compare - throw new TypeError('size must be a number') - } - - if (size > kMaxUint32 || size < 0) { - throw new TypeError('size must be a uint32') - } - - if (size + offset > length || size > kBufferMaxLength) { - throw new RangeError('buffer too small') - } -} -if ((crypto && crypto.getRandomValues) || !process.browser) { - exports.randomFill = randomFill - exports.randomFillSync = randomFillSync -} else { - exports.randomFill = oldBrowser - exports.randomFillSync = oldBrowser -} -function randomFill (buf, offset, size, cb) { - if (!Buffer.isBuffer(buf) && !(buf instanceof global.Uint8Array)) { - throw new TypeError('"buf" argument must be a Buffer or Uint8Array') - } - - if (typeof offset === 'function') { - cb = offset - offset = 0 - size = buf.length - } else if (typeof size === 'function') { - cb = size - size = buf.length - offset - } else if (typeof cb !== 'function') { - throw new TypeError('"cb" argument must be a function') - } - assertOffset(offset, buf.length) - assertSize(size, offset, buf.length) - return actualFill(buf, offset, size, cb) -} - -function actualFill (buf, offset, size, cb) { - if (process.browser) { - var ourBuf = buf.buffer - var uint = new Uint8Array(ourBuf, offset, size) - crypto.getRandomValues(uint) - if (cb) { - process.nextTick(function () { - cb(null, buf) - }) - return - } - return buf - } - if (cb) { - randombytes(size, function (err, bytes) { - if (err) { - return cb(err) - } - bytes.copy(buf, offset) - cb(null, buf) - }) - return - } - var bytes = randombytes(size) - bytes.copy(buf, offset) - return buf -} -function randomFillSync (buf, offset, size) { - if (typeof offset === 'undefined') { - offset = 0 - } - if (!Buffer.isBuffer(buf) && !(buf instanceof global.Uint8Array)) { - throw new TypeError('"buf" argument must be a Buffer or Uint8Array') - } - - assertOffset(offset, buf.length) - - if (size === undefined) size = buf.length - offset - - assertSize(size, offset, buf.length) - - return actualFill(buf, offset, size) -} diff --git a/node_modules/randomfill/index.js b/node_modules/randomfill/index.js deleted file mode 100644 index e2b5f7a70..000000000 --- a/node_modules/randomfill/index.js +++ /dev/null @@ -1,7 +0,0 @@ -var crypto = require('crypto') -if (typeof crypto.randomFill === 'function' && typeof crypto.randomFillSync === 'function') { - exports.randomFill = crypto.randomFill - exports.randomFillSync = crypto.randomFillSync -} else { - module.exports = require('./browser') -} diff --git a/node_modules/randomfill/package.json b/node_modules/randomfill/package.json deleted file mode 100644 index ce4be97d8..000000000 --- a/node_modules/randomfill/package.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "name": "randomfill", - "version": "1.0.4", - "description": "random fill from browserify stand alone", - "main": "index.js", - "scripts": { - "test": "standard && node test.js | tspec", - "phantom": "zuul --phantom -- test.js", - "local": "zuul --local --no-coverage -- test.js" - }, - "repository": { - "type": "git", - "url": "https://github.com/crypto-browserify/randomfill.git" - }, - "keywords": [ - "crypto", - "random" - ], - "author": "", - "license": "MIT", - "bugs": { - "url": "https://github.com/crypto-browserify/randomfill/issues" - }, - "homepage": "https://github.com/crypto-browserify/randomfill", - "browser": "browser.js", - "devDependencies": { - "phantomjs": "^1.9.9", - "standard": "^10.0.2", - "tap-spec": "^2.1.2", - "tape": "^4.6.3", - "zuul": "^3.7.2" - }, - "dependencies": { - "randombytes": "^2.0.5", - "safe-buffer": "^5.1.0" - } -} diff --git a/node_modules/randomfill/test.js b/node_modules/randomfill/test.js deleted file mode 100644 index eff227c2e..000000000 --- a/node_modules/randomfill/test.js +++ /dev/null @@ -1,28 +0,0 @@ -var test = require('tape') -var crypto = require('./browser') -var Buffer = require('safe-buffer').Buffer -test('sync', function (t) { - t.test('first', function (t) { - const buf = Buffer.alloc(10) - const before = buf.toString('hex') - crypto.randomFillSync(buf, 5, 5) - const after = buf.toString('hex') - t.notEqual(before, after) - t.equal(before.slice(0, 10), after.slice(0, 10)) - t.end() - }) -}) -test('async', function (t) { - t.test('first', function (t) { - const buf = Buffer.alloc(10) - const before = buf.toString('hex') - crypto.randomFill(buf, 5, 5, function (err, bufa) { - t.error(err) - const after = bufa.toString('hex') - t.notEqual(before, after) - t.equal(before.slice(0, 10), after.slice(0, 10)) - t.ok(buf === bufa, 'same buffer') - t.end() - }) - }) -}) |