From e06ec920f7a5d784e674c4c4b4e6d1da3dc7391d Mon Sep 17 00:00:00 2001 From: Piotr Russ Date: Mon, 16 Nov 2020 00:10:28 +0100 Subject: api, login, auth --- node_modules/brorand/.npmignore | 2 ++ node_modules/brorand/README.md | 26 ++++++++++++++ node_modules/brorand/index.js | 65 +++++++++++++++++++++++++++++++++++ node_modules/brorand/package.json | 60 ++++++++++++++++++++++++++++++++ node_modules/brorand/test/api-test.js | 8 +++++ 5 files changed, 161 insertions(+) create mode 100644 node_modules/brorand/.npmignore create mode 100644 node_modules/brorand/README.md create mode 100644 node_modules/brorand/index.js create mode 100644 node_modules/brorand/package.json create mode 100644 node_modules/brorand/test/api-test.js (limited to 'node_modules/brorand') diff --git a/node_modules/brorand/.npmignore b/node_modules/brorand/.npmignore new file mode 100644 index 0000000..1ca9571 --- /dev/null +++ b/node_modules/brorand/.npmignore @@ -0,0 +1,2 @@ +node_modules/ +npm-debug.log diff --git a/node_modules/brorand/README.md b/node_modules/brorand/README.md new file mode 100644 index 0000000..f80437d --- /dev/null +++ b/node_modules/brorand/README.md @@ -0,0 +1,26 @@ +# Brorand + +#### LICENSE + +This software is licensed under the MIT License. + +Copyright Fedor Indutny, 2014. + +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/brorand/index.js b/node_modules/brorand/index.js new file mode 100644 index 0000000..9a0fff4 --- /dev/null +++ b/node_modules/brorand/index.js @@ -0,0 +1,65 @@ +var r; + +module.exports = function rand(len) { + if (!r) + r = new Rand(null); + + return r.generate(len); +}; + +function Rand(rand) { + this.rand = rand; +} +module.exports.Rand = Rand; + +Rand.prototype.generate = function generate(len) { + return this._rand(len); +}; + +// Emulate crypto API using randy +Rand.prototype._rand = function _rand(n) { + if (this.rand.getBytes) + return this.rand.getBytes(n); + + var res = new Uint8Array(n); + for (var i = 0; i < res.length; i++) + res[i] = this.rand.getByte(); + return res; +}; + +if (typeof self === 'object') { + if (self.crypto && self.crypto.getRandomValues) { + // Modern browsers + Rand.prototype._rand = function _rand(n) { + var arr = new Uint8Array(n); + self.crypto.getRandomValues(arr); + return arr; + }; + } else if (self.msCrypto && self.msCrypto.getRandomValues) { + // IE + Rand.prototype._rand = function _rand(n) { + var arr = new Uint8Array(n); + self.msCrypto.getRandomValues(arr); + return arr; + }; + + // Safari's WebWorkers do not have `crypto` + } else if (typeof window === 'object') { + // Old junk + Rand.prototype._rand = function() { + throw new Error('Not implemented yet'); + }; + } +} else { + // Node.js or Web worker with no crypto support + try { + var crypto = require('crypto'); + if (typeof crypto.randomBytes !== 'function') + throw new Error('Not supported'); + + Rand.prototype._rand = function _rand(n) { + return crypto.randomBytes(n); + }; + } catch (e) { + } +} diff --git a/node_modules/brorand/package.json b/node_modules/brorand/package.json new file mode 100644 index 0000000..df283ef --- /dev/null +++ b/node_modules/brorand/package.json @@ -0,0 +1,60 @@ +{ + "_from": "brorand@^1.0.1", + "_id": "brorand@1.1.0", + "_inBundle": false, + "_integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=", + "_location": "/brorand", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "brorand@^1.0.1", + "name": "brorand", + "escapedName": "brorand", + "rawSpec": "^1.0.1", + "saveSpec": null, + "fetchSpec": "^1.0.1" + }, + "_requiredBy": [ + "/elliptic", + "/miller-rabin" + ], + "_resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", + "_shasum": "12c25efe40a45e3c323eb8675a0a0ce57b22371f", + "_spec": "brorand@^1.0.1", + "_where": "/home/pruss/Dev/3-minute-website/node_modules/elliptic", + "author": { + "name": "Fedor Indutny", + "email": "fedor@indutny.com" + }, + "browser": { + "crypto": false + }, + "bugs": { + "url": "https://github.com/indutny/brorand/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Random number generator for browsers and node.js", + "devDependencies": { + "mocha": "^2.0.1" + }, + "homepage": "https://github.com/indutny/brorand", + "keywords": [ + "Random", + "RNG", + "browser", + "crypto" + ], + "license": "MIT", + "main": "index.js", + "name": "brorand", + "repository": { + "type": "git", + "url": "git+ssh://git@github.com/indutny/brorand.git" + }, + "scripts": { + "test": "mocha --reporter=spec test/**/*-test.js" + }, + "version": "1.1.0" +} diff --git a/node_modules/brorand/test/api-test.js b/node_modules/brorand/test/api-test.js new file mode 100644 index 0000000..b6c876d --- /dev/null +++ b/node_modules/brorand/test/api-test.js @@ -0,0 +1,8 @@ +var brorand = require('../'); +var assert = require('assert'); + +describe('Brorand', function() { + it('should generate random numbers', function() { + assert.equal(brorand(100).length, 100); + }); +}); -- cgit v1.2.3