aboutsummaryrefslogtreecommitdiff
path: root/node_modules/uid-safe
diff options
context:
space:
mode:
authorHumairAK <humair88@hotmail.com>2016-07-21 06:24:24 +0000
committerHumairAK <humair88@hotmail.com>2016-07-21 06:24:24 +0000
commit2549ee68e435b77e7e07d3ea95363268cbfe9164 (patch)
tree8f48f6447a4377f1bc15ae7d73dbab3337044720 /node_modules/uid-safe
parentd694c1a73f77def42c17b58027f046bf9e1af809 (diff)
Added other dependencies for authentication, made minor adjustments to index.js, added templating for exams, will remove dependencie modules later, keep for now
Diffstat (limited to 'node_modules/uid-safe')
-rw-r--r--node_modules/uid-safe/HISTORY.md41
-rw-r--r--node_modules/uid-safe/LICENSE22
-rw-r--r--node_modules/uid-safe/README.md77
-rw-r--r--node_modules/uid-safe/index.js96
-rw-r--r--node_modules/uid-safe/package.json114
5 files changed, 350 insertions, 0 deletions
diff --git a/node_modules/uid-safe/HISTORY.md b/node_modules/uid-safe/HISTORY.md
new file mode 100644
index 0000000..365c92f
--- /dev/null
+++ b/node_modules/uid-safe/HISTORY.md
@@ -0,0 +1,41 @@
+2.1.1 / 2016-05-04
+==================
+
+ * deps: base64-url@1.2.2
+
+2.1.0 / 2016-01-17
+==================
+
+ * Use `random-bytes` for byte source
+
+2.0.0 / 2015-05-08
+==================
+
+ * Use global `Promise` when returning a promise
+
+1.1.0 / 2015-02-01
+==================
+
+ * Use `crypto.randomBytes`, if available
+ * deps: base64-url@1.2.1
+
+1.0.3 / 2015-01-31
+==================
+
+ * Fix error branch that would throw
+ * deps: base64-url@1.2.0
+
+1.0.2 / 2015-01-08
+==================
+
+ * Remove dependency on `mz`
+
+1.0.1 / 2014-06-18
+==================
+
+ * Remove direct `bluebird` dependency
+
+1.0.0 / 2014-06-18
+==================
+
+ * Initial release
diff --git a/node_modules/uid-safe/LICENSE b/node_modules/uid-safe/LICENSE
new file mode 100644
index 0000000..7a7a4e1
--- /dev/null
+++ b/node_modules/uid-safe/LICENSE
@@ -0,0 +1,22 @@
+The MIT License (MIT)
+
+Copyright (c) 2014 Jonathan Ong <me@jongleberry.com>
+Copyright (c) 2015-2016 Douglas Christopher Wilson <doug@somethingdoug.com>
+
+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/uid-safe/README.md b/node_modules/uid-safe/README.md
new file mode 100644
index 0000000..fa02be8
--- /dev/null
+++ b/node_modules/uid-safe/README.md
@@ -0,0 +1,77 @@
+# uid-safe
+
+[![NPM Version][npm-image]][npm-url]
+[![NPM Downloads][downloads-image]][downloads-url]
+[![Node.js Version][node-version-image]][node-version-url]
+[![Build Status][travis-image]][travis-url]
+[![Test Coverage][coveralls-image]][coveralls-url]
+
+URL and cookie safe UIDs
+
+Create cryptographically secure UIDs safe for both cookie and URL usage.
+This is in contrast to modules such as [rand-token](https://www.npmjs.com/package/rand-token)
+and [uid2](https://www.npmjs.com/package/uid2) whose UIDs are actually skewed
+due to the use of `%` and unnecessarily truncate the UID.
+Use this if you could still use UIDs with `-` and `_` in them.
+
+## Installation
+
+```sh
+$ npm install uid-safe
+```
+
+## API
+
+```js
+var uid = require('uid-safe')
+```
+
+### uid(byteLength, callback)
+
+Asynchronously create a UID with a specific byte length. Because `base64`
+encoding is used underneath, this is not the string length. For example,
+to create a UID of length 24, you want a byte length of 18.
+
+```js
+uid(18, function (err, string) {
+ if (err) throw err
+ // do something with the string
+})
+```
+
+### uid(byteLength)
+
+Asynchronously create a UID with a specific byte length and return a
+`Promise`.
+
+**Note**: To use promises in Node.js _prior to 0.12_, promises must be
+"polyfilled" using `global.Promise = require('bluebird')`.
+
+```js
+uid(18).then(function (string) {
+ // do something with the string
+})
+```
+
+### uid.sync(byteLength)
+
+A synchronous version of above.
+
+```js
+var string = uid.sync(18)
+```
+
+## License
+
+[MIT](LICENSE)
+
+[npm-image]: https://img.shields.io/npm/v/uid-safe.svg
+[npm-url]: https://npmjs.org/package/uid-safe
+[node-version-image]: https://img.shields.io/node/v/uid-safe.svg
+[node-version-url]: https://nodejs.org/en/download/
+[travis-image]: https://img.shields.io/travis/crypto-utils/uid-safe/master.svg
+[travis-url]: https://travis-ci.org/crypto-utils/uid-safe
+[coveralls-image]: https://img.shields.io/coveralls/crypto-utils/uid-safe/master.svg
+[coveralls-url]: https://coveralls.io/r/crypto-utils/uid-safe?branch=master
+[downloads-image]: https://img.shields.io/npm/dm/uid-safe.svg
+[downloads-url]: https://npmjs.org/package/uid-safe
diff --git a/node_modules/uid-safe/index.js b/node_modules/uid-safe/index.js
new file mode 100644
index 0000000..9bef704
--- /dev/null
+++ b/node_modules/uid-safe/index.js
@@ -0,0 +1,96 @@
+/*!
+ * uid-safe
+ * Copyright(c) 2014 Jonathan Ong
+ * Copyright(c) 2015-2016 Douglas Christopher Wilson
+ * MIT Licensed
+ */
+
+'use strict'
+
+/**
+ * Module dependencies.
+ * @private
+ */
+
+var escape = require('base64-url').escape
+var randomBytes = require('random-bytes')
+
+/**
+ * Module exports.
+ * @public
+ */
+
+module.exports = uid
+module.exports.sync = uidSync
+
+/**
+ * Create a unique ID.
+ *
+ * @param {number} length
+ * @param {function} [callback]
+ * @return {Promise}
+ * @public
+ */
+
+function uid(length, callback) {
+ // validate callback is a function, if provided
+ if (callback !== undefined && typeof callback !== 'function') {
+ throw new TypeError('argument callback must be a function')
+ }
+
+ // require the callback without promises
+ if (!callback && !global.Promise) {
+ throw new TypeError('argument callback is required')
+ }
+
+ if (callback) {
+ // classic callback style
+ return generateUid(length, callback)
+ }
+
+ return new Promise(function executor(resolve, reject) {
+ generateUid(length, function onUid(err, str) {
+ if (err) return reject(err)
+ resolve(str)
+ })
+ })
+}
+
+/**
+ * Create a unique ID sync.
+ *
+ * @param {number} length
+ * @return {string}
+ * @public
+ */
+
+function uidSync(length) {
+ return toString(randomBytes.sync(length))
+}
+
+/**
+ * Generate a unique ID string.
+ *
+ * @param {number} length
+ * @param {function} callback
+ * @private
+ */
+
+function generateUid(length, callback) {
+ randomBytes(length, function (err, buf) {
+ if (err) return callback(err)
+ callback(null, toString(buf))
+ })
+}
+
+/**
+ * Change a Buffer into a string.
+ *
+ * @param {Buffer} buf
+ * @return {string}
+ * @private
+ */
+
+function toString(buf) {
+ return escape(buf.toString('base64'))
+}
diff --git a/node_modules/uid-safe/package.json b/node_modules/uid-safe/package.json
new file mode 100644
index 0000000..005b2f9
--- /dev/null
+++ b/node_modules/uid-safe/package.json
@@ -0,0 +1,114 @@
+{
+ "_args": [
+ [
+ "uid-safe@~2.1.1",
+ "/home/humair/School/csc309/a4/solutions_repo/node_modules/express-session"
+ ]
+ ],
+ "_from": "uid-safe@>=2.1.1 <2.2.0",
+ "_id": "uid-safe@2.1.1",
+ "_inCache": true,
+ "_installable": true,
+ "_location": "/uid-safe",
+ "_nodeVersion": "4.4.3",
+ "_npmOperationalInternal": {
+ "host": "packages-12-west.internal.npmjs.com",
+ "tmp": "tmp/uid-safe-2.1.1.tgz_1462417218771_0.08699076832272112"
+ },
+ "_npmUser": {
+ "email": "doug@somethingdoug.com",
+ "name": "dougwilson"
+ },
+ "_npmVersion": "2.15.1",
+ "_phantomChildren": {},
+ "_requested": {
+ "name": "uid-safe",
+ "raw": "uid-safe@~2.1.1",
+ "rawSpec": "~2.1.1",
+ "scope": null,
+ "spec": ">=2.1.1 <2.2.0",
+ "type": "range"
+ },
+ "_requiredBy": [
+ "/express-session"
+ ],
+ "_resolved": "https://registry.npmjs.org/uid-safe/-/uid-safe-2.1.1.tgz",
+ "_shasum": "3dbf9436b528be9f52882c05a6216c3763db3666",
+ "_shrinkwrap": null,
+ "_spec": "uid-safe@~2.1.1",
+ "_where": "/home/humair/School/csc309/a4/solutions_repo/node_modules/express-session",
+ "bugs": {
+ "url": "https://github.com/crypto-utils/uid-safe/issues"
+ },
+ "contributors": [
+ {
+ "name": "Douglas Christopher Wilson",
+ "email": "doug@somethingdoug.com"
+ },
+ {
+ "name": "Jonathan Ong",
+ "email": "me@jongleberry.com",
+ "url": "http://jongleberry.com"
+ }
+ ],
+ "dependencies": {
+ "base64-url": "1.2.2",
+ "random-bytes": "~1.0.0"
+ },
+ "description": "URL and cookie safe UIDs",
+ "devDependencies": {
+ "bluebird": "3.3.5",
+ "istanbul": "0.4.3",
+ "mocha": "2.4.5"
+ },
+ "directories": {},
+ "dist": {
+ "shasum": "3dbf9436b528be9f52882c05a6216c3763db3666",
+ "tarball": "https://registry.npmjs.org/uid-safe/-/uid-safe-2.1.1.tgz"
+ },
+ "engines": {
+ "node": ">= 0.8"
+ },
+ "files": [
+ "HISTORY.md",
+ "LICENSE",
+ "README.md",
+ "index.js"
+ ],
+ "gitHead": "5cb17ae9451505ac823877e641a6f080731822ea",
+ "homepage": "https://github.com/crypto-utils/uid-safe#readme",
+ "keywords": [
+ "generator",
+ "random",
+ "safe",
+ "uid"
+ ],
+ "license": "MIT",
+ "maintainers": [
+ {
+ "name": "dougwilson",
+ "email": "doug@somethingdoug.com"
+ },
+ {
+ "name": "fishrock123",
+ "email": "fishrock123@rocketmail.com"
+ },
+ {
+ "name": "jongleberry",
+ "email": "jonathanrichardong@gmail.com"
+ }
+ ],
+ "name": "uid-safe",
+ "optionalDependencies": {},
+ "readme": "ERROR: No README data found!",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/crypto-utils/uid-safe.git"
+ },
+ "scripts": {
+ "test": "mocha --trace-deprecation --reporter spec --bail --check-leaks test/",
+ "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --trace-deprecation --reporter dot --check-leaks test/",
+ "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --trace-deprecation --reporter spec --check-leaks test/"
+ },
+ "version": "2.1.1"
+}