mirror of
https://github.com/idanoo/GoScrobble
synced 2025-07-01 13:42:20 +00:00
0.2.0 - Mid migration
This commit is contained in:
parent
139e6a915e
commit
7e38fdbd7d
42393 changed files with 5358157 additions and 62 deletions
15
web/node_modules/randomfill/.travis.yml
generated
vendored
Normal file
15
web/node_modules/randomfill/.travis.yml
generated
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
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"
|
1
web/node_modules/randomfill/.zuul.yml
generated
vendored
Normal file
1
web/node_modules/randomfill/.zuul.yml
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
ui: tape
|
21
web/node_modules/randomfill/LICENSE
generated
vendored
Normal file
21
web/node_modules/randomfill/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
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.
|
15
web/node_modules/randomfill/README.md
generated
vendored
Normal file
15
web/node_modules/randomfill/README.md
generated
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
randomfill
|
||||
===
|
||||
|
||||
[](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
|
||||
});
|
||||
```
|
108
web/node_modules/randomfill/browser.js
generated
vendored
Normal file
108
web/node_modules/randomfill/browser.js
generated
vendored
Normal file
|
@ -0,0 +1,108 @@
|
|||
'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)
|
||||
}
|
7
web/node_modules/randomfill/index.js
generated
vendored
Normal file
7
web/node_modules/randomfill/index.js
generated
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
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')
|
||||
}
|
37
web/node_modules/randomfill/package.json
generated
vendored
Normal file
37
web/node_modules/randomfill/package.json
generated
vendored
Normal file
|
@ -0,0 +1,37 @@
|
|||
{
|
||||
"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"
|
||||
}
|
||||
}
|
28
web/node_modules/randomfill/test.js
generated
vendored
Normal file
28
web/node_modules/randomfill/test.js
generated
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
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()
|
||||
})
|
||||
})
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue