aboutsummaryrefslogtreecommitdiff
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
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
-rw-r--r--.idea/solutions_repo.iml1
-rw-r--r--node_modules/base64-url/LICENSE15
-rw-r--r--node_modules/base64-url/README.md55
-rw-r--r--node_modules/base64-url/index.js24
-rw-r--r--node_modules/base64-url/package.json101
-rw-r--r--node_modules/connect-flash/.travis.yml6
-rw-r--r--node_modules/connect-flash/LICENSE20
-rw-r--r--node_modules/connect-flash/README.md73
-rw-r--r--node_modules/connect-flash/lib/flash.js82
-rw-r--r--node_modules/connect-flash/lib/index.js4
-rw-r--r--node_modules/connect-flash/package.json87
-rw-r--r--node_modules/crc/LICENSE22
-rw-r--r--node_modules/crc/README.md100
-rw-r--r--node_modules/crc/lib/crc1.js24
-rw-r--r--node_modules/crc/lib/crc16.js27
-rw-r--r--node_modules/crc/lib/crc16_ccitt.js27
-rw-r--r--node_modules/crc/lib/crc16_kermit.js27
-rw-r--r--node_modules/crc/lib/crc16_modbus.js27
-rw-r--r--node_modules/crc/lib/crc16_xmodem.js31
-rw-r--r--node_modules/crc/lib/crc24.js27
-rw-r--r--node_modules/crc/lib/crc32.js27
-rw-r--r--node_modules/crc/lib/crc8.js27
-rw-r--r--node_modules/crc/lib/crc8_1wire.js27
-rw-r--r--node_modules/crc/lib/define_crc.js16
-rw-r--r--node_modules/crc/lib/index.js14
-rw-r--r--node_modules/crc/package.json93
-rw-r--r--node_modules/csrf/HISTORY.md86
-rw-r--r--node_modules/csrf/LICENSE22
-rw-r--r--node_modules/csrf/README.md126
-rw-r--r--node_modules/csrf/index.js139
-rw-r--r--node_modules/csrf/package.json118
-rw-r--r--node_modules/csurf/HISTORY.md158
-rw-r--r--node_modules/csurf/LICENSE23
-rw-r--r--node_modules/csurf/README.md238
-rw-r--r--node_modules/csurf/index.js306
-rw-r--r--node_modules/csurf/package.json135
-rw-r--r--node_modules/express-session/HISTORY.md314
-rw-r--r--node_modules/express-session/LICENSE24
-rw-r--r--node_modules/express-session/README.md655
-rw-r--r--node_modules/express-session/index.js637
-rw-r--r--node_modules/express-session/package.json121
-rw-r--r--node_modules/express-session/session/cookie.js129
-rw-r--r--node_modules/express-session/session/memory.js185
-rw-r--r--node_modules/express-session/session/session.js142
-rw-r--r--node_modules/express-session/session/store.js94
-rw-r--r--node_modules/on-headers/HISTORY.md16
-rw-r--r--node_modules/on-headers/LICENSE22
-rw-r--r--node_modules/on-headers/README.md76
-rw-r--r--node_modules/on-headers/index.js93
-rw-r--r--node_modules/on-headers/package.json95
-rw-r--r--node_modules/passport-strategy/.jshintrc20
-rw-r--r--node_modules/passport-strategy/.travis.yml15
-rw-r--r--node_modules/passport-strategy/LICENSE20
-rw-r--r--node_modules/passport-strategy/README.md61
-rw-r--r--node_modules/passport-strategy/lib/index.js15
-rw-r--r--node_modules/passport-strategy/lib/strategy.js28
-rw-r--r--node_modules/passport-strategy/package.json97
-rw-r--r--node_modules/passport/LICENSE20
-rw-r--r--node_modules/passport/lib/authenticator.js461
-rw-r--r--node_modules/passport/lib/errors/authenticationerror.js23
-rw-r--r--node_modules/passport/lib/framework/connect.js39
-rw-r--r--node_modules/passport/lib/http/request.js108
-rw-r--r--node_modules/passport/lib/index.js26
-rw-r--r--node_modules/passport/lib/middleware/authenticate.js351
-rw-r--r--node_modules/passport/lib/middleware/initialize.js55
-rw-r--r--node_modules/passport/lib/strategies/session.js79
-rw-r--r--node_modules/passport/package.json97
-rw-r--r--node_modules/pause/.npmignore4
-rw-r--r--node_modules/pause/History.md5
-rw-r--r--node_modules/pause/Makefile7
-rw-r--r--node_modules/pause/Readme.md29
-rw-r--r--node_modules/pause/index.js29
-rw-r--r--node_modules/pause/package.json57
-rw-r--r--node_modules/random-bytes/HISTORY.md4
-rw-r--r--node_modules/random-bytes/LICENSE21
-rw-r--r--node_modules/random-bytes/README.md77
-rw-r--r--node_modules/random-bytes/index.js101
-rw-r--r--node_modules/random-bytes/package.json94
-rw-r--r--node_modules/rndm/LICENSE22
-rw-r--r--node_modules/rndm/README.md27
-rw-r--r--node_modules/rndm/index.js25
-rw-r--r--node_modules/rndm/package.json99
-rw-r--r--node_modules/tsscmp/.npmignore1
-rw-r--r--node_modules/tsscmp/.travis.yml14
-rw-r--r--node_modules/tsscmp/LICENSE21
-rw-r--r--node_modules/tsscmp/README.md48
-rw-r--r--node_modules/tsscmp/appveyor.yml29
-rw-r--r--node_modules/tsscmp/lib/index.js33
-rw-r--r--node_modules/tsscmp/package.json87
-rw-r--r--node_modules/tsscmp/test/benchmark/index.js30
-rw-r--r--node_modules/tsscmp/test/unit/index.js69
-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
-rw-r--r--node_simple.js4
-rw-r--r--package.json4
-rw-r--r--routes/index.js5
-rw-r--r--views/exams.hbs44
100 files changed, 7756 insertions, 37 deletions
diff --git a/.idea/solutions_repo.iml b/.idea/solutions_repo.iml
index 004ef7c..0f990e1 100644
--- a/.idea/solutions_repo.iml
+++ b/.idea/solutions_repo.iml
@@ -5,5 +5,6 @@
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="solutions_repo node_modules" level="project" />
+ <orderEntry type="library" name="solutions_repo node_modules" level="project" />
</component>
</module> \ No newline at end of file
diff --git a/node_modules/base64-url/LICENSE b/node_modules/base64-url/LICENSE
new file mode 100644
index 0000000..9549143
--- /dev/null
+++ b/node_modules/base64-url/LICENSE
@@ -0,0 +1,15 @@
+The ISC License
+
+Copyright (c) 2014, Joaquim José F. Serafim
+
+Permission to use, copy, modify, and/or distribute this software for any
+purpose with or without fee is hereby granted, provided that the above
+copyright notice and this permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
+IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/node_modules/base64-url/README.md b/node_modules/base64-url/README.md
new file mode 100644
index 0000000..d9368c8
--- /dev/null
+++ b/node_modules/base64-url/README.md
@@ -0,0 +1,55 @@
+# base64-url
+
+Base64 encode, decode, escape and unescape for URL applications.
+
+<a href="https://nodei.co/npm/base64-url/"><img src="https://nodei.co/npm/base64-url.png?downloads=true"></a>
+
+[![Build Status](https://travis-ci.org/joaquimserafim/base64-url.png?branch=master)](https://travis-ci.org/joaquimserafim/base64-url)
+
+
+## API
+
+```js
+base64url.encode('Node.js is awesome.');
+// returns Tm9kZS5qcyBpcyBhd2Vzb21lLg
+
+base64url.decode('Tm9kZS5qcyBpcyBhd2Vzb21lLg');
+// returns Node.js is awesome.
+
+base64url.escape('This+is/goingto+escape==');
+// returns This-is_goingto-escape
+
+base64url.unescape('This-is_goingto-escape');
+// returns This+is/goingto+escape==
+```
+
+
+## Development
+
+**this projet has been set up with a precommit that forces you to follow a code style, no jshint issues and 100% of code coverage before commit**
+
+
+to run test
+``` js
+npm test
+```
+
+to run jshint
+``` js
+npm run jshint
+```
+
+to run code style
+``` js
+npm run code-style
+```
+
+to check code coverage
+``` js
+npm run check-coverage
+```
+
+to open the code coverage report
+``` js
+npm run coverage
+```
diff --git a/node_modules/base64-url/index.js b/node_modules/base64-url/index.js
new file mode 100644
index 0000000..34968ae
--- /dev/null
+++ b/node_modules/base64-url/index.js
@@ -0,0 +1,24 @@
+'use strict';
+
+var base64url = module.exports;
+
+base64url.unescape = function unescape (str) {
+ return (str + Array(5 - str.length % 4)
+ .join('='))
+ .replace(/\-/g, '+')
+ .replace(/_/g, '/');
+};
+
+base64url.escape = function escape (str) {
+ return str.replace(/\+/g, '-')
+ .replace(/\//g, '_')
+ .replace(/=/g, '');
+};
+
+base64url.encode = function encode (str) {
+ return this.escape(new Buffer(str).toString('base64'));
+};
+
+base64url.decode = function decode (str) {
+ return new Buffer(this.unescape(str), 'base64').toString();
+};
diff --git a/node_modules/base64-url/package.json b/node_modules/base64-url/package.json
new file mode 100644
index 0000000..82b8785
--- /dev/null
+++ b/node_modules/base64-url/package.json
@@ -0,0 +1,101 @@
+{
+ "_args": [
+ [
+ "base64-url@1.2.2",
+ "/home/humair/School/csc309/a4/solutions_repo/node_modules/uid-safe"
+ ]
+ ],
+ "_from": "base64-url@1.2.2",
+ "_id": "base64-url@1.2.2",
+ "_inCache": true,
+ "_installable": true,
+ "_location": "/base64-url",
+ "_nodeVersion": "4.4.2",
+ "_npmOperationalInternal": {
+ "host": "packages-12-west.internal.npmjs.com",
+ "tmp": "tmp/base64-url-1.2.2.tgz_1459642531916_0.0884270598180592"
+ },
+ "_npmUser": {
+ "email": "joaquim.serafim@gmail.com",
+ "name": "quim"
+ },
+ "_npmVersion": "2.15.0",
+ "_phantomChildren": {},
+ "_requested": {
+ "name": "base64-url",
+ "raw": "base64-url@1.2.2",
+ "rawSpec": "1.2.2",
+ "scope": null,
+ "spec": "1.2.2",
+ "type": "version"
+ },
+ "_requiredBy": [
+ "/uid-safe"
+ ],
+ "_resolved": "https://registry.npmjs.org/base64-url/-/base64-url-1.2.2.tgz",
+ "_shasum": "90af26ef8b0b67bc801b05eccf943345649008b3",
+ "_shrinkwrap": null,
+ "_spec": "base64-url@1.2.2",
+ "_where": "/home/humair/School/csc309/a4/solutions_repo/node_modules/uid-safe",
+ "author": {
+ "name": "@joaquimserafim"
+ },
+ "bugs": {
+ "url": "https://github.com/joaquimserafim/base64-url/issues"
+ },
+ "dependencies": {},
+ "description": "Base64 encode, decode, escape and unescape for URL applications",
+ "devDependencies": {
+ "istanbul": "^0.3.5",
+ "jscs": "^1.9.0",
+ "jshint": "^2.5.11",
+ "pre-commit": "0.0.9",
+ "tape": "^3.0.3",
+ "which": "^1.0.8"
+ },
+ "directories": {},
+ "dist": {
+ "shasum": "90af26ef8b0b67bc801b05eccf943345649008b3",
+ "tarball": "https://registry.npmjs.org/base64-url/-/base64-url-1.2.2.tgz"
+ },
+ "files": [
+ "LICENSE",
+ "README.md",
+ "index.js"
+ ],
+ "gitHead": "7e5b7e351edbf67ed04e3475663d3a64e0c32035",
+ "homepage": "https://github.com/joaquimserafim/base64-url",
+ "keywords": [
+ "base64",
+ "base64url"
+ ],
+ "license": "ISC",
+ "main": "index.js",
+ "maintainers": [
+ {
+ "name": "quim",
+ "email": "joaquim.serafim@gmail.com"
+ }
+ ],
+ "name": "base64-url",
+ "optionalDependencies": {},
+ "pre-commit": [
+ "check-coverage",
+ "code-style",
+ "jshint",
+ "test"
+ ],
+ "readme": "ERROR: No README data found!",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/joaquimserafim/base64-url.git"
+ },
+ "scripts": {
+ "check-coverage": "istanbul check-coverage --statements 100 --functions 100 --lines 100 --branches 100",
+ "code-style": "jscs -p google *.js",
+ "coverage": "open coverage/lcov-report/index.html",
+ "jshint": "jshint -c .jshintrc *.js",
+ "test": "istanbul cover tape test.js"
+ },
+ "version": "1.2.2"
+}
diff --git a/node_modules/connect-flash/.travis.yml b/node_modules/connect-flash/.travis.yml
new file mode 100644
index 0000000..79eed11
--- /dev/null
+++ b/node_modules/connect-flash/.travis.yml
@@ -0,0 +1,6 @@
+language: "node_js"
+node_js:
+ - 0.4
+ - 0.6
+ - 0.8
+ \ No newline at end of file
diff --git a/node_modules/connect-flash/LICENSE b/node_modules/connect-flash/LICENSE
new file mode 100644
index 0000000..d61567a
--- /dev/null
+++ b/node_modules/connect-flash/LICENSE
@@ -0,0 +1,20 @@
+(The MIT License)
+
+Copyright (c) 2012-2013 Jared Hanson
+
+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/connect-flash/README.md b/node_modules/connect-flash/README.md
new file mode 100644
index 0000000..b3b58b4
--- /dev/null
+++ b/node_modules/connect-flash/README.md
@@ -0,0 +1,73 @@
+# connect-flash
+
+The flash is a special area of the session used for storing messages. Messages
+are written to the flash and cleared after being displayed to the user. The
+flash is typically used in combination with redirects, ensuring that the message
+is available to the next page that is to be rendered.
+
+This middleware was extracted from [Express](http://expressjs.com/) 2.x, after
+Express 3.x removed direct support for the flash. connect-flash brings this
+functionality back to Express 3.x, as well as any other middleware-compatible
+framework or application. +1 for [radical reusability](http://substack.net/posts/b96642/the-node-js-aesthetic).
+
+## Install
+
+ $ npm install connect-flash
+
+## Usage
+
+#### Express 3.x
+
+Flash messages are stored in the session. First, setup sessions as usual by
+enabling `cookieParser` and `session` middleware. Then, use `flash` middleware
+provided by connect-flash.
+
+```javascript
+var flash = require('connect-flash');
+var app = express();
+
+app.configure(function() {
+ app.use(express.cookieParser('keyboard cat'));
+ app.use(express.session({ cookie: { maxAge: 60000 }}));
+ app.use(flash());
+});
+```
+
+With the `flash` middleware in place, all requests will have a `req.flash()` function
+that can be used for flash messages.
+
+```javascript
+app.get('/flash', function(req, res){
+ // Set a flash message by passing the key, followed by the value, to req.flash().
+ req.flash('info', 'Flash is back!')
+ res.redirect('/');
+});
+
+app.get('/', function(req, res){
+ // Get an array of flash messages by passing the key to req.flash()
+ res.render('index', { messages: req.flash('info') });
+});
+```
+
+## Examples
+
+For an example using connect-flash in an Express 3.x app, refer to the [express3](https://github.com/jaredhanson/connect-flash/tree/master/examples/express3)
+example.
+
+## Tests
+
+ $ npm install --dev
+ $ make test
+
+[![Build Status](https://secure.travis-ci.org/jaredhanson/connect-flash.png)](http://travis-ci.org/jaredhanson/connect-flash)
+
+## Credits
+
+ - [Jared Hanson](http://github.com/jaredhanson)
+ - [TJ Holowaychuk](https://github.com/visionmedia)
+
+## License
+
+[The MIT License](http://opensource.org/licenses/MIT)
+
+Copyright (c) 2012-2013 Jared Hanson <[http://jaredhanson.net/](http://jaredhanson.net/)>
diff --git a/node_modules/connect-flash/lib/flash.js b/node_modules/connect-flash/lib/flash.js
new file mode 100644
index 0000000..a278bc1
--- /dev/null
+++ b/node_modules/connect-flash/lib/flash.js
@@ -0,0 +1,82 @@
+/**
+ * Module dependencies.
+ */
+var format = require('util').format;
+var isArray = require('util').isArray;
+
+
+/**
+ * Expose `flash()` function on requests.
+ *
+ * @return {Function}
+ * @api public
+ */
+module.exports = function flash(options) {
+ options = options || {};
+ var safe = (options.unsafe === undefined) ? true : !options.unsafe;
+
+ return function(req, res, next) {
+ if (req.flash && safe) { return next(); }
+ req.flash = _flash;
+ next();
+ }
+}
+
+/**
+ * Queue flash `msg` of the given `type`.
+ *
+ * Examples:
+ *
+ * req.flash('info', 'email sent');
+ * req.flash('error', 'email delivery failed');
+ * req.flash('info', 'email re-sent');
+ * // => 2
+ *
+ * req.flash('info');
+ * // => ['email sent', 'email re-sent']
+ *
+ * req.flash('info');
+ * // => []
+ *
+ * req.flash();
+ * // => { error: ['email delivery failed'], info: [] }
+ *
+ * Formatting:
+ *
+ * Flash notifications also support arbitrary formatting support.
+ * For example you may pass variable arguments to `req.flash()`
+ * and use the %s specifier to be replaced by the associated argument:
+ *
+ * req.flash('info', 'email has been sent to %s.', userName);
+ *
+ * Formatting uses `util.format()`, which is available on Node 0.6+.
+ *
+ * @param {String} type
+ * @param {String} msg
+ * @return {Array|Object|Number}
+ * @api public
+ */
+function _flash(type, msg) {
+ if (this.session === undefined) throw Error('req.flash() requires sessions');
+ var msgs = this.session.flash = this.session.flash || {};
+ if (type && msg) {
+ // util.format is available in Node.js 0.6+
+ if (arguments.length > 2 && format) {
+ var args = Array.prototype.slice.call(arguments, 1);
+ msg = format.apply(undefined, args);
+ } else if (isArray(msg)) {
+ msg.forEach(function(val){
+ (msgs[type] = msgs[type] || []).push(val);
+ });
+ return msgs[type].length;
+ }
+ return (msgs[type] = msgs[type] || []).push(msg);
+ } else if (type) {
+ var arr = msgs[type];
+ delete msgs[type];
+ return arr || [];
+ } else {
+ this.session.flash = {};
+ return msgs;
+ }
+}
diff --git a/node_modules/connect-flash/lib/index.js b/node_modules/connect-flash/lib/index.js
new file mode 100644
index 0000000..b4d5961
--- /dev/null
+++ b/node_modules/connect-flash/lib/index.js
@@ -0,0 +1,4 @@
+/**
+ * Expose middleware.
+ */
+exports = module.exports = require('./flash');
diff --git a/node_modules/connect-flash/package.json b/node_modules/connect-flash/package.json
new file mode 100644
index 0000000..94f9b70
--- /dev/null
+++ b/node_modules/connect-flash/package.json
@@ -0,0 +1,87 @@
+{
+ "_args": [
+ [
+ "connect-flash",
+ "/home/humair/School/csc309/a4/solutions_repo"
+ ]
+ ],
+ "_from": "connect-flash@latest",
+ "_id": "connect-flash@0.1.1",
+ "_inCache": true,
+ "_installable": true,
+ "_location": "/connect-flash",
+ "_npmUser": {
+ "email": "jaredhanson@gmail.com",
+ "name": "jaredhanson"
+ },
+ "_npmVersion": "1.1.62",
+ "_phantomChildren": {},
+ "_requested": {
+ "name": "connect-flash",
+ "raw": "connect-flash",
+ "rawSpec": "",
+ "scope": null,
+ "spec": "latest",
+ "type": "tag"
+ },
+ "_requiredBy": [
+ "/"
+ ],
+ "_resolved": "https://registry.npmjs.org/connect-flash/-/connect-flash-0.1.1.tgz",
+ "_shasum": "d8630f26d95a7f851f9956b1e8cc6732f3b6aa30",
+ "_shrinkwrap": null,
+ "_spec": "connect-flash",
+ "_where": "/home/humair/School/csc309/a4/solutions_repo",
+ "author": {
+ "email": "jaredhanson@gmail.com",
+ "name": "Jared Hanson",
+ "url": "http://www.jaredhanson.net/"
+ },
+ "bugs": {
+ "url": "http://github.com/jaredhanson/connect-flash/issues"
+ },
+ "dependencies": {},
+ "description": "Flash message middleware for Connect.",
+ "devDependencies": {
+ "vows": "0.6.x"
+ },
+ "directories": {},
+ "dist": {
+ "shasum": "d8630f26d95a7f851f9956b1e8cc6732f3b6aa30",
+ "tarball": "https://registry.npmjs.org/connect-flash/-/connect-flash-0.1.1.tgz"
+ },
+ "engines": {
+ "node": ">= 0.4.0"
+ },
+ "homepage": "https://github.com/jaredhanson/connect-flash#readme",
+ "keywords": [
+ "connect",
+ "express",
+ "flash",
+ "messages"
+ ],
+ "licenses": [
+ {
+ "type": "MIT",
+ "url": "http://www.opensource.org/licenses/MIT"
+ }
+ ],
+ "main": "./lib",
+ "maintainers": [
+ {
+ "name": "jaredhanson",
+ "email": "jaredhanson@gmail.com"
+ }
+ ],
+ "name": "connect-flash",
+ "optionalDependencies": {},
+ "readme": "ERROR: No README data found!",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/jaredhanson/connect-flash.git"
+ },
+ "scripts": {
+ "test": "NODE_PATH=lib node_modules/.bin/vows test/*-test.js"
+ },
+ "version": "0.1.1"
+}
diff --git a/node_modules/crc/LICENSE b/node_modules/crc/LICENSE
new file mode 100644
index 0000000..c49097c
--- /dev/null
+++ b/node_modules/crc/LICENSE
@@ -0,0 +1,22 @@
+The MIT License (MIT)
+
+Copyright 2014 Alex Gorbatchev
+
+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/crc/README.md b/node_modules/crc/README.md
new file mode 100644
index 0000000..499b766
--- /dev/null
+++ b/node_modules/crc/README.md
@@ -0,0 +1,100 @@
+# crc
+
+[![GitTip](http://img.shields.io/gittip/alexgorbatchev.svg?style=flat)](https://www.gittip.com/alexgorbatchev/)
+[![Dependency status](http://img.shields.io/david/alexgorbatchev/node-crc.svg?style=flat)](https://david-dm.org/alexgorbatchev/node-crc)
+[![devDependency Status](http://img.shields.io/david/dev/alexgorbatchev/node-crc.svg?style=flat)](https://david-dm.org/alexgorbatchev/node-crc#info=devDependencies)
+[![Build Status](http://img.shields.io/travis/alexgorbatchev/node-crc.svg?style=flat&branch=master)](https://travis-ci.org/alexgorbatchev/node-crc)
+
+[![NPM](https://nodei.co/npm/crc.svg?style=flat)](https://npmjs.org/package/crc)
+
+Module for calculating Cyclic Redundancy Check (CRC) for Node.js and the Browser.
+
+## Features
+
+* Full test suite comparing values against reference `pycrc` implementation.
+* Version 3.x is 3x to 4x faster than version 2.x.
+* Pure JavaScript implementation, no dependencies.
+* Provides CRC Tables for optimized calculations.
+* Provides support for the following CRC algorithms:
+ * CRC1 `crc.crc1(…)`
+ * CRC8 `crc.crc8(…)`
+ * CRC8 1-Wire `crc.crc81wire(…)`
+ * CRC16 `crc.crc16(…)`
+ * CRC16 CCITT `crc.crc16ccitt(…)`
+ * CRC16 Modbus `crc.crc16modbus(…)`
+ * CRC16 Kermit `crc.crc16kermit(…)`
+ * CRC16 XModem `crc.crc16xmodem(…)`
+ * CRC24 `crc.crc24(…)`
+ * CRC32 `crc.crc32(…)`
+
+## IMPORTANT
+
+If you've used `crc` module prior to version 2.x, you might have some inconsistencies with the current implementation because it relied on very old code and wasn't checked against reference implementation. If you upgrading from 1.x, please take special care.
+
+## Support
+
+<a href="https://blockchain.info/address/1CZyBREeHTmy8C5zVGHZHPwqBuWFmEuUCQ"><img src="bitcoin.png" width="150" align="right"/></a> Please support me on [GitTip](https://www.gittip.com/alexgorbatchev/). I'm sure you know that it takes a lot of personal time to write and even more time to maintain open source projects. If you use this package, buy me a beer on GitTip or via Bitcoin [`1CZyBREeHTmy8C5zVGHZHPwqBuWFmEuUCQ`](https://blockchain.info/address/1CZyBREeHTmy8C5zVGHZHPwqBuWFmEuUCQ)
+
+## Installation
+
+ npm install crc
+
+## Running tests
+
+ $ npm install
+ $ npm test
+
+## Usage Example
+
+Calculate a CRC32:
+
+ var crc = require('crc');
+
+ crc.crc32('hello').toString(16);
+ # => "3610a686"
+
+Calculate a CRC32 of a file:
+
+ crc.crc32(fs.readFileSync('README.md', 'utf8')).toString(16);
+ # => "127ad531"
+
+Or using a `Buffer`:
+
+ crc.crc32(fs.readFileSync('README.md')).toString(16);
+ # => "127ad531"
+
+Incrementally calculate a CRC32:
+
+ value = crc.crc32('one');
+ value = crc.crc32('two', value);
+ value = crc.crc32('three', value);
+ value.toString(16);
+ # => "9e1c092"
+
+## Thanks!
+
+[pycrc](http://www.tty1.net/pycrc/) library is which the source of all of the CRC tables.
+
+# License
+
+The MIT License (MIT)
+
+Copyright (c) 2014 Alex Gorbatchev
+
+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/crc/lib/crc1.js b/node_modules/crc/lib/crc1.js
new file mode 100644
index 0000000..23e1625
--- /dev/null
+++ b/node_modules/crc/lib/crc1.js
@@ -0,0 +1,24 @@
+'use strict';
+
+var _buffer = require('buffer');
+
+var _define_crc = require('./define_crc');
+
+var _define_crc2 = _interopRequireDefault(_define_crc);
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+module.exports = (0, _define_crc2.default)('crc1', function (buf, previous) {
+ if (!_buffer.Buffer.isBuffer(buf)) buf = (0, _buffer.Buffer)(buf);
+
+ var crc = ~ ~previous;
+ var accum = 0;
+
+ for (var index = 0; index < buf.length; index++) {
+ var byte = buf[index];
+ accum += byte;
+ }
+
+ crc += accum % 256;
+ return crc % 256;
+}); \ No newline at end of file
diff --git a/node_modules/crc/lib/crc16.js b/node_modules/crc/lib/crc16.js
new file mode 100644
index 0000000..feff26a
--- /dev/null
+++ b/node_modules/crc/lib/crc16.js
@@ -0,0 +1,27 @@
+'use strict';
+
+var _buffer = require('buffer');
+
+var _define_crc = require('./define_crc');
+
+var _define_crc2 = _interopRequireDefault(_define_crc);
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+// Generated by `./pycrc.py --algorithm=table-driven --model=crc-16 --generate=c`
+var TABLE = [0x0000, 0xc0c1, 0xc181, 0x0140, 0xc301, 0x03c0, 0x0280, 0xc241, 0xc601, 0x06c0, 0x0780, 0xc741, 0x0500, 0xc5c1, 0xc481, 0x0440, 0xcc01, 0x0cc0, 0x0d80, 0xcd41, 0x0f00, 0xcfc1, 0xce81, 0x0e40, 0x0a00, 0xcac1, 0xcb81, 0x0b40, 0xc901, 0x09c0, 0x0880, 0xc841, 0xd801, 0x18c0, 0x1980, 0xd941, 0x1b00, 0xdbc1, 0xda81, 0x1a40, 0x1e00, 0xdec1, 0xdf81, 0x1f40, 0xdd01, 0x1dc0, 0x1c80, 0xdc41, 0x1400, 0xd4c1, 0xd581, 0x1540, 0xd701, 0x17c0, 0x1680, 0xd641, 0xd201, 0x12c0, 0x1380, 0xd341, 0x1100, 0xd1c1, 0xd081, 0x1040, 0xf001, 0x30c0, 0x3180, 0xf141, 0x3300, 0xf3c1, 0xf281, 0x3240, 0x3600, 0xf6c1, 0xf781, 0x3740, 0xf501, 0x35c0, 0x3480, 0xf441, 0x3c00, 0xfcc1, 0xfd81, 0x3d40, 0xff01, 0x3fc0, 0x3e80, 0xfe41, 0xfa01, 0x3ac0, 0x3b80, 0xfb41, 0x3900, 0xf9c1, 0xf881, 0x3840, 0x2800, 0xe8c1, 0xe981, 0x2940, 0xeb01, 0x2bc0, 0x2a80, 0xea41, 0xee01, 0x2ec0, 0x2f80, 0xef41, 0x2d00, 0xedc1, 0xec81, 0x2c40, 0xe401, 0x24c0, 0x2580, 0xe541, 0x2700, 0xe7c1, 0xe681, 0x2640, 0x2200, 0xe2c1, 0xe381, 0x2340, 0xe101, 0x21c0, 0x2080, 0xe041, 0xa001, 0x60c0, 0x6180, 0xa141, 0x6300, 0xa3c1, 0xa281, 0x6240, 0x6600, 0xa6c1, 0xa781, 0x6740, 0xa501, 0x65c0, 0x6480, 0xa441, 0x6c00, 0xacc1, 0xad81, 0x6d40, 0xaf01, 0x6fc0, 0x6e80, 0xae41, 0xaa01, 0x6ac0, 0x6b80, 0xab41, 0x6900, 0xa9c1, 0xa881, 0x6840, 0x7800, 0xb8c1, 0xb981, 0x7940, 0xbb01, 0x7bc0, 0x7a80, 0xba41, 0xbe01, 0x7ec0, 0x7f80, 0xbf41, 0x7d00, 0xbdc1, 0xbc81, 0x7c40, 0xb401, 0x74c0, 0x7580, 0xb541, 0x7700, 0xb7c1, 0xb681, 0x7640, 0x7200, 0xb2c1, 0xb381, 0x7340, 0xb101, 0x71c0, 0x7080, 0xb041, 0x5000, 0x90c1, 0x9181, 0x5140, 0x9301, 0x53c0, 0x5280, 0x9241, 0x9601, 0x56c0, 0x5780, 0x9741, 0x5500, 0x95c1, 0x9481, 0x5440, 0x9c01, 0x5cc0, 0x5d80, 0x9d41, 0x5f00, 0x9fc1, 0x9e81, 0x5e40, 0x5a00, 0x9ac1, 0x9b81, 0x5b40, 0x9901, 0x59c0, 0x5880, 0x9841, 0x8801, 0x48c0, 0x4980, 0x8941, 0x4b00, 0x8bc1, 0x8a81, 0x4a40, 0x4e00, 0x8ec1, 0x8f81, 0x4f40, 0x8d01, 0x4dc0, 0x4c80, 0x8c41, 0x4400, 0x84c1, 0x8581, 0x4540, 0x8701, 0x47c0, 0x4680, 0x8641, 0x8201, 0x42c0, 0x4380, 0x8341, 0x4100, 0x81c1, 0x8081, 0x4040];
+
+if (typeof Int32Array !== 'undefined') TABLE = new Int32Array(TABLE);
+
+module.exports = (0, _define_crc2.default)('crc-16', function (buf, previous) {
+ if (!_buffer.Buffer.isBuffer(buf)) buf = (0, _buffer.Buffer)(buf);
+
+ var crc = ~ ~previous;
+
+ for (var index = 0; index < buf.length; index++) {
+ var byte = buf[index];
+ crc = (TABLE[(crc ^ byte) & 0xff] ^ crc >> 8) & 0xffff;
+ }
+
+ return crc;
+}); \ No newline at end of file
diff --git a/node_modules/crc/lib/crc16_ccitt.js b/node_modules/crc/lib/crc16_ccitt.js
new file mode 100644
index 0000000..01051d1
--- /dev/null
+++ b/node_modules/crc/lib/crc16_ccitt.js
@@ -0,0 +1,27 @@
+'use strict';
+
+var _buffer = require('buffer');
+
+var _define_crc = require('./define_crc');
+
+var _define_crc2 = _interopRequireDefault(_define_crc);
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+// Generated by `./pycrc.py --algorithm=table-driven --model=ccitt --generate=c`
+var TABLE = [0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7, 0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef, 0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6, 0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de, 0x2462, 0x3443, 0x0420, 0x1401, 0x64e6, 0x74c7, 0x44a4, 0x5485, 0xa56a, 0xb54b, 0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d, 0x3653, 0x2672, 0x1611, 0x0630, 0x76d7, 0x66f6, 0x5695, 0x46b4, 0xb75b, 0xa77a, 0x9719, 0x8738, 0xf7df, 0xe7fe, 0xd79d, 0xc7bc, 0x48c4, 0x58e5, 0x6886, 0x78a7, 0x0840, 0x1861, 0x2802, 0x3823, 0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948, 0x9969, 0xa90a, 0xb92b, 0x5af5, 0x4ad4, 0x7ab7, 0x6a96, 0x1a71, 0x0a50, 0x3a33, 0x2a12, 0xdbfd, 0xcbdc, 0xfbbf, 0xeb9e, 0x9b79, 0x8b58, 0xbb3b, 0xab1a, 0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 0x0c60, 0x1c41, 0xedae, 0xfd8f, 0xcdec, 0xddcd, 0xad2a, 0xbd0b, 0x8d68, 0x9d49, 0x7e97, 0x6eb6, 0x5ed5, 0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0x0e70, 0xff9f, 0xefbe, 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 0x9f59, 0x8f78, 0x9188, 0x81a9, 0xb1ca, 0xa1eb, 0xd10c, 0xc12d, 0xf14e, 0xe16f, 0x1080, 0x00a1, 0x30c2, 0x20e3, 0x5004, 0x4025, 0x7046, 0x6067, 0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d, 0xd31c, 0xe37f, 0xf35e, 0x02b1, 0x1290, 0x22f3, 0x32d2, 0x4235, 0x5214, 0x6277, 0x7256, 0xb5ea, 0xa5cb, 0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c, 0xc50d, 0x34e2, 0x24c3, 0x14a0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405, 0xa7db, 0xb7fa, 0x8799, 0x97b8, 0xe75f, 0xf77e, 0xc71d, 0xd73c, 0x26d3, 0x36f2, 0x0691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634, 0xd94c, 0xc96d, 0xf90e, 0xe92f, 0x99c8, 0x89e9, 0xb98a, 0xa9ab, 0x5844, 0x4865, 0x7806, 0x6827, 0x18c0, 0x08e1, 0x3882, 0x28a3, 0xcb7d, 0xdb5c, 0xeb3f, 0xfb1e, 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a, 0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1, 0x1ad0, 0x2ab3, 0x3a92, 0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, 0xbdaa, 0xad8b, 0x9de8, 0x8dc9, 0x7c26, 0x6c07, 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1, 0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8, 0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0];
+
+if (typeof Int32Array !== 'undefined') TABLE = new Int32Array(TABLE);
+
+module.exports = (0, _define_crc2.default)('ccitt', function (buf, previous) {
+ if (!_buffer.Buffer.isBuffer(buf)) buf = (0, _buffer.Buffer)(buf);
+
+ var crc = typeof previous !== 'undefined' ? ~ ~previous : 0xffff;
+
+ for (var index = 0; index < buf.length; index++) {
+ var byte = buf[index];
+ crc = (TABLE[(crc >> 8 ^ byte) & 0xff] ^ crc << 8) & 0xffff;
+ }
+
+ return crc;
+}); \ No newline at end of file
diff --git a/node_modules/crc/lib/crc16_kermit.js b/node_modules/crc/lib/crc16_kermit.js
new file mode 100644
index 0000000..9174f4f
--- /dev/null
+++ b/node_modules/crc/lib/crc16_kermit.js
@@ -0,0 +1,27 @@
+'use strict';
+
+var _buffer = require('buffer');
+
+var _define_crc = require('./define_crc');
+
+var _define_crc2 = _interopRequireDefault(_define_crc);
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+// Generated by `./pycrc.py --algorithm=table-driven --model=kermit --generate=c`
+var TABLE = [0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf, 0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7, 0x1081, 0x0108, 0x3393, 0x221a, 0x56a5, 0x472c, 0x75b7, 0x643e, 0x9cc9, 0x8d40, 0xbfdb, 0xae52, 0xdaed, 0xcb64, 0xf9ff, 0xe876, 0x2102, 0x308b, 0x0210, 0x1399, 0x6726, 0x76af, 0x4434, 0x55bd, 0xad4a, 0xbcc3, 0x8e58, 0x9fd1, 0xeb6e, 0xfae7, 0xc87c, 0xd9f5, 0x3183, 0x200a, 0x1291, 0x0318, 0x77a7, 0x662e, 0x54b5, 0x453c, 0xbdcb, 0xac42, 0x9ed9, 0x8f50, 0xfbef, 0xea66, 0xd8fd, 0xc974, 0x4204, 0x538d, 0x6116, 0x709f, 0x0420, 0x15a9, 0x2732, 0x36bb, 0xce4c, 0xdfc5, 0xed5e, 0xfcd7, 0x8868, 0x99e1, 0xab7a, 0xbaf3, 0x5285, 0x430c, 0x7197, 0x601e, 0x14a1, 0x0528, 0x37b3, 0x263a, 0xdecd, 0xcf44, 0xfddf, 0xec56, 0x98e9, 0x8960, 0xbbfb, 0xaa72, 0x6306, 0x728f, 0x4014, 0x519d, 0x2522, 0x34ab, 0x0630, 0x17b9, 0xef4e, 0xfec7, 0xcc5c, 0xddd5, 0xa96a, 0xb8e3, 0x8a78, 0x9bf1, 0x7387, 0x620e, 0x5095, 0x411c, 0x35a3, 0x242a, 0x16b1, 0x0738, 0xffcf, 0xee46, 0xdcdd, 0xcd54, 0xb9eb, 0xa862, 0x9af9, 0x8b70, 0x8408, 0x9581, 0xa71a, 0xb693, 0xc22c, 0xd3a5, 0xe13e, 0xf0b7, 0x0840, 0x19c9, 0x2b52, 0x3adb, 0x4e64, 0x5fed, 0x6d76, 0x7cff, 0x9489, 0x8500, 0xb79b, 0xa612, 0xd2ad, 0xc324, 0xf1bf, 0xe036, 0x18c1, 0x0948, 0x3bd3, 0x2a5a, 0x5ee5, 0x4f6c, 0x7df7, 0x6c7e, 0xa50a, 0xb483, 0x8618, 0x9791, 0xe32e, 0xf2a7, 0xc03c, 0xd1b5, 0x2942, 0x38cb, 0x0a50, 0x1bd9, 0x6f66, 0x7eef, 0x4c74, 0x5dfd, 0xb58b, 0xa402, 0x9699, 0x8710, 0xf3af, 0xe226, 0xd0bd, 0xc134, 0x39c3, 0x284a, 0x1ad1, 0x0b58, 0x7fe7, 0x6e6e, 0x5cf5, 0x4d7c, 0xc60c, 0xd785, 0xe51e, 0xf497, 0x8028, 0x91a1, 0xa33a, 0xb2b3, 0x4a44, 0x5bcd, 0x6956, 0x78df, 0x0c60, 0x1de9, 0x2f72, 0x3efb, 0xd68d, 0xc704, 0xf59f, 0xe416, 0x90a9, 0x8120, 0xb3bb, 0xa232, 0x5ac5, 0x4b4c, 0x79d7, 0x685e, 0x1ce1, 0x0d68, 0x3ff3, 0x2e7a, 0xe70e, 0xf687, 0xc41c, 0xd595, 0xa12a, 0xb0a3, 0x8238, 0x93b1, 0x6b46, 0x7acf, 0x4854, 0x59dd, 0x2d62, 0x3ceb, 0x0e70, 0x1ff9, 0xf78f, 0xe606, 0xd49d, 0xc514, 0xb1ab, 0xa022, 0x92b9, 0x8330, 0x7bc7, 0x6a4e, 0x58d5, 0x495c, 0x3de3, 0x2c6a, 0x1ef1, 0x0f78];
+
+if (typeof Int32Array !== 'undefined') TABLE = new Int32Array(TABLE);
+
+module.exports = (0, _define_crc2.default)('kermit', function (buf, previous) {
+ if (!_buffer.Buffer.isBuffer(buf)) buf = (0, _buffer.Buffer)(buf);
+
+ var crc = typeof previous !== 'undefined' ? ~ ~previous : 0x0000;
+
+ for (var index = 0; index < buf.length; index++) {
+ var byte = buf[index];
+ crc = (TABLE[(crc ^ byte) & 0xff] ^ crc >> 8) & 0xffff;
+ }
+
+ return crc;
+}); \ No newline at end of file
diff --git a/node_modules/crc/lib/crc16_modbus.js b/node_modules/crc/lib/crc16_modbus.js
new file mode 100644
index 0000000..7ce82a0
--- /dev/null
+++ b/node_modules/crc/lib/crc16_modbus.js
@@ -0,0 +1,27 @@
+'use strict';
+
+var _buffer = require('buffer');
+
+var _define_crc = require('./define_crc');
+
+var _define_crc2 = _interopRequireDefault(_define_crc);
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+// Generated by `./pycrc.py --algorithm=table-driven --model=crc-16-modbus --generate=c`
+var TABLE = [0x0000, 0xc0c1, 0xc181, 0x0140, 0xc301, 0x03c0, 0x0280, 0xc241, 0xc601, 0x06c0, 0x0780, 0xc741, 0x0500, 0xc5c1, 0xc481, 0x0440, 0xcc01, 0x0cc0, 0x0d80, 0xcd41, 0x0f00, 0xcfc1, 0xce81, 0x0e40, 0x0a00, 0xcac1, 0xcb81, 0x0b40, 0xc901, 0x09c0, 0x0880, 0xc841, 0xd801, 0x18c0, 0x1980, 0xd941, 0x1b00, 0xdbc1, 0xda81, 0x1a40, 0x1e00, 0xdec1, 0xdf81, 0x1f40, 0xdd01, 0x1dc0, 0x1c80, 0xdc41, 0x1400, 0xd4c1, 0xd581, 0x1540, 0xd701, 0x17c0, 0x1680, 0xd641, 0xd201, 0x12c0, 0x1380, 0xd341, 0x1100, 0xd1c1, 0xd081, 0x1040, 0xf001, 0x30c0, 0x3180, 0xf141, 0x3300, 0xf3c1, 0xf281, 0x3240, 0x3600, 0xf6c1, 0xf781, 0x3740, 0xf501, 0x35c0, 0x3480, 0xf441, 0x3c00, 0xfcc1, 0xfd81, 0x3d40, 0xff01, 0x3fc0, 0x3e80, 0xfe41, 0xfa01, 0x3ac0, 0x3b80, 0xfb41, 0x3900, 0xf9c1, 0xf881, 0x3840, 0x2800, 0xe8c1, 0xe981, 0x2940, 0xeb01, 0x2bc0, 0x2a80, 0xea41, 0xee01, 0x2ec0, 0x2f80, 0xef41, 0x2d00, 0xedc1, 0xec81, 0x2c40, 0xe401, 0x24c0, 0x2580, 0xe541, 0x2700, 0xe7c1, 0xe681, 0x2640, 0x2200, 0xe2c1, 0xe381, 0x2340, 0xe101, 0x21c0, 0x2080, 0xe041, 0xa001, 0x60c0, 0x6180, 0xa141, 0x6300, 0xa3c1, 0xa281, 0x6240, 0x6600, 0xa6c1, 0xa781, 0x6740, 0xa501, 0x65c0, 0x6480, 0xa441, 0x6c00, 0xacc1, 0xad81, 0x6d40, 0xaf01, 0x6fc0, 0x6e80, 0xae41, 0xaa01, 0x6ac0, 0x6b80, 0xab41, 0x6900, 0xa9c1, 0xa881, 0x6840, 0x7800, 0xb8c1, 0xb981, 0x7940, 0xbb01, 0x7bc0, 0x7a80, 0xba41, 0xbe01, 0x7ec0, 0x7f80, 0xbf41, 0x7d00, 0xbdc1, 0xbc81, 0x7c40, 0xb401, 0x74c0, 0x7580, 0xb541, 0x7700, 0xb7c1, 0xb681, 0x7640, 0x7200, 0xb2c1, 0xb381, 0x7340, 0xb101, 0x71c0, 0x7080, 0xb041, 0x5000, 0x90c1, 0x9181, 0x5140, 0x9301, 0x53c0, 0x5280, 0x9241, 0x9601, 0x56c0, 0x5780, 0x9741, 0x5500, 0x95c1, 0x9481, 0x5440, 0x9c01, 0x5cc0, 0x5d80, 0x9d41, 0x5f00, 0x9fc1, 0x9e81, 0x5e40, 0x5a00, 0x9ac1, 0x9b81, 0x5b40, 0x9901, 0x59c0, 0x5880, 0x9841, 0x8801, 0x48c0, 0x4980, 0x8941, 0x4b00, 0x8bc1, 0x8a81, 0x4a40, 0x4e00, 0x8ec1, 0x8f81, 0x4f40, 0x8d01, 0x4dc0, 0x4c80, 0x8c41, 0x4400, 0x84c1, 0x8581, 0x4540, 0x8701, 0x47c0, 0x4680, 0x8641, 0x8201, 0x42c0, 0x4380, 0x8341, 0x4100, 0x81c1, 0x8081, 0x4040];
+
+if (typeof Int32Array !== 'undefined') TABLE = new Int32Array(TABLE);
+
+module.exports = (0, _define_crc2.default)('crc-16-modbus', function (buf, previous) {
+ if (!_buffer.Buffer.isBuffer(buf)) buf = (0, _buffer.Buffer)(buf);
+
+ var crc = typeof previous !== 'undefined' ? ~ ~previous : 0xffff;
+
+ for (var index = 0; index < buf.length; index++) {
+ var byte = buf[index];
+ crc = (TABLE[(crc ^ byte) & 0xff] ^ crc >> 8) & 0xffff;
+ }
+
+ return crc;
+}); \ No newline at end of file
diff --git a/node_modules/crc/lib/crc16_xmodem.js b/node_modules/crc/lib/crc16_xmodem.js
new file mode 100644
index 0000000..2bc58a6
--- /dev/null
+++ b/node_modules/crc/lib/crc16_xmodem.js
@@ -0,0 +1,31 @@
+'use strict';
+
+var _buffer = require('buffer');
+
+var _define_crc = require('./define_crc');
+
+var _define_crc2 = _interopRequireDefault(_define_crc);
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+module.exports = (0, _define_crc2.default)('xmodem', function (buf, previous) {
+ if (!_buffer.Buffer.isBuffer(buf)) buf = (0, _buffer.Buffer)(buf);
+
+ var crc = typeof previous !== 'undefined' ? ~ ~previous : 0x0;
+
+ for (var index = 0; index < buf.length; index++) {
+ var byte = buf[index];
+ var code = crc >>> 8 & 0xFF;
+
+ code ^= byte & 0xFF;
+ code ^= code >>> 4;
+ crc = crc << 8 & 0xFFFF;
+ crc ^= code;
+ code = code << 5 & 0xFFFF;
+ crc ^= code;
+ code = code << 7 & 0xFFFF;
+ crc ^= code;
+ }
+
+ return crc;
+}); \ No newline at end of file
diff --git a/node_modules/crc/lib/crc24.js b/node_modules/crc/lib/crc24.js
new file mode 100644
index 0000000..610aedb
--- /dev/null
+++ b/node_modules/crc/lib/crc24.js
@@ -0,0 +1,27 @@
+'use strict';
+
+var _buffer = require('buffer');
+
+var _define_crc = require('./define_crc');
+
+var _define_crc2 = _interopRequireDefault(_define_crc);
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+// Generated by `./pycrc.py --algorithm=table-drive --model=crc-24 --generate=c`
+var TABLE = [0x000000, 0x864cfb, 0x8ad50d, 0x0c99f6, 0x93e6e1, 0x15aa1a, 0x1933ec, 0x9f7f17, 0xa18139, 0x27cdc2, 0x2b5434, 0xad18cf, 0x3267d8, 0xb42b23, 0xb8b2d5, 0x3efe2e, 0xc54e89, 0x430272, 0x4f9b84, 0xc9d77f, 0x56a868, 0xd0e493, 0xdc7d65, 0x5a319e, 0x64cfb0, 0xe2834b, 0xee1abd, 0x685646, 0xf72951, 0x7165aa, 0x7dfc5c, 0xfbb0a7, 0x0cd1e9, 0x8a9d12, 0x8604e4, 0x00481f, 0x9f3708, 0x197bf3, 0x15e205, 0x93aefe, 0xad50d0, 0x2b1c2b, 0x2785dd, 0xa1c926, 0x3eb631, 0xb8faca, 0xb4633c, 0x322fc7, 0xc99f60, 0x4fd39b, 0x434a6d, 0xc50696, 0x5a7981, 0xdc357a, 0xd0ac8c, 0x56e077, 0x681e59, 0xee52a2, 0xe2cb54, 0x6487af, 0xfbf8b8, 0x7db443, 0x712db5, 0xf7614e, 0x19a3d2, 0x9fef29, 0x9376df, 0x153a24, 0x8a4533, 0x0c09c8, 0x00903e, 0x86dcc5, 0xb822eb, 0x3e6e10, 0x32f7e6, 0xb4bb1d, 0x2bc40a, 0xad88f1, 0xa11107, 0x275dfc, 0xdced5b, 0x5aa1a0, 0x563856, 0xd074ad, 0x4f0bba, 0xc94741, 0xc5deb7, 0x43924c, 0x7d6c62, 0xfb2099, 0xf7b96f, 0x71f594, 0xee8a83, 0x68c678, 0x645f8e, 0xe21375, 0x15723b, 0x933ec0, 0x9fa736, 0x19ebcd, 0x8694da, 0x00d821, 0x0c41d7, 0x8a0d2c, 0xb4f302, 0x32bff9, 0x3e260f, 0xb86af4, 0x2715e3, 0xa15918, 0xadc0ee, 0x2b8c15, 0xd03cb2, 0x567049, 0x5ae9bf, 0xdca544, 0x43da53, 0xc596a8, 0xc90f5e, 0x4f43a5, 0x71bd8b, 0xf7f170, 0xfb6886, 0x7d247d, 0xe25b6a, 0x641791, 0x688e67, 0xeec29c, 0x3347a4, 0xb50b5f, 0xb992a9, 0x3fde52, 0xa0a145, 0x26edbe, 0x2a7448, 0xac38b3, 0x92c69d, 0x148a66, 0x181390, 0x9e5f6b, 0x01207c, 0x876c87, 0x8bf571, 0x0db98a, 0xf6092d, 0x7045d6, 0x7cdc20, 0xfa90db, 0x65efcc, 0xe3a337, 0xef3ac1, 0x69763a, 0x578814, 0xd1c4ef, 0xdd5d19, 0x5b11e2, 0xc46ef5, 0x42220e, 0x4ebbf8, 0xc8f703, 0x3f964d, 0xb9dab6, 0xb54340, 0x330fbb, 0xac70ac, 0x2a3c57, 0x26a5a1, 0xa0e95a, 0x9e1774, 0x185b8f, 0x14c279, 0x928e82, 0x0df195, 0x8bbd6e, 0x872498, 0x016863, 0xfad8c4, 0x7c943f, 0x700dc9, 0xf64132, 0x693e25, 0xef72de, 0xe3eb28, 0x65a7d3, 0x5b59fd, 0xdd1506, 0xd18cf0, 0x57c00b, 0xc8bf1c, 0x4ef3e7, 0x426a11, 0xc426ea, 0x2ae476, 0xaca88d, 0xa0317b, 0x267d80, 0xb90297, 0x3f4e6c, 0x33d79a, 0xb59b61, 0x8b654f, 0x0d29b4, 0x01b042, 0x87fcb9, 0x1883ae, 0x9ecf55, 0x9256a3, 0x141a58, 0xefaaff, 0x69e604, 0x657ff2, 0xe33309, 0x7c4c1e, 0xfa00e5, 0xf69913, 0x70d5e8, 0x4e2bc6, 0xc8673d, 0xc4fecb, 0x42b230, 0xddcd27, 0x5b81dc, 0x57182a, 0xd154d1, 0x26359f, 0xa07964, 0xace092, 0x2aac69, 0xb5d37e, 0x339f85, 0x3f0673, 0xb94a88, 0x87b4a6, 0x01f85d, 0x0d61ab, 0x8b2d50, 0x145247, 0x921ebc, 0x9e874a, 0x18cbb1, 0xe37b16, 0x6537ed, 0x69ae1b, 0xefe2e0, 0x709df7, 0xf6d10c, 0xfa48fa, 0x7c0401, 0x42fa2f, 0xc4b6d4, 0xc82f22, 0x4e63d9, 0xd11cce, 0x575035, 0x5bc9c3, 0xdd8538];
+
+if (typeof Int32Array !== 'undefined') TABLE = new Int32Array(TABLE);
+
+module.exports = (0, _define_crc2.default)('crc-24', function (buf, previous) {
+ if (!_buffer.Buffer.isBuffer(buf)) buf = (0, _buffer.Buffer)(buf);
+
+ var crc = typeof previous !== 'undefined' ? ~ ~previous : 0xb704ce;
+
+ for (var index = 0; index < buf.length; index++) {
+ var byte = buf[index];
+ crc = (TABLE[(crc >> 16 ^ byte) & 0xff] ^ crc << 8) & 0xffffff;
+ }
+
+ return crc;
+}); \ No newline at end of file
diff --git a/node_modules/crc/lib/crc32.js b/node_modules/crc/lib/crc32.js
new file mode 100644
index 0000000..f52abc9
--- /dev/null
+++ b/node_modules/crc/lib/crc32.js
@@ -0,0 +1,27 @@
+'use strict';
+
+var _buffer = require('buffer');
+
+var _define_crc = require('./define_crc');
+
+var _define_crc2 = _interopRequireDefault(_define_crc);
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+// Generated by `./pycrc.py --algorithm=table-driven --model=crc-32 --generate=c`
+var TABLE = [0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d];
+
+if (typeof Int32Array !== 'undefined') TABLE = new Int32Array(TABLE);
+
+module.exports = (0, _define_crc2.default)('crc-32', function (buf, previous) {
+ if (!_buffer.Buffer.isBuffer(buf)) buf = (0, _buffer.Buffer)(buf);
+
+ var crc = previous === 0 ? 0 : ~ ~previous ^ -1;
+
+ for (var index = 0; index < buf.length; index++) {
+ var byte = buf[index];
+ crc = TABLE[(crc ^ byte) & 0xff] ^ crc >>> 8;
+ }
+
+ return crc ^ -1;
+}); \ No newline at end of file
diff --git a/node_modules/crc/lib/crc8.js b/node_modules/crc/lib/crc8.js
new file mode 100644
index 0000000..97feb1c
--- /dev/null
+++ b/node_modules/crc/lib/crc8.js
@@ -0,0 +1,27 @@
+'use strict';
+
+var _buffer = require('buffer');
+
+var _define_crc = require('./define_crc');
+
+var _define_crc2 = _interopRequireDefault(_define_crc);
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+// Generated by `./pycrc.py --algorithm=table-driven --model=crc-8 --generate=c`
+var TABLE = [0x00, 0x07, 0x0e, 0x09, 0x1c, 0x1b, 0x12, 0x15, 0x38, 0x3f, 0x36, 0x31, 0x24, 0x23, 0x2a, 0x2d, 0x70, 0x77, 0x7e, 0x79, 0x6c, 0x6b, 0x62, 0x65, 0x48, 0x4f, 0x46, 0x41, 0x54, 0x53, 0x5a, 0x5d, 0xe0, 0xe7, 0xee, 0xe9, 0xfc, 0xfb, 0xf2, 0xf5, 0xd8, 0xdf, 0xd6, 0xd1, 0xc4, 0xc3, 0xca, 0xcd, 0x90, 0x97, 0x9e, 0x99, 0x8c, 0x8b, 0x82, 0x85, 0xa8, 0xaf, 0xa6, 0xa1, 0xb4, 0xb3, 0xba, 0xbd, 0xc7, 0xc0, 0xc9, 0xce, 0xdb, 0xdc, 0xd5, 0xd2, 0xff, 0xf8, 0xf1, 0xf6, 0xe3, 0xe4, 0xed, 0xea, 0xb7, 0xb0, 0xb9, 0xbe, 0xab, 0xac, 0xa5, 0xa2, 0x8f, 0x88, 0x81, 0x86, 0x93, 0x94, 0x9d, 0x9a, 0x27, 0x20, 0x29, 0x2e, 0x3b, 0x3c, 0x35, 0x32, 0x1f, 0x18, 0x11, 0x16, 0x03, 0x04, 0x0d, 0x0a, 0x57, 0x50, 0x59, 0x5e, 0x4b, 0x4c, 0x45, 0x42, 0x6f, 0x68, 0x61, 0x66, 0x73, 0x74, 0x7d, 0x7a, 0x89, 0x8e, 0x87, 0x80, 0x95, 0x92, 0x9b, 0x9c, 0xb1, 0xb6, 0xbf, 0xb8, 0xad, 0xaa, 0xa3, 0xa4, 0xf9, 0xfe, 0xf7, 0xf0, 0xe5, 0xe2, 0xeb, 0xec, 0xc1, 0xc6, 0xcf, 0xc8, 0xdd, 0xda, 0xd3, 0xd4, 0x69, 0x6e, 0x67, 0x60, 0x75, 0x72, 0x7b, 0x7c, 0x51, 0x56, 0x5f, 0x58, 0x4d, 0x4a, 0x43, 0x44, 0x19, 0x1e, 0x17, 0x10, 0x05, 0x02, 0x0b, 0x0c, 0x21, 0x26, 0x2f, 0x28, 0x3d, 0x3a, 0x33, 0x34, 0x4e, 0x49, 0x40, 0x47, 0x52, 0x55, 0x5c, 0x5b, 0x76, 0x71, 0x78, 0x7f, 0x6a, 0x6d, 0x64, 0x63, 0x3e, 0x39, 0x30, 0x37, 0x22, 0x25, 0x2c, 0x2b, 0x06, 0x01, 0x08, 0x0f, 0x1a, 0x1d, 0x14, 0x13, 0xae, 0xa9, 0xa0, 0xa7, 0xb2, 0xb5, 0xbc, 0xbb, 0x96, 0x91, 0x98, 0x9f, 0x8a, 0x8d, 0x84, 0x83, 0xde, 0xd9, 0xd0, 0xd7, 0xc2, 0xc5, 0xcc, 0xcb, 0xe6, 0xe1, 0xe8, 0xef, 0xfa, 0xfd, 0xf4, 0xf3];
+
+if (typeof Int32Array !== 'undefined') TABLE = new Int32Array(TABLE);
+
+module.exports = (0, _define_crc2.default)('crc-8', function (buf, previous) {
+ if (!_buffer.Buffer.isBuffer(buf)) buf = (0, _buffer.Buffer)(buf);
+
+ var crc = ~ ~previous;
+
+ for (var index = 0; index < buf.length; index++) {
+ var byte = buf[index];
+ crc = TABLE[(crc ^ byte) & 0xff] & 0xff;
+ }
+
+ return crc;
+}); \ No newline at end of file
diff --git a/node_modules/crc/lib/crc8_1wire.js b/node_modules/crc/lib/crc8_1wire.js
new file mode 100644
index 0000000..d5ced54
--- /dev/null
+++ b/node_modules/crc/lib/crc8_1wire.js
@@ -0,0 +1,27 @@
+'use strict';
+
+var _buffer = require('buffer');
+
+var _define_crc = require('./define_crc');
+
+var _define_crc2 = _interopRequireDefault(_define_crc);
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+// Generated by `./pycrc.py --algorithm=table-driven --model=dallas-1-wire --generate=c`
+var TABLE = [0x00, 0x5e, 0xbc, 0xe2, 0x61, 0x3f, 0xdd, 0x83, 0xc2, 0x9c, 0x7e, 0x20, 0xa3, 0xfd, 0x1f, 0x41, 0x9d, 0xc3, 0x21, 0x7f, 0xfc, 0xa2, 0x40, 0x1e, 0x5f, 0x01, 0xe3, 0xbd, 0x3e, 0x60, 0x82, 0xdc, 0x23, 0x7d, 0x9f, 0xc1, 0x42, 0x1c, 0xfe, 0xa0, 0xe1, 0xbf, 0x5d, 0x03, 0x80, 0xde, 0x3c, 0x62, 0xbe, 0xe0, 0x02, 0x5c, 0xdf, 0x81, 0x63, 0x3d, 0x7c, 0x22, 0xc0, 0x9e, 0x1d, 0x43, 0xa1, 0xff, 0x46, 0x18, 0xfa, 0xa4, 0x27, 0x79, 0x9b, 0xc5, 0x84, 0xda, 0x38, 0x66, 0xe5, 0xbb, 0x59, 0x07, 0xdb, 0x85, 0x67, 0x39, 0xba, 0xe4, 0x06, 0x58, 0x19, 0x47, 0xa5, 0xfb, 0x78, 0x26, 0xc4, 0x9a, 0x65, 0x3b, 0xd9, 0x87, 0x04, 0x5a, 0xb8, 0xe6, 0xa7, 0xf9, 0x1b, 0x45, 0xc6, 0x98, 0x7a, 0x24, 0xf8, 0xa6, 0x44, 0x1a, 0x99, 0xc7, 0x25, 0x7b, 0x3a, 0x64, 0x86, 0xd8, 0x5b, 0x05, 0xe7, 0xb9, 0x8c, 0xd2, 0x30, 0x6e, 0xed, 0xb3, 0x51, 0x0f, 0x4e, 0x10, 0xf2, 0xac, 0x2f, 0x71, 0x93, 0xcd, 0x11, 0x4f, 0xad, 0xf3, 0x70, 0x2e, 0xcc, 0x92, 0xd3, 0x8d, 0x6f, 0x31, 0xb2, 0xec, 0x0e, 0x50, 0xaf, 0xf1, 0x13, 0x4d, 0xce, 0x90, 0x72, 0x2c, 0x6d, 0x33, 0xd1, 0x8f, 0x0c, 0x52, 0xb0, 0xee, 0x32, 0x6c, 0x8e, 0xd0, 0x53, 0x0d, 0xef, 0xb1, 0xf0, 0xae, 0x4c, 0x12, 0x91, 0xcf, 0x2d, 0x73, 0xca, 0x94, 0x76, 0x28, 0xab, 0xf5, 0x17, 0x49, 0x08, 0x56, 0xb4, 0xea, 0x69, 0x37, 0xd5, 0x8b, 0x57, 0x09, 0xeb, 0xb5, 0x36, 0x68, 0x8a, 0xd4, 0x95, 0xcb, 0x29, 0x77, 0xf4, 0xaa, 0x48, 0x16, 0xe9, 0xb7, 0x55, 0x0b, 0x88, 0xd6, 0x34, 0x6a, 0x2b, 0x75, 0x97, 0xc9, 0x4a, 0x14, 0xf6, 0xa8, 0x74, 0x2a, 0xc8, 0x96, 0x15, 0x4b, 0xa9, 0xf7, 0xb6, 0xe8, 0x0a, 0x54, 0xd7, 0x89, 0x6b, 0x35];
+
+if (typeof Int32Array !== 'undefined') TABLE = new Int32Array(TABLE);
+
+module.exports = (0, _define_crc2.default)('dallas-1-wire', function (buf, previous) {
+ if (!_buffer.Buffer.isBuffer(buf)) buf = (0, _buffer.Buffer)(buf);
+
+ var crc = ~ ~previous;
+
+ for (var index = 0; index < buf.length; index++) {
+ var byte = buf[index];
+ crc = TABLE[(crc ^ byte) & 0xff] & 0xff;
+ }
+
+ return crc;
+}); \ No newline at end of file
diff --git a/node_modules/crc/lib/define_crc.js b/node_modules/crc/lib/define_crc.js
new file mode 100644
index 0000000..70c3bdc
--- /dev/null
+++ b/node_modules/crc/lib/define_crc.js
@@ -0,0 +1,16 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+
+exports.default = function (model, calc) {
+ var fn = function fn(buf, previous) {
+ return calc(buf, previous) >>> 0;
+ };
+ fn.signed = calc;
+ fn.unsigned = fn;
+ fn.model = model;
+
+ return fn;
+}; \ No newline at end of file
diff --git a/node_modules/crc/lib/index.js b/node_modules/crc/lib/index.js
new file mode 100644
index 0000000..d25d8df
--- /dev/null
+++ b/node_modules/crc/lib/index.js
@@ -0,0 +1,14 @@
+'use strict';
+
+module.exports = {
+ crc1: require('./crc1'),
+ crc8: require('./crc8'),
+ crc81wire: require('./crc8_1wire'),
+ crc16: require('./crc16'),
+ crc16ccitt: require('./crc16_ccitt'),
+ crc16modbus: require('./crc16_modbus'),
+ crc16xmodem: require('./crc16_xmodem'),
+ crc16kermit: require('./crc16_kermit'),
+ crc24: require('./crc24'),
+ crc32: require('./crc32')
+}; \ No newline at end of file
diff --git a/node_modules/crc/package.json b/node_modules/crc/package.json
new file mode 100644
index 0000000..6d94f0d
--- /dev/null
+++ b/node_modules/crc/package.json
@@ -0,0 +1,93 @@
+{
+ "_args": [
+ [
+ "crc@3.4.0",
+ "/home/humair/School/csc309/a4/solutions_repo/node_modules/express-session"
+ ]
+ ],
+ "_from": "crc@3.4.0",
+ "_id": "crc@3.4.0",
+ "_inCache": true,
+ "_installable": true,
+ "_location": "/crc",
+ "_nodeVersion": "0.12.7",
+ "_npmUser": {
+ "email": "alex.gorbatchev@gmail.com",
+ "name": "alexgorbatchev"
+ },
+ "_npmVersion": "2.11.3",
+ "_phantomChildren": {},
+ "_requested": {
+ "name": "crc",
+ "raw": "crc@3.4.0",
+ "rawSpec": "3.4.0",
+ "scope": null,
+ "spec": "3.4.0",
+ "type": "version"
+ },
+ "_requiredBy": [
+ "/express-session"
+ ],
+ "_resolved": "https://registry.npmjs.org/crc/-/crc-3.4.0.tgz",
+ "_shasum": "4258e351613a74ef1153dfcb05e820c3e9715d7f",
+ "_shrinkwrap": null,
+ "_spec": "crc@3.4.0",
+ "_where": "/home/humair/School/csc309/a4/solutions_repo/node_modules/express-session",
+ "author": {
+ "name": "Alex Gorbatchev",
+ "url": "https://github.com/alexgorbatchev"
+ },
+ "babel": {
+ "presets": [
+ "es2015"
+ ]
+ },
+ "bugs": {
+ "url": "https://github.com/alexgorbatchev/node-crc/issues"
+ },
+ "dependencies": {},
+ "description": "Module for calculating Cyclic Redundancy Check (CRC) for Node.js and the Browser.",
+ "devDependencies": {
+ "babel-core": "^6.1.21",
+ "babel-preset-es2015": "^6.1.18",
+ "beautify-benchmark": "^0.2.4",
+ "benchmark": "^1.0.0",
+ "buffer-crc32": "^0.2.3",
+ "chai": "^3.4.1",
+ "mocha": "*",
+ "seedrandom": "^2.3.6"
+ },
+ "directories": {},
+ "dist": {
+ "shasum": "4258e351613a74ef1153dfcb05e820c3e9715d7f",
+ "tarball": "https://registry.npmjs.org/crc/-/crc-3.4.0.tgz"
+ },
+ "files": [
+ "lib"
+ ],
+ "gitHead": "3726e792cb4a328ef2d935cfd896e54fa9529aaf",
+ "homepage": "https://github.com/alexgorbatchev/node-crc",
+ "keywords": [
+ "crc"
+ ],
+ "license": "MIT",
+ "main": "./lib/index.js",
+ "maintainers": [
+ {
+ "name": "alexgorbatchev",
+ "email": "alex.gorbatchev@gmail.com"
+ }
+ ],
+ "name": "crc",
+ "optionalDependencies": {},
+ "readme": "ERROR: No README data found!",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/alexgorbatchev/node-crc.git"
+ },
+ "scripts": {
+ "pretest": "cd src && babel --out-dir ../lib *.js",
+ "test": "mocha test/*.test.js"
+ },
+ "version": "3.4.0"
+}
diff --git a/node_modules/csrf/HISTORY.md b/node_modules/csrf/HISTORY.md
new file mode 100644
index 0000000..cbccedf
--- /dev/null
+++ b/node_modules/csrf/HISTORY.md
@@ -0,0 +1,86 @@
+3.0.3 / 2016-05-26
+==================
+
+ * deps: tsscmp@1.0.5
+
+3.0.2 / 2016-05-22
+==================
+
+ * Use `tsscmp` module for timing-safe token verification
+ * deps: base64-url@1.2.2
+ * deps: uid-safe@2.1.1
+ - deps: base64-url@1.2.2
+
+3.0.1 / 2016-01-28
+==================
+
+ * deps: rndm@1.2.0
+ * deps: uid-safe@2.1.0
+ - Use `random-bytes` for byte source
+
+3.0.0 / 2015-05-09
+==================
+
+ * Remove `tokenize` export
+ * Remove `tokenize` option
+ * Return a prototype-based object rather than functions
+ - This means the resulting functions need to be called as methods
+ * Throw when missing secret to `tokens.create()`
+ * deps: uid-safe@~2.0.0
+ - Use global `Promise` when returning a promise
+
+2.0.7 / 2015-05-03
+==================
+
+ * Fix compatibility with `crypto.DEFAULT_ENCODING` global changes
+
+2.0.6 / 2015-02-13
+==================
+
+ * deps: base64-url@1.2.1
+ * deps: uid-safe@~1.1.0
+ - Use `crypto.randomBytes`, if available
+ - deps: base64-url@1.2.1
+
+2.0.5 / 2015-01-31
+==================
+
+ * deps: base64-url@1.2.0
+ * deps: uid-safe@~1.0.3
+ - Fix error branch that would throw
+ - deps: base64-url@1.2.0
+
+2.0.4 / 2015-01-08
+==================
+
+ * deps: uid-safe@~1.0.2
+ - Remove dependency on `mz`
+
+2.0.3 / 2014-12-30
+==================
+
+ * Slight speed improvement for `verify`
+ * deps: base64-url@1.1.0
+ * deps: rndm@~1.1.0
+
+2.0.2 / 2014-11-09
+==================
+
+ * deps: scmp@1.0.0
+
+2.0.1 / 2014-08-22
+==================
+
+ * Rename module to `csrf`
+
+2.0.0 / 2014-06-18
+==================
+
+ * Use `uid-safe` module
+ * Use `base64-url` module
+ * Remove sync `.secret()` -- use `.secretSync()` instead
+
+1.0.4 / 2014-06-11
+==================
+
+ * Make sure CSRF tokens are URL safe
diff --git a/node_modules/csrf/LICENSE b/node_modules/csrf/LICENSE
new file mode 100644
index 0000000..6b774b4
--- /dev/null
+++ b/node_modules/csrf/LICENSE
@@ -0,0 +1,22 @@
+The MIT License (MIT)
+
+Copyright (c) 2014 Jonathan Ong <me@jongleberry.com>
+Copyright (c) 2015 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/csrf/README.md b/node_modules/csrf/README.md
new file mode 100644
index 0000000..537a02a
--- /dev/null
+++ b/node_modules/csrf/README.md
@@ -0,0 +1,126 @@
+# CSRF
+
+[![NPM Version][npm-image]][npm-url]
+[![NPM Downloads][downloads-image]][downloads-url]
+[![Node.js Version][node-image]][node-url]
+[![Build Status][travis-image]][travis-url]
+[![Test Coverage][coveralls-image]][coveralls-url]
+
+Logic behind CSRF token creation and verification.
+
+Read [Understanding-CSRF](https://github.com/pillarjs/understanding-csrf)
+for more information on CSRF. Use this module to create custom CSRF middleware.
+
+Looking for a CSRF framework for your favorite framework that uses this
+module?
+
+ * Express/connect: [csurf](https://www.npmjs.com/package/csurf) or
+ [alt-xsrf](https://www.npmjs.com/package/alt-xsrf)
+ * Koa: [koa-csrf](https://www.npmjs.com/package/koa-csrf) or
+ [koa-atomic-session](https://www.npmjs.com/package/koa-atomic-session)
+
+### Install
+
+```bash
+$ npm install csrf
+```
+
+## API
+
+```js
+var Tokens = require('csrf')
+```
+
+### new Tokens([options])
+
+Create a new token generation/verification instance. The `options` argument is
+optional and will just use all defaults if missing.
+
+#### Options
+
+Tokens accepts these properties in the options object.
+
+##### saltLength
+
+The length of the internal salt to use, in characters. Internally, the salt
+is a base 62 string. Defaults to `8` characters.
+
+##### secretLength
+
+The length of the secret to generate, in bytes. Note that the secret is
+passed around base-64 encoded and that this length refers to the underlying
+bytes, not the length of the base-64 string. Defaults to `18` bytes.
+
+#### tokens.create(secret)
+
+Create a new CSRF token attached to the given `secret`. The `secret` is a
+string, typically generated from the `tokens.secret()` or `tokens.secretSync()`
+methods. This token is what you should add into HTML `<form>` blocks and
+expect the user's browser to provide back.
+
+```js
+var secret = tokens.secretSync()
+var token = tokens.create(secret)
+```
+
+#### tokens.secret(callback)
+
+Asynchronously create a new `secret`, which is a string. The secret is to
+be kept on the server, typically stored in a server-side session for the
+user. The secret should be at least per user.
+
+```js
+tokens.secret(function (err, secret) {
+ if (err) throw err
+ // do something with the secret
+})
+```
+
+#### tokens.secret()
+
+Asynchronously create a new `secret` and return a `Promise`. Please see
+`tokens.secret(callback)` documentation for full details.
+
+**Note**: To use promises in Node.js _prior to 0.12_, promises must be
+"polyfilled" using `global.Promise = require('bluebird')`.
+
+```js
+tokens.secret().then(function (secret) {
+ // do something with the secret
+})
+```
+
+#### tokens.secretSync()
+
+A synchronous version of `tokens.secret(callback)`. Please see
+`tokens.secret(callback)` documentation for full details.
+
+```js
+var secret = tokens.secretSync()
+```
+
+#### tokens.verify(secret, token)
+
+Check whether a CSRF token is valid for the given `secret`, returning
+a Boolean.
+
+```js
+if (!tokens.verify(secret, token)) {
+ throw new Error('invalid token!')
+}
+```
+
+## License
+
+[MIT](LICENSE)
+
+[npm-image]: https://img.shields.io/npm/v/csrf.svg
+[npm-url]: https://npmjs.org/package/csrf
+[node-image]: https://img.shields.io/node/v/csrf.svg
+[node-url]: https://nodejs.org/en/download/
+[travis-image]: https://img.shields.io/travis/pillarjs/csrf/master.svg
+[travis-url]: https://travis-ci.org/pillarjs/csrf
+[coveralls-image]: https://img.shields.io/coveralls/pillarjs/csrf/master.svg
+[coveralls-url]: https://coveralls.io/r/pillarjs/csrf?branch=master
+[downloads-image]: https://img.shields.io/npm/dm/csrf.svg
+[downloads-url]: https://npmjs.org/package/csrf
diff --git a/node_modules/csrf/index.js b/node_modules/csrf/index.js
new file mode 100644
index 0000000..9b252cd
--- /dev/null
+++ b/node_modules/csrf/index.js
@@ -0,0 +1,139 @@
+/*!
+ * csrf
+ * Copyright(c) 2014 Jonathan Ong
+ * Copyright(c) 2015 Douglas Christopher Wilson
+ * MIT Licensed
+ */
+
+'use strict'
+
+/**
+ * Module dependencies.
+ * @private
+ */
+
+var rndm = require('rndm')
+var uid = require('uid-safe')
+var compare = require('tsscmp')
+var crypto = require('crypto')
+var escape = require('base64-url').escape
+
+/**
+ * Module exports.
+ * @public
+ */
+
+module.exports = Tokens
+
+/**
+ * Token generation/verification class.
+ *
+ * @param {object} [options]
+ * @param {number} [options.saltLength=8] The string length of the salt
+ * @param {number} [options.secretLength=18] The byte length of the secret key
+ * @public
+ */
+
+function Tokens (options) {
+ if (!(this instanceof Tokens)) {
+ return new Tokens(options)
+ }
+
+ var opts = options || {}
+
+ var saltLength = opts.saltLength !== undefined
+ ? opts.saltLength
+ : 8
+
+ if (typeof saltLength !== 'number' || !isFinite(saltLength) || saltLength < 1) {
+ throw new TypeError('option saltLength must be finite number > 1')
+ }
+
+ var secretLength = opts.secretLength !== undefined
+ ? opts.secretLength
+ : 18
+
+ if (typeof secretLength !== 'number' || !isFinite(secretLength) || secretLength < 1) {
+ throw new TypeError('option secretLength must be finite number > 1')
+ }
+
+ this.saltLength = saltLength
+ this.secretLength = secretLength
+}
+
+/**
+ * Create a new CSRF token.
+ *
+ * @param {string} secret The secret for the token.
+ * @public
+ */
+
+Tokens.prototype.create = function create (secret) {
+ if (!secret || typeof secret !== 'string') {
+ throw new TypeError('argument secret is required')
+ }
+
+ return this._tokenize(secret, rndm(this.saltLength))
+}
+
+/**
+ * Create a new secret key.
+ *
+ * @param {function} [callback]
+ * @public
+ */
+
+Tokens.prototype.secret = function secret (callback) {
+ return uid(this.secretLength, callback)
+}
+
+/**
+ * Create a new secret key synchronously.
+ * @public
+ */
+
+Tokens.prototype.secretSync = function secretSync () {
+ return uid.sync(this.secretLength)
+}
+
+/**
+ * Tokenize a secret and salt.
+ * @private
+ */
+
+Tokens.prototype._tokenize = function tokenize (secret, salt) {
+ var hash = crypto
+ .createHash('sha1')
+ .update(salt + '-' + secret, 'ascii')
+ .digest('base64')
+ return escape(salt + '-' + hash)
+}
+
+/**
+ * Verify if a given token is valid for a given secret.
+ *
+ * @param {string} secret
+ * @param {string} token
+ * @public
+ */
+
+Tokens.prototype.verify = function verify (secret, token) {
+ if (!secret || typeof secret !== 'string') {
+ return false
+ }
+
+ if (!token || typeof token !== 'string') {
+ return false
+ }
+
+ var index = token.indexOf('-')
+
+ if (index === -1) {
+ return false
+ }
+
+ var salt = token.substr(0, index)
+ var expected = this._tokenize(secret, salt)
+
+ return compare(token, expected)
+}
diff --git a/node_modules/csrf/package.json b/node_modules/csrf/package.json
new file mode 100644
index 0000000..cec4192
--- /dev/null
+++ b/node_modules/csrf/package.json
@@ -0,0 +1,118 @@
+{
+ "_args": [
+ [
+ "csrf@~3.0.3",
+ "/home/humair/School/csc309/a4/solutions_repo/node_modules/csurf"
+ ]
+ ],
+ "_from": "csrf@>=3.0.3 <3.1.0",
+ "_id": "csrf@3.0.3",
+ "_inCache": true,
+ "_installable": true,
+ "_location": "/csrf",
+ "_npmOperationalInternal": {
+ "host": "packages-12-west.internal.npmjs.com",
+ "tmp": "tmp/csrf-3.0.3.tgz_1464315403837_0.44625049154274166"
+ },
+ "_npmUser": {
+ "email": "doug@somethingdoug.com",
+ "name": "dougwilson"
+ },
+ "_npmVersion": "1.4.28",
+ "_phantomChildren": {},
+ "_requested": {
+ "name": "csrf",
+ "raw": "csrf@~3.0.3",
+ "rawSpec": "~3.0.3",
+ "scope": null,
+ "spec": ">=3.0.3 <3.1.0",
+ "type": "range"
+ },
+ "_requiredBy": [
+ "/csurf"
+ ],
+ "_resolved": "https://registry.npmjs.org/csrf/-/csrf-3.0.3.tgz",
+ "_shasum": "69d13220de95762808bb120f7533a994fc4293b5",
+ "_shrinkwrap": null,
+ "_spec": "csrf@~3.0.3",
+ "_where": "/home/humair/School/csc309/a4/solutions_repo/node_modules/csurf",
+ "author": {
+ "email": "me@jongleberry.com",
+ "name": "Jonathan Ong",
+ "url": "http://jongleberry.com"
+ },
+ "bugs": {
+ "url": "https://github.com/pillarjs/csrf/issues"
+ },
+ "contributors": [
+ {
+ "name": "Douglas Christopher Wilson",
+ "email": "doug@somethingdoug.com"
+ }
+ ],
+ "dependencies": {
+ "base64-url": "1.2.2",
+ "rndm": "1.2.0",
+ "tsscmp": "1.0.5",
+ "uid-safe": "2.1.1"
+ },
+ "description": "primary logic behind csrf tokens",
+ "devDependencies": {
+ "bluebird": "3.4.0",
+ "eslint": "2.10.2",
+ "eslint-config-standard": "5.3.1",
+ "eslint-plugin-promise": "1.3.0",
+ "eslint-plugin-standard": "1.3.2",
+ "istanbul": "0.4.3",
+ "mocha": "2.5.3"
+ },
+ "directories": {},
+ "dist": {
+ "shasum": "69d13220de95762808bb120f7533a994fc4293b5",
+ "tarball": "https://registry.npmjs.org/csrf/-/csrf-3.0.3.tgz"
+ },
+ "engines": {
+ "node": ">= 0.8"
+ },
+ "files": [
+ "HISTORY.md",
+ "LICENSE",
+ "README.md",
+ "index.js"
+ ],
+ "gitHead": "dbf7629bbff7ae14dfa7fab1b439e01b5ba3b629",
+ "homepage": "https://github.com/pillarjs/csrf",
+ "keywords": [
+ "csrf",
+ "tokens"
+ ],
+ "license": "MIT",
+ "maintainers": [
+ {
+ "name": "dougwilson",
+ "email": "doug@somethingdoug.com"
+ },
+ {
+ "name": "dwolla",
+ "email": "api@dwolla.com"
+ },
+ {
+ "name": "jongleberry",
+ "email": "jonathanrichardong@gmail.com"
+ }
+ ],
+ "name": "csrf",
+ "optionalDependencies": {},
+ "readme": "ERROR: No README data found!",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/pillarjs/csrf.git"
+ },
+ "scripts": {
+ "lint": "eslint **/*.js",
+ "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": "3.0.3"
+}
diff --git a/node_modules/csurf/HISTORY.md b/node_modules/csurf/HISTORY.md
new file mode 100644
index 0000000..06019ed
--- /dev/null
+++ b/node_modules/csurf/HISTORY.md
@@ -0,0 +1,158 @@
+1.9.0 / 2016-05-27
+==================
+
+ * Pass invalid csrf token error to `next()` instead of throwing
+ * Pass misconfigured error to `next()` instead of throwing
+ * Provide misconfigured error when using cookies without cookie-parser
+ * deps: cookie@0.3.1
+ - Add `sameSite` option
+ - Fix cookie `Max-Age` to never be a floating point number
+ - Improve error message when `expires` is not a `Date`
+ - Throw better error for invalid argument to parse
+ - Throw on invalid values provided to `serialize`
+ - perf: enable strict mode
+ - perf: hoist regular expression
+ - perf: use for loop in parse
+ - perf: use string concatination for serialization
+ * deps: csrf@~3.0.3
+ - Use `tsscmp` module for timing-safe token verification
+ - deps: base64-url@1.2.2
+ - deps: rndm@1.2.0
+ - deps: uid-safe@2.1.1
+ * deps: http-errors@~1.5.0
+ - Add `HttpError` export, for `err instanceof createError.HttpError`
+ - Support new code `421 Misdirected Request`
+ - Use `setprototypeof` module to replace `__proto__` setting
+ - deps: inherits@2.0.1
+ - deps: statuses@'>= 1.3.0 < 2'
+ - perf: enable strict mode
+ * perf: enable strict mode
+ * perf: remove argument reassignment
+
+1.8.3 / 2015-06-10
+==================
+
+ * deps: cookie@0.1.3
+ - Slight optimizations
+
+1.8.2 / 2015-05-09
+==================
+
+ * deps: csrf@~3.0.0
+ - deps: uid-safe@~2.0.0
+
+1.8.1 / 2015-05-03
+==================
+
+ * deps: csrf@~2.0.7
+ - Fix compatibility with `crypto.DEFAULT_ENCODING` global changes
+
+1.8.0 / 2015-04-07
+==================
+
+ * Add `sessionKey` option
+
+1.7.0 / 2015-02-15
+==================
+
+ * Accept `CSRF-Token` and `XSRF-Token` request headers
+ * Default `cookie.path` to `'/'`, if using cookies
+ * deps: cookie-signature@1.0.6
+ * deps: csrf@~2.0.6
+ - deps: base64-url@1.2.1
+ - deps: uid-safe@~1.1.0
+ * deps: http-errors@~1.3.1
+ - Construct errors using defined constructors from `createError`
+ - Fix error names that are not identifiers
+ - Set a meaningful `name` property on constructed errors
+
+1.6.6 / 2015-01-31
+==================
+
+ * deps: csrf@~2.0.5
+ - deps: base64-url@1.2.0
+ - deps: uid-safe@~1.0.3
+
+1.6.5 / 2015-01-08
+==================
+
+ * deps: csrf@~2.0.4
+ - deps: uid-safe@~1.0.2
+
+1.6.4 / 2014-12-30
+==================
+
+ * deps: csrf@~2.0.3
+ - Slight speed improvement for `verify`
+ - deps: base64-url@1.1.0
+ - deps: rndm@~1.1.0
+ * deps: http-errors@~1.2.8
+ - Fix stack trace from exported function
+
+1.6.3 / 2014-11-09
+==================
+
+ * deps: csrf@~2.0.2
+ - deps: scmp@1.0.0
+ * deps: http-errors@~1.2.7
+ - Remove duplicate line
+
+1.6.2 / 2014-10-14
+==================
+
+ * Fix cookie name when using `cookie: true`
+ * deps: http-errors@~1.2.6
+ - Fix `expose` to be `true` for `ClientError` constructor
+ - Use `inherits` instead of `util`
+ - deps: statuses@1
+
+1.6.1 / 2014-09-05
+==================
+
+ * deps: cookie-signature@1.0.5
+
+1.6.0 / 2014-09-03
+==================
+
+ * Set `code` property on CSRF token errors
+
+1.5.0 / 2014-08-24
+==================
+
+ * Add `ignoreMethods` option
+
+1.4.1 / 2014-08-22
+==================
+
+ * Use `csrf-tokens` instead of `csrf`
+
+1.4.0 / 2014-07-30
+==================
+
+ * Support changing `req.session` after `csurf` middleware
+ - Calling `res.csrfToken()` after `req.session.destroy()` will now work
+
+1.3.0 / 2014-07-03
+==================
+
+ * Add support for environments without `res.cookie` (connect@3)
+
+1.2.2 / 2014-06-18
+==================
+
+ * deps: csrf-tokens@~2.0.0
+
+1.2.1 / 2014-06-09
+==================
+
+ * Refactor to use `csrf-tokens` module
+
+1.2.0 / 2014-05-13
+==================
+
+ * Add support for double-submit cookie
+
+1.1.0 / 2014-04-06
+==================
+
+ * Add constant-time string compare
diff --git a/node_modules/csurf/LICENSE b/node_modules/csurf/LICENSE
new file mode 100644
index 0000000..4abfea8
--- /dev/null
+++ b/node_modules/csurf/LICENSE
@@ -0,0 +1,23 @@
+(The MIT License)
+
+Copyright (c) 2014 Jonathan Ong <me@jongleberry.com>
+Copyright (c) 2014-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/csurf/README.md b/node_modules/csurf/README.md
new file mode 100644
index 0000000..dc88802
--- /dev/null
+++ b/node_modules/csurf/README.md
@@ -0,0 +1,238 @@
+# csurf
+
+[![NPM Version][npm-image]][npm-url]
+[![NPM Downloads][downloads-image]][downloads-url]
+[![Build status][travis-image]][travis-url]
+[![Test coverage][coveralls-image]][coveralls-url]
+[![Gratipay][gratipay-image]][gratipay-url]
+
+Node.js [CSRF](https://en.wikipedia.org/wiki/Cross-site_request_forgery) protection middleware.
+
+Requires either a session middleware or [cookie-parser](https://www.npmjs.com/package/cookie-parser) to be initialized first.
+
+ * If you are setting the ["cookie" option](#cookie) to a non-`false` value,
+ then you must use [cookie-parser](https://www.npmjs.com/package/cookie-parser)
+ before this module.
+ * Otherwise, you must use a session middleware before this module. For example:
+ - [express-session](https://www.npmjs.com/package/express-session)
+ - [cookie-session](https://www.npmjs.com/package/cookie-session)
+
+If you have questions on how this module is implemented, please read
+[Understanding CSRF](https://github.com/pillarjs/understanding-csrf).
+
+## Installation
+
+```sh
+$ npm install csurf
+```
+
+## API
+
+```js
+var csurf = require('csurf')
+```
+
+### csurf([options])
+
+Create a middleware for CSRF token creation and validation. This middleware
+adds a `req.csrfToken()` function to make a token which should be added to
+requests which mutate state, within a hidden form field, query-string etc.
+This token is validated against the visitor's session or csrf cookie.
+
+#### Options
+
+The `csurf` function takes an optional `options` object that may contain
+any of the following keys:
+
+##### cookie
+
+Determines if the token secret for the user should be stored in a cookie
+or in `req.session`. Defaults to `false`.
+
+When set to `true` (or an object of options for the cookie), then the module
+changes behavior and no longer uses `req.session`. This means you _are no
+longer required to use a session middleware_. Instead, you do need to use the
+[cookie-parser](https://www.npmjs.com/package/cookie-parser) middleware in
+your app before this middleware.
+
+When set to an object, cookie storage of the secret is enabled and the
+object contains options for this functionality (when set to `true`, the
+defaults for the options are used). The options may contain any of the
+following keys:
+
+ - `key` - the name of the cookie to use to store the token secret
+ (defaults to `'_csrf'`).
+ - `path` - the path of the cookie (defaults to `'/'`).
+ - any other [res.cookie](http://expressjs.com/4x/api.html#res.cookie)
+ option can be set.
+
+##### ignoreMethods
+
+An array of the methods for which CSRF token checking will disabled.
+Defaults to `['GET', 'HEAD', 'OPTIONS']`.
+
+##### sessionKey
+
+Determines what property ("key") on `req` the session object is located.
+Defaults to `'session'` (i.e. looks at `req.session`). The CSRF secret
+from this library is stored and read as `req[sessionKey].csrfSecret`.
+
+If the ["cookie" option](#cookie) is not `false`, then this option does
+nothing.
+
+##### value
+
+Provide a function that the middleware will invoke to read the token from
+the request for validation. The function is called as `value(req)` and is
+expected to return the token as a string.
+
+The default value is a function that reads the token from the following
+locations, in order:
+
+ - `req.body._csrf` - typically generated by the `body-parser` module.
+ - `req.query._csrf` - a built-in from Express.js to read from the URL
+ query string.
+ - `req.headers['csrf-token']` - the `CSRF-Token` HTTP request header.
+ - `req.headers['xsrf-token']` - the `XSRF-Token` HTTP request header.
+ - `req.headers['x-csrf-token']` - the `X-CSRF-Token` HTTP request header.
+ - `req.headers['x-xsrf-token']` - the `X-XSRF-Token` HTTP request header.
+
+## Example
+
+### Simple express example
+
+The following is an example of some server-side code that generates a form
+that requires a CSRF token to post back.
+
+```js
+var cookieParser = require('cookie-parser')
+var csrf = require('csurf')
+var bodyParser = require('body-parser')
+var express = require('express')
+
+// setup route middlewares
+var csrfProtection = csrf({ cookie: true })
+var parseForm = bodyParser.urlencoded({ extended: false })
+
+// create express app
+var app = express()
+
+// parse cookies
+// we need this because "cookie" is true in csrfProtection
+app.use(cookieParser())
+
+app.get('/form', csrfProtection, function(req, res) {
+ // pass the csrfToken to the view
+ res.render('send', { csrfToken: req.csrfToken() })
+})
+
+app.post('/process', parseForm, csrfProtection, function(req, res) {
+ res.send('data is being processed')
+})
+```
+
+Inside the view (depending on your template language; handlebars-style
+is demonstrated here), set the `csrfToken` value as the value of a hidden
+input field named `_csrf`:
+
+```html
+<form action="/process" method="POST">
+ <input type="hidden" name="_csrf" value="{{csrfToken}}">
+
+ Favorite color: <input type="text" name="favoriteColor">
+ <button type="submit">Submit</button>
+</form>
+```
+
+### Ignoring Routes
+
+**Note** CSRF checks should only be disabled for requests that you expect to
+come from outside of your website. Do not disable CSRF checks for requests
+that you expect to only come from your website. An existing session, even if
+it belongs to an authenticated user, is not enough to protect against CSRF
+attacks.
+
+The following is an example of how to order your routes so that certain endpoints
+do not check for a valid CSRF token.
+
+```js
+var cookieParser = require('cookie-parser')
+var csrf = require('csurf')
+var bodyParser = require('body-parser')
+var express = require('express')
+
+// create express app
+var app = express()
+
+// create api router
+var api = createApiRouter()
+
+// mount api before csrf is appended to the app stack
+app.use('/api', api)
+
+// now add csrf and other middlewares, after the "/api" was mounted
+app.use(bodyParser.urlencoded({ extended: false }))
+app.use(cookieParser())
+app.use(csrf({ cookie: true }))
+
+app.get('/form', function(req, res) {
+ // pass the csrfToken to the view
+ res.render('send', { csrfToken: req.csrfToken() })
+})
+
+app.post('/process', function(req, res) {
+ res.send('csrf was required to get here')
+})
+
+function createApiRouter() {
+ var router = new express.Router()
+
+ router.post('/getProfile', function(req, res) {
+ res.send('no csrf to get here')
+ })
+
+ return router
+}
+```
+
+### Custom error handling
+
+When the CSRF token validation fails, an error is thrown that has
+`err.code === 'EBADCSRFTOKEN'`. This can be used to display custom
+error messages.
+
+```js
+var bodyParser = require('body-parser')
+var cookieParser = require('cookie-parser')
+var csrf = require('csurf')
+var express = require('express')
+
+var app = express()
+app.use(bodyParser.urlencoded({ extended: false }))
+app.use(cookieParser())
+app.use(csrf({ cookie: true }))
+
+// error handler
+app.use(function (err, req, res, next) {
+ if (err.code !== 'EBADCSRFTOKEN') return next(err)
+
+ // handle CSRF token errors here
+ res.status(403)
+ res.send('form tampered with')
+})
+```
+
+## License
+
+[MIT](LICENSE)
+
+[npm-image]: https://img.shields.io/npm/v/csurf.svg
+[npm-url]: https://npmjs.org/package/csurf
+[travis-image]: https://img.shields.io/travis/expressjs/csurf/master.svg
+[travis-url]: https://travis-ci.org/expressjs/csurf
+[coveralls-image]: https://img.shields.io/coveralls/expressjs/csurf/master.svg
+[coveralls-url]: https://coveralls.io/r/expressjs/csurf?branch=master
+[downloads-image]: https://img.shields.io/npm/dm/csurf.svg
+[downloads-url]: https://npmjs.org/package/csurf
+[gratipay-image]: https://img.shields.io/gratipay/dougwilson.svg
+[gratipay-url]: https://gratipay.com/dougwilson/
diff --git a/node_modules/csurf/index.js b/node_modules/csurf/index.js
new file mode 100644
index 0000000..9b8c19e
--- /dev/null
+++ b/node_modules/csurf/index.js
@@ -0,0 +1,306 @@
+/*!
+ * csurf
+ * Copyright(c) 2011 Sencha Inc.
+ * Copyright(c) 2014 Jonathan Ong
+ * Copyright(c) 2014-2016 Douglas Christopher Wilson
+ * MIT Licensed
+ */
+
+'use strict'
+
+/**
+ * Module dependencies.
+ * @private
+ */
+
+var Cookie = require('cookie')
+var createError = require('http-errors')
+var sign = require('cookie-signature').sign
+var Tokens = require('csrf')
+
+/**
+ * Module exports.
+ * @public
+ */
+
+module.exports = csurf
+
+/**
+ * CSRF protection middleware.
+ *
+ * This middleware adds a `req.csrfToken()` function to make a token
+ * which should be added to requests which mutate
+ * state, within a hidden form field, query-string etc. This
+ * token is validated against the visitor's session.
+ *
+ * @param {Object} options
+ * @return {Function} middleware
+ * @public
+ */
+
+function csurf (options) {
+ var opts = options || {}
+
+ // get cookie options
+ var cookie = getCookieOptions(opts.cookie)
+
+ // get session options
+ var sessionKey = opts.sessionKey || 'session'
+
+ // get value getter
+ var value = opts.value || defaultValue
+
+ // token repo
+ var tokens = new Tokens(opts)
+
+ // ignored methods
+ var ignoreMethods = opts.ignoreMethods === undefined
+ ? ['GET', 'HEAD', 'OPTIONS']
+ : opts.ignoreMethods
+
+ if (!Array.isArray(ignoreMethods)) {
+ throw new TypeError('option ignoreMethods must be an array')
+ }
+
+ // generate lookup
+ var ignoreMethod = getIgnoredMethods(ignoreMethods)
+
+ return function csrf (req, res, next) {
+ // validate the configuration against request
+ if (!verifyConfiguration(req, sessionKey, cookie)) {
+ return next(new Error('misconfigured csrf'))
+ }
+
+ // get the secret from the request
+ var secret = getSecret(req, sessionKey, cookie)
+ var token
+
+ // lazy-load token getter
+ req.csrfToken = function csrfToken () {
+ var sec = !cookie
+ ? getSecret(req, sessionKey, cookie)
+ : secret
+
+ // use cached token if secret has not changed
+ if (token && sec === secret) {
+ return token
+ }
+
+ // generate & set new secret
+ if (sec === undefined) {
+ sec = tokens.secretSync()
+ setSecret(req, res, sessionKey, sec, cookie)
+ }
+
+ // update changed secret
+ secret = sec
+
+ // create new token
+ token = tokens.create(secret)
+
+ return token
+ }
+
+ // generate & set secret
+ if (!secret) {
+ secret = tokens.secretSync()
+ setSecret(req, res, sessionKey, secret, cookie)
+ }
+
+ // verify the incoming token
+ if (!ignoreMethod[req.method] && !tokens.verify(secret, value(req))) {
+ return next(createError(403, 'invalid csrf token', {
+ code: 'EBADCSRFTOKEN'
+ }))
+ }
+
+ next()
+ }
+}
+
+/**
+ * Default value function, checking the `req.body`
+ * and `req.query` for the CSRF token.
+ *
+ * @param {IncomingMessage} req
+ * @return {String}
+ * @api private
+ */
+
+function defaultValue (req) {
+ return (req.body && req.body._csrf) ||
+ (req.query && req.query._csrf) ||
+ (req.headers['csrf-token']) ||
+ (req.headers['xsrf-token']) ||
+ (req.headers['x-csrf-token']) ||
+ (req.headers['x-xsrf-token'])
+}
+
+/**
+ * Get options for cookie.
+ *
+ * @param {boolean|object} [options]
+ * @returns {object}
+ * @api private
+ */
+
+function getCookieOptions (options) {
+ if (options !== true && typeof options !== 'object') {
+ return undefined
+ }
+
+ var opts = {
+ key: '_csrf',
+ path: '/'
+ }
+
+ if (options && typeof options === 'object') {
+ for (var prop in options) {
+ var val = options[prop]
+
+ if (val !== undefined) {
+ opts[prop] = val
+ }
+ }
+ }
+
+ return opts
+}
+
+/**
+ * Get a lookup of ignored methods.
+ *
+ * @param {array} methods
+ * @returns {object}
+ * @api private
+ */
+
+function getIgnoredMethods (methods) {
+ var obj = Object.create(null)
+
+ for (var i = 0; i < methods.length; i++) {
+ var method = methods[i].toUpperCase()
+ obj[method] = true
+ }
+
+ return obj
+}
+
+/**
+ * Get the token secret from the request.
+ *
+ * @param {IncomingMessage} req
+ * @param {String} sessionKey
+ * @param {Object} [cookie]
+ * @api private
+ */
+
+function getSecret (req, sessionKey, cookie) {
+ // get the bag & key
+ var bag = getSecretBag(req, sessionKey, cookie)
+ var key = cookie ? cookie.key : 'csrfSecret'
+
+ if (!bag) {
+ /* istanbul ignore next: should never actually run */
+ throw new Error('misconfigured csrf')
+ }
+
+ // return secret from bag
+ return bag[key]
+}
+
+/**
+ * Get the token secret bag from the request.
+ *
+ * @param {IncomingMessage} req
+ * @param {String} sessionKey
+ * @param {Object} [cookie]
+ * @api private
+ */
+
+function getSecretBag (req, sessionKey, cookie) {
+ if (cookie) {
+ // get secret from cookie
+ var cookieKey = cookie.signed
+ ? 'signedCookies'
+ : 'cookies'
+
+ return req[cookieKey]
+ } else {
+ // get secret from session
+ return req[sessionKey]
+ }
+}
+
+/**
+ * Set a cookie on the HTTP response.
+ *
+ * @param {OutgoingMessage} res
+ * @param {string} name
+ * @param {string} val
+ * @param {Object} [options]
+ * @api private
+ */
+
+function setCookie (res, name, val, options) {
+ var data = Cookie.serialize(name, val, options)
+
+ var prev = res.getHeader('set-cookie') || []
+ var header = Array.isArray(prev) ? prev.concat(data)
+ : Array.isArray(data) ? [prev].concat(data)
+ : [prev, data]
+
+ res.setHeader('set-cookie', header)
+}
+
+/**
+ * Set the token secret on the request.
+ *
+ * @param {IncomingMessage} req
+ * @param {OutgoingMessage} res
+ * @param {string} sessionKey
+ * @param {string} val
+ * @param {Object} [cookie]
+ * @api private
+ */
+
+function setSecret (req, res, sessionKey, val, cookie) {
+ if (cookie) {
+ // set secret on cookie
+ if (cookie.signed) {
+ var secret = req.secret
+
+ if (!secret) {
+ /* istanbul ignore next: should never actually run */
+ throw new Error('misconfigured csrf')
+ }
+
+ val = 's:' + sign(val, secret)
+ }
+
+ setCookie(res, cookie.key, val, cookie)
+ } else if (req[sessionKey]) {
+ // set secret on session
+ req[sessionKey].csrfSecret = val
+ } else {
+ /* istanbul ignore next: should never actually run */
+ throw new Error('misconfigured csrf')
+ }
+}
+
+/**
+ * Verify the configuration against the request.
+ * @private
+ */
+
+function verifyConfiguration (req, sessionKey, cookie) {
+ if (!getSecretBag(req, sessionKey, cookie)) {
+ return false
+ }
+
+ if (cookie && cookie.signed && !req.secret) {
+ return false
+ }
+
+ return true
+}
diff --git a/node_modules/csurf/package.json b/node_modules/csurf/package.json
new file mode 100644
index 0000000..073330b
--- /dev/null
+++ b/node_modules/csurf/package.json
@@ -0,0 +1,135 @@
+{
+ "_args": [
+ [
+ "csurf",
+ "/home/humair/School/csc309/a4/solutions_repo"
+ ]
+ ],
+ "_from": "csurf@latest",
+ "_id": "csurf@1.9.0",
+ "_inCache": true,
+ "_installable": true,
+ "_location": "/csurf",
+ "_npmOperationalInternal": {
+ "host": "packages-12-west.internal.npmjs.com",
+ "tmp": "tmp/csurf-1.9.0.tgz_1464369669689_0.553399148164317"
+ },
+ "_npmUser": {
+ "email": "doug@somethingdoug.com",
+ "name": "dougwilson"
+ },
+ "_npmVersion": "1.4.28",
+ "_phantomChildren": {},
+ "_requested": {
+ "name": "csurf",
+ "raw": "csurf",
+ "rawSpec": "",
+ "scope": null,
+ "spec": "latest",
+ "type": "tag"
+ },
+ "_requiredBy": [
+ "/"
+ ],
+ "_resolved": "https://registry.npmjs.org/csurf/-/csurf-1.9.0.tgz",
+ "_shasum": "49d2c6925ffcec7b7de559597c153fa533364133",
+ "_shrinkwrap": null,
+ "_spec": "csurf",
+ "_where": "/home/humair/School/csc309/a4/solutions_repo",
+ "author": {
+ "email": "me@jongleberry.com",
+ "name": "Jonathan Ong",
+ "url": "http://jongleberry.com"
+ },
+ "bugs": {
+ "url": "https://github.com/expressjs/csurf/issues"
+ },
+ "contributors": [
+ {
+ "name": "Douglas Christopher Wilson",
+ "email": "doug@somethingdoug.com"
+ }
+ ],
+ "dependencies": {
+ "cookie": "0.3.1",
+ "cookie-signature": "1.0.6",
+ "csrf": "~3.0.3",
+ "http-errors": "~1.5.0"
+ },
+ "description": "CSRF token middleware",
+ "devDependencies": {
+ "body-parser": "1.15.1",
+ "connect": "3.4.1",
+ "cookie-parser": "1.4.3",
+ "cookie-session": "~1.1.0",
+ "eslint": "2.10.2",
+ "eslint-config-standard": "5.3.1",
+ "eslint-plugin-promise": "1.3.1",
+ "eslint-plugin-standard": "1.3.2",
+ "istanbul": "0.4.3",
+ "mocha": "2.5.3",
+ "supertest": "1.1.0"
+ },
+ "directories": {},
+ "dist": {
+ "shasum": "49d2c6925ffcec7b7de559597c153fa533364133",
+ "tarball": "https://registry.npmjs.org/csurf/-/csurf-1.9.0.tgz"
+ },
+ "engines": {
+ "node": ">= 0.8.0"
+ },
+ "files": [
+ "HISTORY.md",
+ "LICENSE",
+ "index.js"
+ ],
+ "gitHead": "6359a0298e1e3e937abb96c21958b2a4419d0301",
+ "homepage": "https://github.com/expressjs/csurf",
+ "keywords": [
+ "csrf",
+ "express",
+ "middleware",
+ "tokens"
+ ],
+ "license": "MIT",
+ "maintainers": [
+ {
+ "name": "defunctzombie",
+ "email": "shtylman@gmail.com"
+ },
+ {
+ "name": "dougwilson",
+ "email": "doug@somethingdoug.com"
+ },
+ {
+ "name": "fishrock123",
+ "email": "fishrock123@rocketmail.com"
+ },
+ {
+ "name": "jongleberry",
+ "email": "jonathanrichardong@gmail.com"
+ },
+ {
+ "name": "mscdex",
+ "email": "mscdex@mscdex.net"
+ },
+ {
+ "name": "tjholowaychuk",
+ "email": "tj@vision-media.ca"
+ }
+ ],
+ "name": "csurf",
+ "optionalDependencies": {},
+ "readme": "ERROR: No README data found!",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/expressjs/csurf.git"
+ },
+ "scripts": {
+ "lint": "eslint **/*.js",
+ "test": "mocha --check-leaks --reporter spec --bail test/",
+ "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --check-leaks --reporter dot test/",
+ "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --check-leaks --reporter spec test/"
+ },
+ "version": "1.9.0"
+}
diff --git a/node_modules/express-session/HISTORY.md b/node_modules/express-session/HISTORY.md
new file mode 100644
index 0000000..8ec8885
--- /dev/null
+++ b/node_modules/express-session/HISTORY.md
@@ -0,0 +1,314 @@
+1.14.0 / 2016-07-01
+===================
+
+ * Correctly inherit from `EventEmitter` class in `Store` base class
+ * Fix issue where `Set-Cookie` `Expires` was not always updated
+ * Methods are no longer enumerable on `req.session` object
+ * deps: cookie@0.3.1
+ - Add `sameSite` option
+ - Improve error message when `encode` is not a function
+ - Improve error message when `expires` is not a `Date`
+ - perf: enable strict mode
+ - perf: use for loop in parse
+ - perf: use string concatination for serialization
+ * deps: parseurl@~1.3.1
+ - perf: enable strict mode
+ * deps: uid-safe@~2.1.1
+ - Use `random-bytes` for byte source
+ - deps: base64-url@1.2.2
+ * perf: enable strict mode
+ * perf: remove argument reassignment
+
+1.13.0 / 2016-01-10
+===================
+
+ * Fix `rolling: true` to not set cookie when no session exists
+ - Better `saveUninitialized: false` + `rolling: true` behavior
+ * deps: crc@3.4.0
+
+1.12.1 / 2015-10-29
+===================
+
+ * deps: cookie@0.2.3
+ - Fix cookie `Max-Age` to never be a floating point number
+
+1.12.0 / 2015-10-25
+===================
+
+ * Support the value `'auto'` in the `cookie.secure` option
+ * deps: cookie@0.2.2
+ - Throw on invalid values provided to `serialize`
+ * deps: depd@~1.1.0
+ - Enable strict mode in more places
+ - Support web browser loading
+ * deps: on-headers@~1.0.1
+ - perf: enable strict mode
+
+1.11.3 / 2015-05-22
+===================
+
+ * deps: cookie@0.1.3
+ - Slight optimizations
+ * deps: crc@3.3.0
+
+1.11.2 / 2015-05-10
+===================
+
+ * deps: debug@~2.2.0
+ - deps: ms@0.7.1
+ * deps: uid-safe@~2.0.0
+
+1.11.1 / 2015-04-08
+===================
+
+ * Fix mutating `options.secret` value
+
+1.11.0 / 2015-04-07
+===================
+
+ * Support an array in `secret` option for key rotation
+ * deps: depd@~1.0.1
+
+1.10.4 / 2015-03-15
+===================
+
+ * deps: debug@~2.1.3
+ - Fix high intensity foreground color for bold
+ - deps: ms@0.7.0
+
+1.10.3 / 2015-02-16
+===================
+
+ * deps: cookie-signature@1.0.6
+ * deps: uid-safe@1.1.0
+ - Use `crypto.randomBytes`, if available
+ - deps: base64-url@1.2.1
+
+1.10.2 / 2015-01-31
+===================
+
+ * deps: uid-safe@1.0.3
+ - Fix error branch that would throw
+ - deps: base64-url@1.2.0
+
+1.10.1 / 2015-01-08
+===================
+
+ * deps: uid-safe@1.0.2
+ - Remove dependency on `mz`
+
+1.10.0 / 2015-01-05
+===================
+
+ * Add `store.touch` interface for session stores
+ * Fix `MemoryStore` expiration with `resave: false`
+ * deps: debug@~2.1.1
+
+1.9.3 / 2014-12-02
+==================
+
+ * Fix error when `req.sessionID` contains a non-string value
+
+1.9.2 / 2014-11-22
+==================
+
+ * deps: crc@3.2.1
+ - Minor fixes
+
+1.9.1 / 2014-10-22
+==================
+
+ * Remove unnecessary empty write call
+ - Fixes Node.js 0.11.14 behavior change
+ - Helps work-around Node.js 0.10.1 zlib bug
+
+1.9.0 / 2014-09-16
+==================
+
+ * deps: debug@~2.1.0
+ - Implement `DEBUG_FD` env variable support
+ * deps: depd@~1.0.0
+
+1.8.2 / 2014-09-15
+==================
+
+ * Use `crc` instead of `buffer-crc32` for speed
+ * deps: depd@0.4.5
+
+1.8.1 / 2014-09-08
+==================
+
+ * Keep `req.session.save` non-enumerable
+ * Prevent session prototype methods from being overwritten
+
+1.8.0 / 2014-09-07
+==================
+
+ * Do not resave already-saved session at end of request
+ * deps: cookie-signature@1.0.5
+ * deps: debug@~2.0.0
+
+1.7.6 / 2014-08-18
+==================
+
+ * Fix exception on `res.end(null)` calls
+
+1.7.5 / 2014-08-10
+==================
+
+ * Fix parsing original URL
+ * deps: on-headers@~1.0.0
+ * deps: parseurl@~1.3.0
+
+1.7.4 / 2014-08-05
+==================
+
+ * Fix response end delay for non-chunked responses
+
+1.7.3 / 2014-08-05
+==================
+
+ * Fix `res.end` patch to call correct upstream `res.write`
+
+1.7.2 / 2014-07-27
+==================
+
+ * deps: depd@0.4.4
+ - Work-around v8 generating empty stack traces
+
+1.7.1 / 2014-07-26
+==================
+
+ * deps: depd@0.4.3
+ - Fix exception when global `Error.stackTraceLimit` is too low
+
+1.7.0 / 2014-07-22
+==================
+
+ * Improve session-ending error handling
+ - Errors are passed to `next(err)` instead of `console.error`
+ * deps: debug@1.0.4
+ * deps: depd@0.4.2
+ - Add `TRACE_DEPRECATION` environment variable
+ - Remove non-standard grey color from color output
+ - Support `--no-deprecation` argument
+ - Support `--trace-deprecation` argument
+
+1.6.5 / 2014-07-11
+==================
+
+ * Do not require `req.originalUrl`
+ * deps: debug@1.0.3
+ - Add support for multiple wildcards in namespaces
+
+1.6.4 / 2014-07-07
+==================
+
+ * Fix blank responses for stores with synchronous operations
+
+1.6.3 / 2014-07-04
+==================
+
+ * Fix resave deprecation message
+
+1.6.2 / 2014-07-04
+==================
+
+ * Fix confusing option deprecation messages
+
+1.6.1 / 2014-06-28
+==================
+
+ * Fix saveUninitialized deprecation message
+
+1.6.0 / 2014-06-28
+==================
+
+ * Add deprecation message to undefined `resave` option
+ * Add deprecation message to undefined `saveUninitialized` option
+ * Fix `res.end` patch to return correct value
+ * Fix `res.end` patch to handle multiple `res.end` calls
+ * Reject cookies with missing signatures
+
+1.5.2 / 2014-06-26
+==================
+
+ * deps: cookie-signature@1.0.4
+ - fix for timing attacks
+
+1.5.1 / 2014-06-21
+==================
+
+ * Move hard-to-track-down `req.secret` deprecation message
+
+1.5.0 / 2014-06-19
+==================
+
+ * Debug name is now "express-session"
+ * Deprecate integration with `cookie-parser` middleware
+ * Deprecate looking for secret in `req.secret`
+ * Directly read cookies; `cookie-parser` no longer required
+ * Directly set cookies; `res.cookie` no longer required
+ * Generate session IDs with `uid-safe`, faster and even less collisions
+
+1.4.0 / 2014-06-17
+==================
+
+ * Add `genid` option to generate custom session IDs
+ * Add `saveUninitialized` option to control saving uninitialized sessions
+ * Add `unset` option to control unsetting `req.session`
+ * Generate session IDs with `rand-token` by default; reduce collisions
+ * deps: buffer-crc32@0.2.3
+
+1.3.1 / 2014-06-14
+==================
+
+ * Add description in package for npmjs.org listing
+
+1.3.0 / 2014-06-14
+==================
+
+ * Integrate with express "trust proxy" by default
+ * deps: debug@1.0.2
+
+1.2.1 / 2014-05-27
+==================
+
+ * Fix `resave` such that `resave: true` works
+
+1.2.0 / 2014-05-19
+==================
+
+ * Add `resave` option to control saving unmodified sessions
+
+1.1.0 / 2014-05-12
+==================
+
+ * Add `name` option; replacement for `key` option
+ * Use `setImmediate` in MemoryStore for node.js >= 0.10
+
+1.0.4 / 2014-04-27
+==================
+
+ * deps: debug@0.8.1
+
+1.0.3 / 2014-04-19
+==================
+
+ * Use `res.cookie()` instead of `res.setHeader()`
+ * deps: cookie@0.1.2
+
+1.0.2 / 2014-02-23
+==================
+
+ * Add missing dependency to `package.json`
+
+1.0.1 / 2014-02-15
+==================
+
+ * Add missing dependencies to `package.json`
+
+1.0.0 / 2014-02-15
+==================
+
+ * Genesis from `connect`
diff --git a/node_modules/express-session/LICENSE b/node_modules/express-session/LICENSE
new file mode 100644
index 0000000..9b59ff8
--- /dev/null
+++ b/node_modules/express-session/LICENSE
@@ -0,0 +1,24 @@
+(The MIT License)
+
+Copyright (c) 2010 Sencha Inc.
+Copyright (c) 2011 TJ Holowaychuk <tj@vision-media.ca>
+Copyright (c) 2014-2015 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/express-session/README.md b/node_modules/express-session/README.md
new file mode 100644
index 0000000..b88ed82
--- /dev/null
+++ b/node_modules/express-session/README.md
@@ -0,0 +1,655 @@
+# express-session
+
+[![NPM Version][npm-image]][npm-url]
+[![NPM Downloads][downloads-image]][downloads-url]
+[![Build Status][travis-image]][travis-url]
+[![Test Coverage][coveralls-image]][coveralls-url]
+[![Gratipay][gratipay-image]][gratipay-url]
+
+## Installation
+
+```bash
+$ npm install express-session
+```
+
+## API
+
+```js
+var session = require('express-session')
+```
+
+### session(options)
+
+Create a session middleware with the given `options`.
+
+**Note** Session data is _not_ saved in the cookie itself, just the session ID.
+Session data is stored server-side.
+
+**Note** Since version 1.5.0, the [`cookie-parser` middleware](https://www.npmjs.com/package/cookie-parser)
+no longer needs to be used for this module to work. This module now directly reads
+and writes cookies on `req`/`res`. Using `cookie-parser` may result in issues
+if the `secret` is not the same between this module and `cookie-parser`.
+
+**Warning** The default server-side session storage, `MemoryStore`, is _purposely_
+not designed for a production environment. It will leak memory under most
+conditions, does not scale past a single process, and is meant for debugging and
+developing.
+
+For a list of stores, see [compatible session stores](#compatible-session-stores).
+
+#### Options
+
+`express-session` accepts these properties in the options object.
+
+##### cookie
+
+Settings object for the session ID cookie. The default value is
+`{ path: '/', httpOnly: true, secure: false, maxAge: null }`.
+
+The following are options that can be set in this object.
+
+###### domain
+
+Specifies the value for the `Domain` `Set-Cookie` attribute. By default, no domain
+is set, and most clients will consider the cookie to apply to only the current
+domain.
+
+###### expires
+
+Specifies the `Date` object to be the value for the `Expires` `Set-Cookie` attribute.
+By default, no expiration is set, and most clients will consider this a
+"non-persistent cookie" and will delete it on a condition like exiting a web browser
+application.
+
+**Note** If both `expires` and `maxAge` are set in the options, then the last one
+defined in the object is what is used.
+
+**Note** The `expires` option should not be set directly; instead only use the `maxAge`
+option.
+
+###### httpOnly
+
+Specifies the `boolean` value for the `HttpOnly` `Set-Cookie` attribute. When truthy,
+the `HttpOnly` attribute is set, otherwise it is not. By default, the `HttpOnly`
+attribute is set.
+
+**Note** be careful when setting this to `true`, as compliant clients will not allow
+client-side JavaScript to see the cookie in `document.cookie`.
+
+###### maxAge
+
+Specifies the `number` (in milliseconds) to use when calculating the `Expires`
+`Set-Cookie` attribute. This is done by taking the current server time and adding
+`maxAge` milliseconds to the value to calculate an `Expires` datetime. By default,
+no maximum age is set.
+
+**Note** If both `expires` and `maxAge` are set in the options, then the last one
+defined in the object is what is used.
+
+###### path
+
+Specifies the value for the `Path` `Set-Cookie`. By default, this is set to `'/'`, which
+is the root path of the domain.
+
+###### sameSite
+
+Specifies the `boolean` or `string` to be the value for the `SameSite` `Set-Cookie` attribute.
+
+ - `true` will set the `SameSite` attribute to `Strict` for strict same site enforcement.
+ - `false` will not set the `SameSite` attribute.
+ - `'lax'` will set the `SameSite` attribute to `Lax` for lax same site enforcement.
+ - `'strict'` will set the `SameSite` attribute to `Strict` for strict same site enforcement.
+
+More information about the different enforcement levels can be found in the specification
+https://tools.ietf.org/html/draft-west-first-party-cookies-07#section-4.1.1
+
+**Note** This is an attribute that has not yet been fully standardized, and may change in
+the future. This also means many clients may ignore this attribute until they understand it.
+
+###### secure
+
+Specifies the `boolean` value for the `Secure` `Set-Cookie` attribute. When truthy,
+the `Secure` attribute is set, otherwise it is not. By default, the `Secure`
+attribute is not set.
+
+**Note** be careful when setting this to `true`, as compliant clients will not send
+the cookie back to the server in the future if the browser does not have an HTTPS
+connection.
+
+Please note that `secure: true` is a **recommended** option. However, it requires
+an https-enabled website, i.e., HTTPS is necessary for secure cookies. If `secure`
+is set, and you access your site over HTTP, the cookie will not be set. If you
+have your node.js behind a proxy and are using `secure: true`, you need to set
+"trust proxy" in express:
+
+```js
+var app = express()
+app.set('trust proxy', 1) // trust first proxy
+app.use(session({
+ secret: 'keyboard cat',
+ resave: false,
+ saveUninitialized: true,
+ cookie: { secure: true }
+}))
+```
+
+For using secure cookies in production, but allowing for testing in development,
+the following is an example of enabling this setup based on `NODE_ENV` in express:
+
+```js
+var app = express()
+var sess = {
+ secret: 'keyboard cat',
+ cookie: {}
+}
+
+if (app.get('env') === 'production') {
+ app.set('trust proxy', 1) // trust first proxy
+ sess.cookie.secure = true // serve secure cookies
+}
+
+app.use(session(sess))
+```
+
+The `cookie.secure` option can also be set to the special value `'auto'` to have
+this setting automatically match the determined security of the connection. Be
+careful when using this setting if the site is available both as HTTP and HTTPS,
+as once the cookie is set on HTTPS, it will no longer be visible over HTTP. This
+is useful when the Express `"trust proxy"` setting is properly setup to simplify
+development vs production configuration.
+
+##### genid
+
+Function to call to generate a new session ID. Provide a function that returns
+a string that will be used as a session ID. The function is given `req` as the
+first argument if you want to use some value attached to `req` when generating
+the ID.
+
+The default value is a function which uses the `uid-safe` library to generate IDs.
+
+**NOTE** be careful to generate unique IDs so your sessions do not conflict.
+
+```js
+app.use(session({
+ genid: function(req) {
+ return genuuid() // use UUIDs for session IDs
+ },
+ secret: 'keyboard cat'
+}))
+```
+
+##### name
+
+The name of the session ID cookie to set in the response (and read from in the
+request).
+
+The default value is `'connect.sid'`.
+
+**Note** if you have multiple apps running on the same hostname (this is just
+the name, i.e. `localhost` or `127.0.0.1`; different schemes and ports do not
+name a different hostname), then you need to separate the session cookies from
+each other. The simplest method is to simply set different `name`s per app.
+
+##### proxy
+
+Trust the reverse proxy when setting secure cookies (via the "X-Forwarded-Proto"
+header).
+
+The default value is `undefined`.
+
+ - `true` The "X-Forwarded-Proto" header will be used.
+ - `false` All headers are ignored and the connection is considered secure only
+ if there is a direct TLS/SSL connection.
+ - `undefined` Uses the "trust proxy" setting from express
+
+##### resave
+
+Forces the session to be saved back to the session store, even if the session
+was never modified during the request. Depending on your store this may be
+necessary, but it can also create race conditions where a client makes two
+parallel requests to your server and changes made to the session in one
+request may get overwritten when the other request ends, even if it made no
+changes (this behavior also depends on what store you're using).
+
+The default value is `true`, but using the default has been deprecated,
+as the default will change in the future. Please research into this setting
+and choose what is appropriate to your use-case. Typically, you'll want
+`false`.
+
+How do I know if this is necessary for my store? The best way to know is to
+check with your store if it implements the `touch` method. If it does, then
+you can safely set `resave: false`. If it does not implement the `touch`
+method and your store sets an expiration date on stored sessions, then you
+likely need `resave: true`.
+
+##### rolling
+
+Force a session identifier cookie to be set on every response. The expiration
+is reset to the original [`maxAge`](#cookiemaxage), resetting the expiration
+countdown.
+
+The default value is `false`.
+
+**Note** When this option is set to `true` but the `saveUninitialized` option is
+set to `false`, the cookie will not be set on a response with an uninitialized
+session.
+
+##### saveUninitialized
+
+Forces a session that is "uninitialized" to be saved to the store. A session is
+uninitialized when it is new but not modified. Choosing `false` is useful for
+implementing login sessions, reducing server storage usage, or complying with
+laws that require permission before setting a cookie. Choosing `false` will also
+help with race conditions where a client makes multiple parallel requests
+without a session.
+
+The default value is `true`, but using the default has been deprecated, as the
+default will change in the future. Please research into this setting and
+choose what is appropriate to your use-case.
+
+**Note** if you are using Session in conjunction with PassportJS, Passport
+will add an empty Passport object to the session for use after a user is
+authenticated, which will be treated as a modification to the session, causing
+it to be saved. *This has been fixed in PassportJS 0.3.0*
+
+##### secret
+
+**Required option**
+
+This is the secret used to sign the session ID cookie. This can be either a string
+for a single secret, or an array of multiple secrets. If an array of secrets is
+provided, only the first element will be used to sign the session ID cookie, while
+all the elements will be considered when verifying the signature in requests.
+
+##### store
+
+The session store instance, defaults to a new `MemoryStore` instance.
+
+##### unset
+
+Control the result of unsetting `req.session` (through `delete`, setting to `null`,
+etc.).
+
+The default value is `'keep'`.
+
+ - `'destroy'` The session will be destroyed (deleted) when the response ends.
+ - `'keep'` The session in the store will be kept, but modifications made during
+ the request are ignored and not saved.
+
+### req.session
+
+To store or access session data, simply use the request property `req.session`,
+which is (generally) serialized as JSON by the store, so nested objects
+are typically fine. For example below is a user-specific view counter:
+
+```js
+// Use the session middleware
+app.use(session({ secret: 'keyboard cat', cookie: { maxAge: 60000 }}))
+
+// Access the session as req.session
+app.get('/', function(req, res, next) {
+ var sess = req.session
+ if (sess.views) {
+ sess.views++
+ res.setHeader('Content-Type', 'text/html')
+ res.write('<p>views: ' + sess.views + '</p>')
+ res.write('<p>expires in: ' + (sess.cookie.maxAge / 1000) + 's</p>')
+ res.end()
+ } else {
+ sess.views = 1
+ res.end('welcome to the session demo. refresh!')
+ }
+})
+```
+
+#### Session.regenerate()
+
+To regenerate the session simply invoke the method. Once complete,
+a new SID and `Session` instance will be initialized at `req.session`.
+
+```js
+req.session.regenerate(function(err) {
+ // will have a new session here
+})
+```
+
+#### Session.destroy()
+
+Destroys the session, removing `req.session`; will be re-generated next request.
+
+```js
+req.session.destroy(function(err) {
+ // cannot access session here
+})
+```
+
+#### Session.reload()
+
+Reloads the session data.
+
+```js
+req.session.reload(function(err) {
+ // session updated
+})
+```
+
+#### Session.save()
+
+Save the session back to the store, replacing the contents on the store with the
+contents in memory (though a store may do something else--consult the store's
+documentation for exact behavior).
+
+This method is automatically called at the end of the HTTP response if the
+session data has been altered (though this behavior can be altered with various
+options in the middleware constructor). Because of this, typically this method
+does not need to be called.
+
+There are some cases where it is useful to call this method, for example, long-
+lived requests or in WebSockets.
+
+```js
+req.session.save(function(err) {
+ // session saved
+})
+```
+
+#### Session.touch()
+
+Updates the `.maxAge` property. Typically this is
+not necessary to call, as the session middleware does this for you.
+
+### req.session.id
+
+Each session has a unique ID associated with it. This property will
+contain the session ID and cannot be modified.
+
+### req.session.cookie
+
+Each session has a unique cookie object accompany it. This allows
+you to alter the session cookie per visitor. For example we can
+set `req.session.cookie.expires` to `false` to enable the cookie
+to remain for only the duration of the user-agent.
+
+#### Cookie.maxAge
+
+Alternatively `req.session.cookie.maxAge` will return the time
+remaining in milliseconds, which we may also re-assign a new value
+to adjust the `.expires` property appropriately. The following
+are essentially equivalent
+
+```js
+var hour = 3600000
+req.session.cookie.expires = new Date(Date.now() + hour)
+req.session.cookie.maxAge = hour
+```
+
+For example when `maxAge` is set to `60000` (one minute), and 30 seconds
+has elapsed it will return `30000` until the current request has completed,
+at which time `req.session.touch()` is called to reset `req.session.maxAge`
+to its original value.
+
+```js
+req.session.cookie.maxAge // => 30000
+```
+
+### req.sessionID
+
+To get the ID of the loaded session, access the request property
+`req.sessionID`. This is simply a read-only value set when a session
+is loaded/created.
+
+## Session Store Implementation
+
+Every session store _must_ be an `EventEmitter` and implement specific
+methods. The following methods are the list of **required**, **recommended**,
+and **optional**.
+
+ * Required methods are ones that this module will always call on the store.
+ * Recommended methods are ones that this module will call on the store if
+ available.
+ * Optional methods are ones this module does not call at all, but helps
+ present uniform stores to users.
+
+For an example implementation view the [connect-redis](http://github.com/visionmedia/connect-redis) repo.
+
+### store.all(callback)
+
+**Optional**
+
+This optional method is used to get all sessions in the store as an array. The
+`callback` should be called as `callback(error, sessions)`.
+
+### store.destroy(sid, callback)
+
+**Required**
+
+This required method is used to destroy/delete a session from the store given
+a session ID (`sid`). The `callback` should be called as `callback(error)` once
+the session is destroyed.
+
+### store.clear(callback)
+
+**Optional**
+
+This optional method is used to delete all sessions from the store. The
+`callback` should be called as `callback(error)` once the store is cleared.
+
+### store.length(callback)
+
+**Optional**
+
+This optional method is used to get the count of all sessions in the store.
+The `callback` should be called as `callback(error, len)`.
+
+### store.get(sid, callback)
+
+**Required**
+
+This required method is used to get a session from the store given a session
+ID (`sid`). The `callback` should be called as `callback(error, session)`.
+
+The `session` argument should be a session if found, otherwise `null` or
+`undefined` if the session was not found (and there was no error). A special
+case is made when `error.code === 'ENOENT'` to act like `callback(null, null)`.
+
+### store.set(sid, session, callback)
+
+**Required**
+
+This required method is used to upsert a session into the store given a
+session ID (`sid`) and session (`session`) object. The callback should be
+called as `callback(error)` once the session has been set in the store.
+
+### store.touch(sid, session, callback)
+
+**Recommended**
+
+This recommended method is used to "touch" a given session given a
+session ID (`sid`) and session (`session`) object. The `callback` should be
+called as `callback(error)` once the session has been touched.
+
+This is primarily used when the store will automatically delete idle sessions
+and this method is used to signal to the store the given session is active,
+potentially resetting the idle timer.
+
+## Compatible Session Stores
+
+The following modules implement a session store that is compatible with this
+module. Please make a PR to add additional modules :)
+
+[![★][cassandra-store-image] cassandra-store][cassandra-store-url] An Apache Cassandra-based session store.
+
+[cassandra-store-url]: https://www.npmjs.com/package/cassandra-store
+[cassandra-store-image]: https://img.shields.io/github/stars/webcc/cassandra-store.svg?label=%E2%98%85
+
+[![★][cluster-store-image] cluster-store][cluster-store-url] A wrapper for using in-process / embedded
+stores - such as SQLite (via knex), leveldb, files, or memory - with node cluster (desirable for Raspberry Pi 2
+and other multi-core embedded devices).
+
+[cluster-store-url]: https://www.npmjs.com/package/cluster-store
+[cluster-store-image]: https://img.shields.io/github/stars/coolaj86/cluster-store.svg?label=%E2%98%85
+
+[![★][connect-azuretables-image] connect-azuretables][connect-azuretables-url] An [Azure Table Storage](https://azure.microsoft.com/en-gb/services/storage/tables/)-based session store.
+
+[connect-azuretables-url]: https://www.npmjs.com/package/connect-azuretables
+[connect-azuretables-image]: https://img.shields.io/github/stars/mike-goodwin/connect-azuretables.svg?label=%E2%98%85
+
+[![★][connect-couchbase-image] connect-couchbase][connect-couchbase-url] A [couchbase](http://www.couchbase.com/)-based session store.
+
+[connect-couchbase-url]: https://www.npmjs.com/package/connect-couchbase
+[connect-couchbase-image]: https://img.shields.io/github/stars/christophermina/connect-couchbase.svg?label=%E2%98%85
+
+[![★][connect-dynamodb-image] connect-dynamodb][connect-dynamodb-url] A DynamoDB-based session store.
+
+[connect-dynamodb-url]: https://github.com/ca98am79/connect-dynamodb
+[connect-dynamodb-image]: https://img.shields.io/github/stars/ca98am79/connect-dynamodb.svg?label=%E2%98%85
+
+[![★][connect-mssql-image] connect-mssql][connect-mssql-url] A SQL Server-based session store.
+
+[connect-mssql-url]: https://www.npmjs.com/package/connect-mssql
+[connect-mssql-image]: https://img.shields.io/github/stars/patriksimek/connect-mssql.svg?label=%E2%98%85
+
+[![★][connect-monetdb-image] connect-monetdb][connect-monetdb-url] A MonetDB-based session store.
+
+[connect-monetdb-url]: https://www.npmjs.com/package/connect-monetdb
+[connect-monetdb-image]: https://img.shields.io/github/stars/MonetDB/npm-connect-monetdb.svg?label=%E2%98%85
+
+[![★][connect-mongo-image] connect-mongo][connect-mongo-url] A MongoDB-based session store.
+
+[connect-mongo-url]: https://www.npmjs.com/package/connect-mongo
+[connect-mongo-image]: https://img.shields.io/github/stars/kcbanner/connect-mongo.svg?label=%E2%98%85
+
+[![★][connect-mongodb-session-image] connect-mongodb-session][connect-mongodb-session-url] Lightweight MongoDB-based session store built and maintained by MongoDB.
+
+[connect-mongodb-session-url]: https://www.npmjs.com/package/connect-mongodb-session
+[connect-mongodb-session-image]: https://img.shields.io/github/stars/mongodb-js/connect-mongodb-session.svg?label=%E2%98%85
+
+[![★][connect-pg-simple-image] connect-pg-simple][connect-pg-simple-url] A PostgreSQL-based session store.
+
+[connect-pg-simple-url]: https://www.npmjs.com/package/connect-pg-simple
+[connect-pg-simple-image]: https://img.shields.io/github/stars/voxpelli/node-connect-pg-simple.svg?label=%E2%98%85
+
+[![★][connect-redis-image] connect-redis][connect-redis-url] A Redis-based session store.
+
+[connect-redis-url]: https://www.npmjs.com/package/connect-redis
+[connect-redis-image]: https://img.shields.io/github/stars/tj/connect-redis.svg?label=%E2%98%85
+
+[![★][connect-memcached-image] connect-memcached][connect-memcached-url] A memcached-based session store.
+
+[connect-memcached-url]: https://www.npmjs.com/package/connect-memcached
+[connect-memcached-image]: https://img.shields.io/github/stars/balor/connect-memcached.svg?label=%E2%98%85
+
+[![★][connect-session-knex-image] connect-session-knex][connect-session-knex-url] A session store using
+[Knex.js](http://knexjs.org/), which is a SQL query builder for PostgreSQL, MySQL, MariaDB, SQLite3, and Oracle.
+
+[connect-session-knex-url]: https://www.npmjs.com/package/connect-session-knex
+[connect-session-knex-image]: https://img.shields.io/github/stars/llambda/connect-session-knex.svg?label=%E2%98%85
+
+[![★][connect-session-sequelize-image] connect-session-sequelize][connect-session-sequelize-url] A session store using
+[Sequelize.js](http://sequelizejs.com/), which is a Node.js / io.js ORM for PostgreSQL, MySQL, SQLite and MSSQL.
+
+[connect-session-sequelize-url]: https://www.npmjs.com/package/connect-session-sequelize
+[connect-session-sequelize-image]: https://img.shields.io/github/stars/mweibel/connect-session-sequelize.svg?label=%E2%98%85
+
+[![★][express-mysql-session-image] express-mysql-session][express-mysql-session-url] A session store using native
+[MySQL](https://www.mysql.com/) via the [node-mysql](https://github.com/felixge/node-mysql) module.
+
+[express-mysql-session-url]: https://www.npmjs.com/package/express-mysql-session
+[express-mysql-session-image]: https://img.shields.io/github/stars/chill117/express-mysql-session.svg?label=%E2%98%85
+
+[![★][connect-sqlite3-image] connect-sqlite3][connect-sqlite3-url] A [SQLite3](https://github.com/mapbox/node-sqlite3) session store modeled after the TJ's `connect-redis` store.
+
+[connect-sqlite3-url]: https://www.npmjs.com/package/connect-sqlite3
+[connect-sqlite3-image]: https://img.shields.io/github/stars/rawberg/connect-sqlite3.svg?label=%E2%98%85
+
+[![★][express-nedb-session-image] express-nedb-session][express-nedb-session-url] A NeDB-based session store.
+
+[express-nedb-session-url]: https://www.npmjs.com/package/express-nedb-session
+[express-nedb-session-image]: https://img.shields.io/github/stars/louischatriot/express-nedb-session.svg?label=%E2%98%85
+
+[![★][level-session-store-image] level-session-store][level-session-store-url] A LevelDB-based session store.
+
+[level-session-store-url]: https://www.npmjs.com/package/level-session-store
+[level-session-store-image]: https://img.shields.io/github/stars/scriptollc/level-session-store.svg?label=%E2%98%85
+
+[![★][mssql-session-store-image] mssql-session-store][mssql-session-store-url] A SQL Server-based session store.
+
+[mssql-session-store-url]: https://www.npmjs.com/package/mssql-session-store
+[mssql-session-store-image]: https://img.shields.io/github/stars/jwathen/mssql-session-store.svg?label=%E2%98%85
+
+[![★][nedb-session-store-image] nedb-session-store][nedb-session-store-url] An alternate NeDB-based (either in-memory or file-persisted) session store.
+
+[nedb-session-store-url]: https://www.npmjs.com/package/nedb-session-store
+[nedb-session-store-image]: https://img.shields.io/github/stars/JamesMGreene/nedb-session-store.svg?label=%E2%98%85
+
+[![★][sequelstore-connect-image] sequelstore-connect][sequelstore-connect-url] A session store using [Sequelize.js](http://sequelizejs.com/).
+
+[sequelstore-connect-url]: https://www.npmjs.com/package/sequelstore-connect
+[sequelstore-connect-image]: https://img.shields.io/github/stars/MattMcFarland/sequelstore-connect.svg?label=%E2%98%85
+
+[![★][session-file-store-image] session-file-store][session-file-store-url] A file system-based session store.
+
+[session-file-store-url]: https://www.npmjs.com/package/session-file-store
+[session-file-store-image]: https://img.shields.io/github/stars/valery-barysok/session-file-store.svg?label=%E2%98%85
+
+[![★][session-rethinkdb-image] session-rethinkdb][session-rethinkdb-url] A [RethinkDB](http://rethinkdb.com/)-based session store.
+
+[session-rethinkdb-url]: https://www.npmjs.com/package/session-rethinkdb
+[session-rethinkdb-image]: https://img.shields.io/github/stars/llambda/session-rethinkdb.svg?label=%E2%98%85
+
+## Example
+
+A simple example using `express-session` to store page views for a user.
+
+```js
+var express = require('express')
+var parseurl = require('parseurl')
+var session = require('express-session')
+
+var app = express()
+
+app.use(session({
+ secret: 'keyboard cat',
+ resave: false,
+ saveUninitialized: true
+}))
+
+app.use(function (req, res, next) {
+ var views = req.session.views
+
+ if (!views) {
+ views = req.session.views = {}
+ }
+
+ // get the url pathname
+ var pathname = parseurl(req).pathname
+
+ // count the views
+ views[pathname] = (views[pathname] || 0) + 1
+
+ next()
+})
+
+app.get('/foo', function (req, res, next) {
+ res.send('you viewed this page ' + req.session.views['/foo'] + ' times')
+})
+
+app.get('/bar', function (req, res, next) {
+ res.send('you viewed this page ' + req.session.views['/bar'] + ' times')
+})
+```
+
+## License
+
+[MIT](LICENSE)
+
+[npm-image]: https://img.shields.io/npm/v/express-session.svg
+[npm-url]: https://npmjs.org/package/express-session
+[travis-image]: https://img.shields.io/travis/expressjs/session/master.svg
+[travis-url]: https://travis-ci.org/expressjs/session
+[coveralls-image]: https://img.shields.io/coveralls/expressjs/session/master.svg
+[coveralls-url]: https://coveralls.io/r/expressjs/session?branch=master
+[downloads-image]: https://img.shields.io/npm/dm/express-session.svg
+[downloads-url]: https://npmjs.org/package/express-session
+[gratipay-image]: https://img.shields.io/gratipay/dougwilson.svg
+[gratipay-url]: https://gratipay.com/dougwilson/
diff --git a/node_modules/express-session/index.js b/node_modules/express-session/index.js
new file mode 100644
index 0000000..5794118
--- /dev/null
+++ b/node_modules/express-session/index.js
@@ -0,0 +1,637 @@
+/*!
+ * express-session
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * Copyright(c) 2014-2015 Douglas Christopher Wilson
+ * MIT Licensed
+ */
+
+'use strict';
+
+/**
+ * Module dependencies.
+ * @private
+ */
+
+var cookie = require('cookie');
+var crc = require('crc').crc32;
+var debug = require('debug')('express-session');
+var deprecate = require('depd')('express-session');
+var parseUrl = require('parseurl');
+var uid = require('uid-safe').sync
+ , onHeaders = require('on-headers')
+ , signature = require('cookie-signature')
+
+var Session = require('./session/session')
+ , MemoryStore = require('./session/memory')
+ , Cookie = require('./session/cookie')
+ , Store = require('./session/store')
+
+// environment
+
+var env = process.env.NODE_ENV;
+
+/**
+ * Expose the middleware.
+ */
+
+exports = module.exports = session;
+
+/**
+ * Expose constructors.
+ */
+
+exports.Store = Store;
+exports.Cookie = Cookie;
+exports.Session = Session;
+exports.MemoryStore = MemoryStore;
+
+/**
+ * Warning message for `MemoryStore` usage in production.
+ * @private
+ */
+
+var warning = 'Warning: connect.session() MemoryStore is not\n'
+ + 'designed for a production environment, as it will leak\n'
+ + 'memory, and will not scale past a single process.';
+
+/**
+ * Node.js 0.8+ async implementation.
+ * @private
+ */
+
+/* istanbul ignore next */
+var defer = typeof setImmediate === 'function'
+ ? setImmediate
+ : function(fn){ process.nextTick(fn.bind.apply(fn, arguments)) }
+
+/**
+ * Setup session store with the given `options`.
+ *
+ * @param {Object} [options]
+ * @param {Object} [options.cookie] Options for cookie
+ * @param {Function} [options.genid]
+ * @param {String} [options.name=connect.sid] Session ID cookie name
+ * @param {Boolean} [options.proxy]
+ * @param {Boolean} [options.resave] Resave unmodified sessions back to the store
+ * @param {Boolean} [options.rolling] Enable/disable rolling session expiration
+ * @param {Boolean} [options.saveUninitialized] Save uninitialized sessions to the store
+ * @param {String|Array} [options.secret] Secret for signing session ID
+ * @param {Object} [options.store=MemoryStore] Session store
+ * @param {String} [options.unset]
+ * @return {Function} middleware
+ * @public
+ */
+
+function session(options) {
+ var opts = options || {}
+
+ // get the cookie options
+ var cookieOptions = opts.cookie || {}
+
+ // get the session id generate function
+ var generateId = opts.genid || generateSessionId
+
+ // get the session cookie name
+ var name = opts.name || opts.key || 'connect.sid'
+
+ // get the session store
+ var store = opts.store || new MemoryStore()
+
+ // get the trust proxy setting
+ var trustProxy = opts.proxy
+
+ // get the resave session option
+ var resaveSession = opts.resave;
+
+ // get the rolling session option
+ var rollingSessions = Boolean(opts.rolling)
+
+ // get the save uninitialized session option
+ var saveUninitializedSession = opts.saveUninitialized
+
+ // get the cookie signing secret
+ var secret = opts.secret
+
+ if (typeof generateId !== 'function') {
+ throw new TypeError('genid option must be a function');
+ }
+
+ if (resaveSession === undefined) {
+ deprecate('undefined resave option; provide resave option');
+ resaveSession = true;
+ }
+
+ if (saveUninitializedSession === undefined) {
+ deprecate('undefined saveUninitialized option; provide saveUninitialized option');
+ saveUninitializedSession = true;
+ }
+
+ if (opts.unset && opts.unset !== 'destroy' && opts.unset !== 'keep') {
+ throw new TypeError('unset option must be "destroy" or "keep"');
+ }
+
+ // TODO: switch to "destroy" on next major
+ var unsetDestroy = opts.unset === 'destroy'
+
+ if (Array.isArray(secret) && secret.length === 0) {
+ throw new TypeError('secret option array must contain one or more strings');
+ }
+
+ if (secret && !Array.isArray(secret)) {
+ secret = [secret];
+ }
+
+ if (!secret) {
+ deprecate('req.secret; provide secret option');
+ }
+
+ // notify user that this store is not
+ // meant for a production environment
+ if ('production' == env && store instanceof MemoryStore) {
+ /* istanbul ignore next: not tested */
+ console.warn(warning);
+ }
+
+ // generates the new session
+ store.generate = function(req){
+ req.sessionID = generateId(req);
+ req.session = new Session(req);
+ req.session.cookie = new Cookie(cookieOptions);
+
+ if (cookieOptions.secure === 'auto') {
+ req.session.cookie.secure = issecure(req, trustProxy);
+ }
+ };
+
+ var storeImplementsTouch = typeof store.touch === 'function';
+
+ // register event listeners for the store to track readiness
+ var storeReady = true
+ store.on('disconnect', function ondisconnect() {
+ storeReady = false
+ })
+ store.on('connect', function onconnect() {
+ storeReady = true
+ })
+
+ return function session(req, res, next) {
+ // self-awareness
+ if (req.session) {
+ next()
+ return
+ }
+
+ // Handle connection as if there is no session if
+ // the store has temporarily disconnected etc
+ if (!storeReady) {
+ debug('store is disconnected')
+ next()
+ return
+ }
+
+ // pathname mismatch
+ var originalPath = parseUrl.original(req).pathname;
+ if (originalPath.indexOf(cookieOptions.path || '/') !== 0) return next();
+
+ // ensure a secret is available or bail
+ if (!secret && !req.secret) {
+ next(new Error('secret option required for sessions'));
+ return;
+ }
+
+ // backwards compatibility for signed cookies
+ // req.secret is passed from the cookie parser middleware
+ var secrets = secret || [req.secret];
+
+ var originalHash;
+ var originalId;
+ var savedHash;
+
+ // expose store
+ req.sessionStore = store;
+
+ // get the session ID from the cookie
+ var cookieId = req.sessionID = getcookie(req, name, secrets);
+
+ // set-cookie
+ onHeaders(res, function(){
+ if (!req.session) {
+ debug('no session');
+ return;
+ }
+
+ if (!shouldSetCookie(req)) {
+ return;
+ }
+
+ // only send secure cookies via https
+ if (req.session.cookie.secure && !issecure(req, trustProxy)) {
+ debug('not secured');
+ return;
+ }
+
+ // touch session
+ req.session.touch();
+
+ // set cookie
+ setcookie(res, name, req.sessionID, secrets[0], req.session.cookie.data);
+ });
+
+ // proxy end() to commit the session
+ var _end = res.end;
+ var _write = res.write;
+ var ended = false;
+ res.end = function end(chunk, encoding) {
+ if (ended) {
+ return false;
+ }
+
+ ended = true;
+
+ var ret;
+ var sync = true;
+
+ function writeend() {
+ if (sync) {
+ ret = _end.call(res, chunk, encoding);
+ sync = false;
+ return;
+ }
+
+ _end.call(res);
+ }
+
+ function writetop() {
+ if (!sync) {
+ return ret;
+ }
+
+ if (chunk == null) {
+ ret = true;
+ return ret;
+ }
+
+ var contentLength = Number(res.getHeader('Content-Length'));
+
+ if (!isNaN(contentLength) && contentLength > 0) {
+ // measure chunk
+ chunk = !Buffer.isBuffer(chunk)
+ ? new Buffer(chunk, encoding)
+ : chunk;
+ encoding = undefined;
+
+ if (chunk.length !== 0) {
+ debug('split response');
+ ret = _write.call(res, chunk.slice(0, chunk.length - 1));
+ chunk = chunk.slice(chunk.length - 1, chunk.length);
+ return ret;
+ }
+ }
+
+ ret = _write.call(res, chunk, encoding);
+ sync = false;
+
+ return ret;
+ }
+
+ if (shouldDestroy(req)) {
+ // destroy session
+ debug('destroying');
+ store.destroy(req.sessionID, function ondestroy(err) {
+ if (err) {
+ defer(next, err);
+ }
+
+ debug('destroyed');
+ writeend();
+ });
+
+ return writetop();
+ }
+
+ // no session to save
+ if (!req.session) {
+ debug('no session');
+ return _end.call(res, chunk, encoding);
+ }
+
+ if (shouldSave(req)) {
+ req.session.save(function onsave(err) {
+ if (err) {
+ defer(next, err);
+ }
+
+ writeend();
+ });
+
+ return writetop();
+ } else if (storeImplementsTouch && shouldTouch(req)) {
+ // store implements touch method
+ debug('touching');
+ store.touch(req.sessionID, req.session, function ontouch(err) {
+ if (err) {
+ defer(next, err);
+ }
+
+ debug('touched');
+ writeend();
+ });
+
+ return writetop();
+ }
+
+ return _end.call(res, chunk, encoding);
+ };
+
+ // generate the session
+ function generate() {
+ store.generate(req);
+ originalId = req.sessionID;
+ originalHash = hash(req.session);
+ wrapmethods(req.session);
+ }
+
+ // wrap session methods
+ function wrapmethods(sess) {
+ var _save = sess.save;
+
+ function save() {
+ debug('saving %s', this.id);
+ savedHash = hash(this);
+ _save.apply(this, arguments);
+ }
+
+ Object.defineProperty(sess, 'save', {
+ configurable: true,
+ enumerable: false,
+ value: save,
+ writable: true
+ });
+ }
+
+ // check if session has been modified
+ function isModified(sess) {
+ return originalId !== sess.id || originalHash !== hash(sess);
+ }
+
+ // check if session has been saved
+ function isSaved(sess) {
+ return originalId === sess.id && savedHash === hash(sess);
+ }
+
+ // determine if session should be destroyed
+ function shouldDestroy(req) {
+ return req.sessionID && unsetDestroy && req.session == null;
+ }
+
+ // determine if session should be saved to store
+ function shouldSave(req) {
+ // cannot set cookie without a session ID
+ if (typeof req.sessionID !== 'string') {
+ debug('session ignored because of bogus req.sessionID %o', req.sessionID);
+ return false;
+ }
+
+ return !saveUninitializedSession && cookieId !== req.sessionID
+ ? isModified(req.session)
+ : !isSaved(req.session)
+ }
+
+ // determine if session should be touched
+ function shouldTouch(req) {
+ // cannot set cookie without a session ID
+ if (typeof req.sessionID !== 'string') {
+ debug('session ignored because of bogus req.sessionID %o', req.sessionID);
+ return false;
+ }
+
+ return cookieId === req.sessionID && !shouldSave(req);
+ }
+
+ // determine if cookie should be set on response
+ function shouldSetCookie(req) {
+ // cannot set cookie without a session ID
+ if (typeof req.sessionID !== 'string') {
+ return false;
+ }
+
+ return cookieId != req.sessionID
+ ? saveUninitializedSession || isModified(req.session)
+ : rollingSessions || req.session.cookie.expires != null && isModified(req.session);
+ }
+
+ // generate a session if the browser doesn't send a sessionID
+ if (!req.sessionID) {
+ debug('no SID sent, generating session');
+ generate();
+ next();
+ return;
+ }
+
+ // generate the session object
+ debug('fetching %s', req.sessionID);
+ store.get(req.sessionID, function(err, sess){
+ // error handling
+ if (err) {
+ debug('error %j', err);
+
+ if (err.code !== 'ENOENT') {
+ next(err);
+ return;
+ }
+
+ generate();
+ // no session
+ } else if (!sess) {
+ debug('no session found');
+ generate();
+ // populate req.session
+ } else {
+ debug('session found');
+ store.createSession(req, sess);
+ originalId = req.sessionID;
+ originalHash = hash(sess);
+
+ if (!resaveSession) {
+ savedHash = originalHash
+ }
+
+ wrapmethods(req.session);
+ }
+
+ next();
+ });
+ };
+};
+
+/**
+ * Generate a session ID for a new session.
+ *
+ * @return {String}
+ * @private
+ */
+
+function generateSessionId(sess) {
+ return uid(24);
+}
+
+/**
+ * Get the session ID cookie from request.
+ *
+ * @return {string}
+ * @private
+ */
+
+function getcookie(req, name, secrets) {
+ var header = req.headers.cookie;
+ var raw;
+ var val;
+
+ // read from cookie header
+ if (header) {
+ var cookies = cookie.parse(header);
+
+ raw = cookies[name];
+
+ if (raw) {
+ if (raw.substr(0, 2) === 's:') {
+ val = unsigncookie(raw.slice(2), secrets);
+
+ if (val === false) {
+ debug('cookie signature invalid');
+ val = undefined;
+ }
+ } else {
+ debug('cookie unsigned')
+ }
+ }
+ }
+
+ // back-compat read from cookieParser() signedCookies data
+ if (!val && req.signedCookies) {
+ val = req.signedCookies[name];
+
+ if (val) {
+ deprecate('cookie should be available in req.headers.cookie');
+ }
+ }
+
+ // back-compat read from cookieParser() cookies data
+ if (!val && req.cookies) {
+ raw = req.cookies[name];
+
+ if (raw) {
+ if (raw.substr(0, 2) === 's:') {
+ val = unsigncookie(raw.slice(2), secrets);
+
+ if (val) {
+ deprecate('cookie should be available in req.headers.cookie');
+ }
+
+ if (val === false) {
+ debug('cookie signature invalid');
+ val = undefined;
+ }
+ } else {
+ debug('cookie unsigned')
+ }
+ }
+ }
+
+ return val;
+}
+
+/**
+ * Hash the given `sess` object omitting changes to `.cookie`.
+ *
+ * @param {Object} sess
+ * @return {String}
+ * @private
+ */
+
+function hash(sess) {
+ return crc(JSON.stringify(sess, function (key, val) {
+ if (key !== 'cookie') {
+ return val;
+ }
+ }));
+}
+
+/**
+ * Determine if request is secure.
+ *
+ * @param {Object} req
+ * @param {Boolean} [trustProxy]
+ * @return {Boolean}
+ * @private
+ */
+
+function issecure(req, trustProxy) {
+ // socket is https server
+ if (req.connection && req.connection.encrypted) {
+ return true;
+ }
+
+ // do not trust proxy
+ if (trustProxy === false) {
+ return false;
+ }
+
+ // no explicit trust; try req.secure from express
+ if (trustProxy !== true) {
+ var secure = req.secure;
+ return typeof secure === 'boolean'
+ ? secure
+ : false;
+ }
+
+ // read the proto from x-forwarded-proto header
+ var header = req.headers['x-forwarded-proto'] || '';
+ var index = header.indexOf(',');
+ var proto = index !== -1
+ ? header.substr(0, index).toLowerCase().trim()
+ : header.toLowerCase().trim()
+
+ return proto === 'https';
+}
+
+/**
+ * Set cookie on response.
+ *
+ * @private
+ */
+
+function setcookie(res, name, val, secret, options) {
+ var signed = 's:' + signature.sign(val, secret);
+ var data = cookie.serialize(name, signed, options);
+
+ debug('set-cookie %s', data);
+
+ var prev = res.getHeader('set-cookie') || [];
+ var header = Array.isArray(prev) ? prev.concat(data)
+ : Array.isArray(data) ? [prev].concat(data)
+ : [prev, data];
+
+ res.setHeader('set-cookie', header)
+}
+
+/**
+ * Verify and decode the given `val` with `secrets`.
+ *
+ * @param {String} val
+ * @param {Array} secrets
+ * @returns {String|Boolean}
+ * @private
+ */
+function unsigncookie(val, secrets) {
+ for (var i = 0; i < secrets.length; i++) {
+ var result = signature.unsign(val, secrets[i]);
+
+ if (result !== false) {
+ return result;
+ }
+ }
+
+ return false;
+}
diff --git a/node_modules/express-session/package.json b/node_modules/express-session/package.json
new file mode 100644
index 0000000..f35ec2e
--- /dev/null
+++ b/node_modules/express-session/package.json
@@ -0,0 +1,121 @@
+{
+ "_args": [
+ [
+ "express-session",
+ "/home/humair/School/csc309/a4/solutions_repo"
+ ]
+ ],
+ "_from": "express-session@latest",
+ "_id": "express-session@1.14.0",
+ "_inCache": true,
+ "_installable": true,
+ "_location": "/express-session",
+ "_npmOperationalInternal": {
+ "host": "packages-12-west.internal.npmjs.com",
+ "tmp": "tmp/express-session-1.14.0.tgz_1467429048169_0.3337707840837538"
+ },
+ "_npmUser": {
+ "email": "doug@somethingdoug.com",
+ "name": "dougwilson"
+ },
+ "_npmVersion": "1.4.28",
+ "_phantomChildren": {},
+ "_requested": {
+ "name": "express-session",
+ "raw": "express-session",
+ "rawSpec": "",
+ "scope": null,
+ "spec": "latest",
+ "type": "tag"
+ },
+ "_requiredBy": [
+ "/"
+ ],
+ "_resolved": "https://registry.npmjs.org/express-session/-/express-session-1.14.0.tgz",
+ "_shasum": "f5eeed3f38bfa0c6af27a0aeb8c9ec67dc07e39e",
+ "_shrinkwrap": null,
+ "_spec": "express-session",
+ "_where": "/home/humair/School/csc309/a4/solutions_repo",
+ "author": {
+ "email": "tj@vision-media.ca",
+ "name": "TJ Holowaychuk",
+ "url": "http://tjholowaychuk.com"
+ },
+ "bugs": {
+ "url": "https://github.com/expressjs/session/issues"
+ },
+ "contributors": [
+ {
+ "name": "Douglas Christopher Wilson",
+ "email": "doug@somethingdoug.com"
+ },
+ {
+ "name": "Joe Wagner",
+ "email": "njwjs722@gmail.com"
+ }
+ ],
+ "dependencies": {
+ "cookie": "0.3.1",
+ "cookie-signature": "1.0.6",
+ "crc": "3.4.0",
+ "debug": "~2.2.0",
+ "depd": "~1.1.0",
+ "on-headers": "~1.0.1",
+ "parseurl": "~1.3.1",
+ "uid-safe": "~2.1.1",
+ "utils-merge": "1.0.0"
+ },
+ "description": "Simple session middleware for Express",
+ "devDependencies": {
+ "after": "0.8.1",
+ "cookie-parser": "1.4.3",
+ "express": "4.14.0",
+ "istanbul": "0.4.4",
+ "mocha": "2.5.3",
+ "supertest": "1.1.0"
+ },
+ "directories": {},
+ "dist": {
+ "shasum": "f5eeed3f38bfa0c6af27a0aeb8c9ec67dc07e39e",
+ "tarball": "https://registry.npmjs.org/express-session/-/express-session-1.14.0.tgz"
+ },
+ "engines": {
+ "node": ">= 0.8.0"
+ },
+ "files": [
+ "HISTORY.md",
+ "LICENSE",
+ "index.js",
+ "session/"
+ ],
+ "gitHead": "9fd23195578eac5962d52f46781a75a297fbe685",
+ "homepage": "https://github.com/expressjs/session",
+ "license": "MIT",
+ "maintainers": [
+ {
+ "name": "defunctzombie",
+ "email": "shtylman@gmail.com"
+ },
+ {
+ "name": "dougwilson",
+ "email": "doug@somethingdoug.com"
+ },
+ {
+ "name": "mscdex",
+ "email": "mscdex@mscdex.net"
+ }
+ ],
+ "name": "express-session",
+ "optionalDependencies": {},
+ "readme": "ERROR: No README data found!",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/expressjs/session.git"
+ },
+ "scripts": {
+ "test": "mocha --bail --reporter spec test/",
+ "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot test/",
+ "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec test/"
+ },
+ "version": "1.14.0"
+}
diff --git a/node_modules/express-session/session/cookie.js b/node_modules/express-session/session/cookie.js
new file mode 100644
index 0000000..a4dbd8a
--- /dev/null
+++ b/node_modules/express-session/session/cookie.js
@@ -0,0 +1,129 @@
+/*!
+ * Connect - session - Cookie
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+'use strict';
+
+/**
+ * Module dependencies.
+ */
+
+var merge = require('utils-merge')
+ , cookie = require('cookie');
+
+/**
+ * Initialize a new `Cookie` with the given `options`.
+ *
+ * @param {IncomingMessage} req
+ * @param {Object} options
+ * @api private
+ */
+
+var Cookie = module.exports = function Cookie(options) {
+ this.path = '/';
+ this.maxAge = null;
+ this.httpOnly = true;
+ if (options) merge(this, options);
+ this.originalMaxAge = undefined == this.originalMaxAge
+ ? this.maxAge
+ : this.originalMaxAge;
+};
+
+/*!
+ * Prototype.
+ */
+
+Cookie.prototype = {
+
+ /**
+ * Set expires `date`.
+ *
+ * @param {Date} date
+ * @api public
+ */
+
+ set expires(date) {
+ this._expires = date;
+ this.originalMaxAge = this.maxAge;
+ },
+
+ /**
+ * Get expires `date`.
+ *
+ * @return {Date}
+ * @api public
+ */
+
+ get expires() {
+ return this._expires;
+ },
+
+ /**
+ * Set expires via max-age in `ms`.
+ *
+ * @param {Number} ms
+ * @api public
+ */
+
+ set maxAge(ms) {
+ this.expires = 'number' == typeof ms
+ ? new Date(Date.now() + ms)
+ : ms;
+ },
+
+ /**
+ * Get expires max-age in `ms`.
+ *
+ * @return {Number}
+ * @api public
+ */
+
+ get maxAge() {
+ return this.expires instanceof Date
+ ? this.expires.valueOf() - Date.now()
+ : this.expires;
+ },
+
+ /**
+ * Return cookie data object.
+ *
+ * @return {Object}
+ * @api private
+ */
+
+ get data() {
+ return {
+ originalMaxAge: this.originalMaxAge
+ , expires: this._expires
+ , secure: this.secure
+ , httpOnly: this.httpOnly
+ , domain: this.domain
+ , path: this.path
+ }
+ },
+
+ /**
+ * Return a serialized cookie string.
+ *
+ * @return {String}
+ * @api public
+ */
+
+ serialize: function(name, val){
+ return cookie.serialize(name, val, this.data);
+ },
+
+ /**
+ * Return JSON representation of this cookie.
+ *
+ * @return {Object}
+ * @api private
+ */
+
+ toJSON: function(){
+ return this.data;
+ }
+};
diff --git a/node_modules/express-session/session/memory.js b/node_modules/express-session/session/memory.js
new file mode 100644
index 0000000..25252b6
--- /dev/null
+++ b/node_modules/express-session/session/memory.js
@@ -0,0 +1,185 @@
+/*!
+ * express-session
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * Copyright(c) 2015 Douglas Christopher Wilson
+ * MIT Licensed
+ */
+
+'use strict';
+
+/**
+ * Module dependencies.
+ * @private
+ */
+
+var Store = require('./store')
+var util = require('util')
+
+/**
+ * Shim setImmediate for node.js < 0.10
+ * @private
+ */
+
+/* istanbul ignore next */
+var defer = typeof setImmediate === 'function'
+ ? setImmediate
+ : function(fn){ process.nextTick(fn.bind.apply(fn, arguments)) }
+
+/**
+ * Module exports.
+ */
+
+module.exports = MemoryStore
+
+/**
+ * A session store in memory.
+ * @public
+ */
+
+function MemoryStore() {
+ Store.call(this)
+ this.sessions = Object.create(null)
+}
+
+/**
+ * Inherit from Store.
+ */
+
+util.inherits(MemoryStore, Store)
+
+/**
+ * Get all active sessions.
+ *
+ * @param {function} callback
+ * @public
+ */
+
+MemoryStore.prototype.all = function all(callback) {
+ var sessionIds = Object.keys(this.sessions)
+ var sessions = Object.create(null)
+
+ for (var i = 0; i < sessionIds.length; i++) {
+ var sessionId = sessionIds[i]
+ var session = getSession.call(this, sessionId)
+
+ if (session) {
+ sessions[sessionId] = session;
+ }
+ }
+
+ callback && defer(callback, null, sessions)
+}
+
+/**
+ * Clear all sessions.
+ *
+ * @param {function} callback
+ * @public
+ */
+
+MemoryStore.prototype.clear = function clear(callback) {
+ this.sessions = Object.create(null)
+ callback && defer(callback)
+}
+
+/**
+ * Destroy the session associated with the given session ID.
+ *
+ * @param {string} sessionId
+ * @public
+ */
+
+MemoryStore.prototype.destroy = function destroy(sessionId, callback) {
+ delete this.sessions[sessionId]
+ callback && defer(callback)
+}
+
+/**
+ * Fetch session by the given session ID.
+ *
+ * @param {string} sessionId
+ * @param {function} callback
+ * @public
+ */
+
+MemoryStore.prototype.get = function get(sessionId, callback) {
+ defer(callback, null, getSession.call(this, sessionId))
+}
+
+/**
+ * Commit the given session associated with the given sessionId to the store.
+ *
+ * @param {string} sessionId
+ * @param {object} session
+ * @param {function} callback
+ * @public
+ */
+
+MemoryStore.prototype.set = function set(sessionId, session, callback) {
+ this.sessions[sessionId] = JSON.stringify(session)
+ callback && defer(callback)
+}
+
+/**
+ * Get number of active sessions.
+ *
+ * @param {function} callback
+ * @public
+ */
+
+MemoryStore.prototype.length = function length(callback) {
+ this.all(function (err, sessions) {
+ if (err) return callback(err)
+ callback(null, Object.keys(sessions).length)
+ })
+}
+
+/**
+ * Touch the given session object associated with the given session ID.
+ *
+ * @param {string} sessionId
+ * @param {object} session
+ * @param {function} callback
+ * @public
+ */
+
+MemoryStore.prototype.touch = function touch(sessionId, session, callback) {
+ var currentSession = getSession.call(this, sessionId)
+
+ if (currentSession) {
+ // update expiration
+ currentSession.cookie = session.cookie
+ this.sessions[sessionId] = JSON.stringify(currentSession)
+ }
+
+ callback && defer(callback)
+}
+
+/**
+ * Get session from the store.
+ * @private
+ */
+
+function getSession(sessionId) {
+ var sess = this.sessions[sessionId]
+
+ if (!sess) {
+ return
+ }
+
+ // parse
+ sess = JSON.parse(sess)
+
+ var expires = typeof sess.cookie.expires === 'string'
+ ? new Date(sess.cookie.expires)
+ : sess.cookie.expires
+
+ // destroy expired session
+ if (expires && expires <= Date.now()) {
+ delete this.sessions[sessionId]
+ return
+ }
+
+ return sess
+}
diff --git a/node_modules/express-session/session/session.js b/node_modules/express-session/session/session.js
new file mode 100644
index 0000000..2eacde6
--- /dev/null
+++ b/node_modules/express-session/session/session.js
@@ -0,0 +1,142 @@
+/*!
+ * Connect - session - Session
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+'use strict';
+
+/**
+ * Expose Session.
+ */
+
+module.exports = Session;
+
+/**
+ * Create a new `Session` with the given request and `data`.
+ *
+ * @param {IncomingRequest} req
+ * @param {Object} data
+ * @api private
+ */
+
+function Session(req, data) {
+ Object.defineProperty(this, 'req', { value: req });
+ Object.defineProperty(this, 'id', { value: req.sessionID });
+
+ if (typeof data === 'object' && data !== null) {
+ // merge data into this, ignoring prototype properties
+ for (var prop in data) {
+ if (!(prop in this)) {
+ this[prop] = data[prop]
+ }
+ }
+ }
+}
+
+/**
+ * Update reset `.cookie.maxAge` to prevent
+ * the cookie from expiring when the
+ * session is still active.
+ *
+ * @return {Session} for chaining
+ * @api public
+ */
+
+defineMethod(Session.prototype, 'touch', function touch() {
+ return this.resetMaxAge();
+});
+
+/**
+ * Reset `.maxAge` to `.originalMaxAge`.
+ *
+ * @return {Session} for chaining
+ * @api public
+ */
+
+defineMethod(Session.prototype, 'resetMaxAge', function resetMaxAge() {
+ this.cookie.maxAge = this.cookie.originalMaxAge;
+ return this;
+});
+
+/**
+ * Save the session data with optional callback `fn(err)`.
+ *
+ * @param {Function} fn
+ * @return {Session} for chaining
+ * @api public
+ */
+
+defineMethod(Session.prototype, 'save', function save(fn) {
+ this.req.sessionStore.set(this.id, this, fn || function(){});
+ return this;
+});
+
+/**
+ * Re-loads the session data _without_ altering
+ * the maxAge properties. Invokes the callback `fn(err)`,
+ * after which time if no exception has occurred the
+ * `req.session` property will be a new `Session` object,
+ * although representing the same session.
+ *
+ * @param {Function} fn
+ * @return {Session} for chaining
+ * @api public
+ */
+
+defineMethod(Session.prototype, 'reload', function reload(fn) {
+ var req = this.req
+ , store = this.req.sessionStore;
+ store.get(this.id, function(err, sess){
+ if (err) return fn(err);
+ if (!sess) return fn(new Error('failed to load session'));
+ store.createSession(req, sess);
+ fn();
+ });
+ return this;
+});
+
+/**
+ * Destroy `this` session.
+ *
+ * @param {Function} fn
+ * @return {Session} for chaining
+ * @api public
+ */
+
+defineMethod(Session.prototype, 'destroy', function destroy(fn) {
+ delete this.req.session;
+ this.req.sessionStore.destroy(this.id, fn);
+ return this;
+});
+
+/**
+ * Regenerate this request's session.
+ *
+ * @param {Function} fn
+ * @return {Session} for chaining
+ * @api public
+ */
+
+defineMethod(Session.prototype, 'regenerate', function regenerate(fn) {
+ this.req.sessionStore.regenerate(this.req, fn);
+ return this;
+});
+
+/**
+ * Helper function for creating a method on a prototype.
+ *
+ * @param {Object} obj
+ * @param {String} name
+ * @param {Function} fn
+ * @private
+ */
+function defineMethod(obj, name, fn) {
+ Object.defineProperty(obj, name, {
+ configurable: true,
+ enumerable: false,
+ value: fn,
+ writable: true
+ });
+};
diff --git a/node_modules/express-session/session/store.js b/node_modules/express-session/session/store.js
new file mode 100644
index 0000000..387469c
--- /dev/null
+++ b/node_modules/express-session/session/store.js
@@ -0,0 +1,94 @@
+/*!
+ * Connect - session - Store
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+'use strict';
+
+/**
+ * Module dependencies.
+ * @private
+ */
+
+var Cookie = require('./cookie')
+var EventEmitter = require('events').EventEmitter
+var Session = require('./session')
+var util = require('util')
+
+/**
+ * Module exports.
+ * @public
+ */
+
+module.exports = Store
+
+/**
+ * Abstract base class for session stores.
+ * @public
+ */
+
+function Store () {
+ EventEmitter.call(this)
+}
+
+/**
+ * Inherit from EventEmitter.
+ */
+
+util.inherits(Store, EventEmitter)
+
+/**
+ * Re-generate the given requests's session.
+ *
+ * @param {IncomingRequest} req
+ * @return {Function} fn
+ * @api public
+ */
+
+Store.prototype.regenerate = function(req, fn){
+ var self = this;
+ this.destroy(req.sessionID, function(err){
+ self.generate(req);
+ fn(err);
+ });
+};
+
+/**
+ * Load a `Session` instance via the given `sid`
+ * and invoke the callback `fn(err, sess)`.
+ *
+ * @param {String} sid
+ * @param {Function} fn
+ * @api public
+ */
+
+Store.prototype.load = function(sid, fn){
+ var self = this;
+ this.get(sid, function(err, sess){
+ if (err) return fn(err);
+ if (!sess) return fn();
+ var req = { sessionID: sid, sessionStore: self };
+ fn(null, self.createSession(req, sess))
+ });
+};
+
+/**
+ * Create session from JSON `sess` data.
+ *
+ * @param {IncomingRequest} req
+ * @param {Object} sess
+ * @return {Session}
+ * @api private
+ */
+
+Store.prototype.createSession = function(req, sess){
+ var expires = sess.cookie.expires
+ , orig = sess.cookie.originalMaxAge;
+ sess.cookie = new Cookie(sess.cookie);
+ if ('string' == typeof expires) sess.cookie.expires = new Date(expires);
+ sess.cookie.originalMaxAge = orig;
+ req.session = new Session(req, sess);
+ return req.session;
+};
diff --git a/node_modules/on-headers/HISTORY.md b/node_modules/on-headers/HISTORY.md
new file mode 100644
index 0000000..e51ff01
--- /dev/null
+++ b/node_modules/on-headers/HISTORY.md
@@ -0,0 +1,16 @@
+1.0.1 / 2015-09-29
+==================
+
+ * perf: enable strict mode
+
+1.0.0 / 2014-08-10
+==================
+
+ * Honor `res.statusCode` change in `listener`
+ * Move to `jshttp` orgainzation
+ * Prevent `arguments`-related de-opt
+
+0.0.0 / 2014-05-13
+==================
+
+ * Initial implementation
diff --git a/node_modules/on-headers/LICENSE b/node_modules/on-headers/LICENSE
new file mode 100644
index 0000000..b7dce6c
--- /dev/null
+++ b/node_modules/on-headers/LICENSE
@@ -0,0 +1,22 @@
+(The MIT License)
+
+Copyright (c) 2014 Douglas Christopher Wilson
+
+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/on-headers/README.md b/node_modules/on-headers/README.md
new file mode 100644
index 0000000..48ed9ae
--- /dev/null
+++ b/node_modules/on-headers/README.md
@@ -0,0 +1,76 @@
+# on-headers
+
+[![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]
+
+Execute a listener when a response is about to write headers.
+
+## Installation
+
+```sh
+$ npm install on-headers
+```
+
+## API
+
+```js
+var onHeaders = require('on-headers')
+```
+
+### onHeaders(res, listener)
+
+This will add the listener `listener` to fire when headers are emitted for `res`.
+The listener is passed the `response` object as it's context (`this`). Headers are
+considered to be emitted only once, right before they are sent to the client.
+
+When this is called multiple times on the same `res`, the `listener`s are fired
+in the reverse order they were added.
+
+## Examples
+
+```js
+var http = require('http')
+var onHeaders = require('on-headers')
+
+http
+.createServer(onRequest)
+.listen(3000)
+
+function addPoweredBy() {
+ // set if not set by end of request
+ if (!this.getHeader('X-Powered-By')) {
+ this.setHeader('X-Powered-By', 'Node.js')
+ }
+}
+
+function onRequest(req, res) {
+ onHeaders(res, addPoweredBy)
+
+ res.setHeader('Content-Type', 'text/plain')
+ res.end('hello!')
+}
+```
+
+## Testing
+
+```sh
+$ npm test
+```
+
+## License
+
+[MIT](LICENSE)
+
+[npm-image]: https://img.shields.io/npm/v/on-headers.svg
+[npm-url]: https://npmjs.org/package/on-headers
+[node-version-image]: https://img.shields.io/node/v/on-headers.svg
+[node-version-url]: http://nodejs.org/download/
+[travis-image]: https://img.shields.io/travis/jshttp/on-headers/master.svg
+[travis-url]: https://travis-ci.org/jshttp/on-headers
+[coveralls-image]: https://img.shields.io/coveralls/jshttp/on-headers/master.svg
+[coveralls-url]: https://coveralls.io/r/jshttp/on-headers?branch=master
+[downloads-image]: https://img.shields.io/npm/dm/on-headers.svg
+[downloads-url]: https://npmjs.org/package/on-headers
diff --git a/node_modules/on-headers/index.js b/node_modules/on-headers/index.js
new file mode 100644
index 0000000..089f2b3
--- /dev/null
+++ b/node_modules/on-headers/index.js
@@ -0,0 +1,93 @@
+/*!
+ * on-headers
+ * Copyright(c) 2014 Douglas Christopher Wilson
+ * MIT Licensed
+ */
+
+'use strict'
+
+/**
+ * Reference to Array slice.
+ */
+
+var slice = Array.prototype.slice
+
+/**
+ * Execute a listener when a response is about to write headers.
+ *
+ * @param {Object} res
+ * @return {Function} listener
+ * @api public
+ */
+
+module.exports = function onHeaders(res, listener) {
+ if (!res) {
+ throw new TypeError('argument res is required')
+ }
+
+ if (typeof listener !== 'function') {
+ throw new TypeError('argument listener must be a function')
+ }
+
+ res.writeHead = createWriteHead(res.writeHead, listener)
+}
+
+function createWriteHead(prevWriteHead, listener) {
+ var fired = false;
+
+ // return function with core name and argument list
+ return function writeHead(statusCode) {
+ // set headers from arguments
+ var args = setWriteHeadHeaders.apply(this, arguments);
+
+ // fire listener
+ if (!fired) {
+ fired = true
+ listener.call(this)
+
+ // pass-along an updated status code
+ if (typeof args[0] === 'number' && this.statusCode !== args[0]) {
+ args[0] = this.statusCode
+ args.length = 1
+ }
+ }
+
+ prevWriteHead.apply(this, args);
+ }
+}
+
+function setWriteHeadHeaders(statusCode) {
+ var length = arguments.length
+ var headerIndex = length > 1 && typeof arguments[1] === 'string'
+ ? 2
+ : 1
+
+ var headers = length >= headerIndex + 1
+ ? arguments[headerIndex]
+ : undefined
+
+ this.statusCode = statusCode
+
+ // the following block is from node.js core
+ if (Array.isArray(headers)) {
+ // handle array case
+ for (var i = 0, len = headers.length; i < len; ++i) {
+ this.setHeader(headers[i][0], headers[i][1])
+ }
+ } else if (headers) {
+ // handle object case
+ var keys = Object.keys(headers)
+ for (var i = 0; i < keys.length; i++) {
+ var k = keys[i]
+ if (k) this.setHeader(k, headers[k])
+ }
+ }
+
+ // copy leading arguments
+ var args = new Array(Math.min(length, headerIndex))
+ for (var i = 0; i < args.length; i++) {
+ args[i] = arguments[i]
+ }
+
+ return args
+}
diff --git a/node_modules/on-headers/package.json b/node_modules/on-headers/package.json
new file mode 100644
index 0000000..c0601d2
--- /dev/null
+++ b/node_modules/on-headers/package.json
@@ -0,0 +1,95 @@
+{
+ "_args": [
+ [
+ "on-headers@~1.0.1",
+ "/home/humair/School/csc309/a4/solutions_repo/node_modules/express-session"
+ ]
+ ],
+ "_from": "on-headers@>=1.0.1 <1.1.0",
+ "_id": "on-headers@1.0.1",
+ "_inCache": true,
+ "_installable": true,
+ "_location": "/on-headers",
+ "_npmUser": {
+ "email": "doug@somethingdoug.com",
+ "name": "dougwilson"
+ },
+ "_npmVersion": "1.4.28",
+ "_phantomChildren": {},
+ "_requested": {
+ "name": "on-headers",
+ "raw": "on-headers@~1.0.1",
+ "rawSpec": "~1.0.1",
+ "scope": null,
+ "spec": ">=1.0.1 <1.1.0",
+ "type": "range"
+ },
+ "_requiredBy": [
+ "/express-session"
+ ],
+ "_resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.0.1.tgz",
+ "_shasum": "928f5d0f470d49342651ea6794b0857c100693f7",
+ "_shrinkwrap": null,
+ "_spec": "on-headers@~1.0.1",
+ "_where": "/home/humair/School/csc309/a4/solutions_repo/node_modules/express-session",
+ "author": {
+ "email": "doug@somethingdoug.com",
+ "name": "Douglas Christopher Wilson"
+ },
+ "bugs": {
+ "url": "https://github.com/jshttp/on-headers/issues"
+ },
+ "dependencies": {},
+ "description": "Execute a listener when a response is about to write headers",
+ "devDependencies": {
+ "istanbul": "0.3.21",
+ "mocha": "2.3.3",
+ "supertest": "1.1.0"
+ },
+ "directories": {},
+ "dist": {
+ "shasum": "928f5d0f470d49342651ea6794b0857c100693f7",
+ "tarball": "https://registry.npmjs.org/on-headers/-/on-headers-1.0.1.tgz"
+ },
+ "engines": {
+ "node": ">= 0.8"
+ },
+ "files": [
+ "HISTORY.md",
+ "LICENSE",
+ "README.md",
+ "index.js"
+ ],
+ "gitHead": "ab0156a979d72353cfe666cccb3639e016b00280",
+ "homepage": "https://github.com/jshttp/on-headers",
+ "keywords": [
+ "event",
+ "headers",
+ "http",
+ "onheaders"
+ ],
+ "license": "MIT",
+ "maintainers": [
+ {
+ "name": "dougwilson",
+ "email": "doug@somethingdoug.com"
+ },
+ {
+ "name": "jongleberry",
+ "email": "jonathanrichardong@gmail.com"
+ }
+ ],
+ "name": "on-headers",
+ "optionalDependencies": {},
+ "readme": "ERROR: No README data found!",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/jshttp/on-headers.git"
+ },
+ "scripts": {
+ "test": "mocha --reporter spec --bail --check-leaks test/",
+ "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/",
+ "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/"
+ },
+ "version": "1.0.1"
+}
diff --git a/node_modules/passport-strategy/.jshintrc b/node_modules/passport-strategy/.jshintrc
new file mode 100644
index 0000000..a07354b
--- /dev/null
+++ b/node_modules/passport-strategy/.jshintrc
@@ -0,0 +1,20 @@
+{
+ "node": true,
+
+ "bitwise": true,
+ "camelcase": true,
+ "curly": true,
+ "forin": true,
+ "immed": true,
+ "latedef": true,
+ "newcap": true,
+ "noarg": true,
+ "noempty": true,
+ "nonew": true,
+ "quotmark": "single",
+ "undef": true,
+ "unused": true,
+ "trailing": true,
+
+ "laxcomma": true
+}
diff --git a/node_modules/passport-strategy/.travis.yml b/node_modules/passport-strategy/.travis.yml
new file mode 100644
index 0000000..45f8624
--- /dev/null
+++ b/node_modules/passport-strategy/.travis.yml
@@ -0,0 +1,15 @@
+language: "node_js"
+node_js:
+ - "0.4"
+ - "0.6"
+ - "0.8"
+ - "0.10"
+
+before_install:
+ - "npm install istanbul -g"
+ - "npm install coveralls -g"
+
+script: "make ci-travis"
+
+after_success:
+ - "make submit-coverage-to-coveralls"
diff --git a/node_modules/passport-strategy/LICENSE b/node_modules/passport-strategy/LICENSE
new file mode 100644
index 0000000..ec885b5
--- /dev/null
+++ b/node_modules/passport-strategy/LICENSE
@@ -0,0 +1,20 @@
+(The MIT License)
+
+Copyright (c) 2011-2013 Jared Hanson
+
+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/passport-strategy/README.md b/node_modules/passport-strategy/README.md
new file mode 100644
index 0000000..71de07f
--- /dev/null
+++ b/node_modules/passport-strategy/README.md
@@ -0,0 +1,61 @@
+# passport-strategy
+
+[![Build](https://travis-ci.org/jaredhanson/passport-strategy.png)](http://travis-ci.org/jaredhanson/passport-strategy)
+[![Coverage](https://coveralls.io/repos/jaredhanson/passport-strategy/badge.png)](https://coveralls.io/r/jaredhanson/passport-strategy)
+[![Dependencies](https://david-dm.org/jaredhanson/passport-strategy.png)](http://david-dm.org/jaredhanson/passport-strategy)
+
+
+An abstract class implementing [Passport](http://passportjs.org/)'s strategy
+API.
+
+## Install
+
+ $ npm install passport-strategy
+
+## Usage
+
+This module exports an abstract `Strategy` class that is intended to be
+subclassed when implementing concrete authentication strategies. Once
+implemented, such strategies can be used by applications that utilize Passport
+middleware for authentication.
+
+#### Subclass Strategy
+
+Create a new `CustomStrategy` constructor which inherits from `Strategy`:
+
+```javascript
+var util = require('util')
+ , Strategy = require('passport-strategy');
+
+function CustomStrategy(...) {
+ Strategy.call(this);
+}
+
+util.inherits(CustomStrategy, Strategy);
+```
+
+#### Implement Authentication
+
+Implement `autheticate()`, performing the necessary operations required by the
+authentication scheme or protocol being implemented.
+
+```javascript
+CustomStrategy.prototype.authenticate = function(req, options) {
+ // TODO: authenticate request
+}
+```
+
+## Tests
+
+ $ npm install
+ $ npm test
+
+## Credits
+
+ - [Jared Hanson](http://github.com/jaredhanson)
+
+## License
+
+[The MIT License](http://opensource.org/licenses/MIT)
+
+Copyright (c) 2011-2013 Jared Hanson <[http://jaredhanson.net/](http://jaredhanson.net/)>
diff --git a/node_modules/passport-strategy/lib/index.js b/node_modules/passport-strategy/lib/index.js
new file mode 100644
index 0000000..a6fdfa7
--- /dev/null
+++ b/node_modules/passport-strategy/lib/index.js
@@ -0,0 +1,15 @@
+/**
+ * Module dependencies.
+ */
+var Strategy = require('./strategy');
+
+
+/**
+ * Expose `Strategy` directly from package.
+ */
+exports = module.exports = Strategy;
+
+/**
+ * Export constructors.
+ */
+exports.Strategy = Strategy;
diff --git a/node_modules/passport-strategy/lib/strategy.js b/node_modules/passport-strategy/lib/strategy.js
new file mode 100644
index 0000000..5a7eb28
--- /dev/null
+++ b/node_modules/passport-strategy/lib/strategy.js
@@ -0,0 +1,28 @@
+/**
+ * Creates an instance of `Strategy`.
+ *
+ * @constructor
+ * @api public
+ */
+function Strategy() {
+}
+
+/**
+ * Authenticate request.
+ *
+ * This function must be overridden by subclasses. In abstract form, it always
+ * throws an exception.
+ *
+ * @param {Object} req The request to authenticate.
+ * @param {Object} [options] Strategy-specific options.
+ * @api public
+ */
+Strategy.prototype.authenticate = function(req, options) {
+ throw new Error('Strategy#authenticate must be overridden by subclass');
+};
+
+
+/**
+ * Expose `Strategy`.
+ */
+module.exports = Strategy;
diff --git a/node_modules/passport-strategy/package.json b/node_modules/passport-strategy/package.json
new file mode 100644
index 0000000..4ebe9b6
--- /dev/null
+++ b/node_modules/passport-strategy/package.json
@@ -0,0 +1,97 @@
+{
+ "_args": [
+ [
+ "passport-strategy@1.x.x",
+ "/home/humair/School/csc309/a4/solutions_repo/node_modules/passport"
+ ]
+ ],
+ "_from": "passport-strategy@>=1.0.0 <2.0.0",
+ "_id": "passport-strategy@1.0.0",
+ "_inCache": true,
+ "_installable": true,
+ "_location": "/passport-strategy",
+ "_npmUser": {
+ "email": "jaredhanson@gmail.com",
+ "name": "jaredhanson"
+ },
+ "_npmVersion": "1.2.25",
+ "_phantomChildren": {},
+ "_requested": {
+ "name": "passport-strategy",
+ "raw": "passport-strategy@1.x.x",
+ "rawSpec": "1.x.x",
+ "scope": null,
+ "spec": ">=1.0.0 <2.0.0",
+ "type": "range"
+ },
+ "_requiredBy": [
+ "/passport"
+ ],
+ "_resolved": "https://registry.npmjs.org/passport-strategy/-/passport-strategy-1.0.0.tgz",
+ "_shasum": "b5539aa8fc225a3d1ad179476ddf236b440f52e4",
+ "_shrinkwrap": null,
+ "_spec": "passport-strategy@1.x.x",
+ "_where": "/home/humair/School/csc309/a4/solutions_repo/node_modules/passport",
+ "author": {
+ "email": "jaredhanson@gmail.com",
+ "name": "Jared Hanson",
+ "url": "http://www.jaredhanson.net/"
+ },
+ "bugs": {
+ "url": "http://github.com/jaredhanson/passport-strategy/issues"
+ },
+ "dependencies": {},
+ "description": "An abstract class implementing Passport's strategy API.",
+ "devDependencies": {
+ "chai": "1.x.x",
+ "mocha": "1.x.x"
+ },
+ "directories": {},
+ "dist": {
+ "shasum": "b5539aa8fc225a3d1ad179476ddf236b440f52e4",
+ "tarball": "https://registry.npmjs.org/passport-strategy/-/passport-strategy-1.0.0.tgz"
+ },
+ "engines": {
+ "node": ">= 0.4.0"
+ },
+ "homepage": "https://github.com/jaredhanson/passport-strategy#readme",
+ "keywords": [
+ "passport",
+ "strategy"
+ ],
+ "licenses": [
+ {
+ "type": "MIT",
+ "url": "http://www.opensource.org/licenses/MIT"
+ }
+ ],
+ "main": "./lib",
+ "maintainers": [
+ {
+ "name": "jaredhanson",
+ "email": "jaredhanson@gmail.com"
+ }
+ ],
+ "name": "passport-strategy",
+ "optionalDependencies": {},
+ "readme": "# passport-strategy\n\n[![Build](https://travis-ci.org/jaredhanson/passport-strategy.png)](http://travis-ci.org/jaredhanson/passport-strategy)\n[![Coverage](https://coveralls.io/repos/jaredhanson/passport-strategy/badge.png)](https://coveralls.io/r/jaredhanson/passport-strategy)\n[![Dependencies](https://david-dm.org/jaredhanson/passport-strategy.png)](http://david-dm.org/jaredhanson/passport-strategy)\n\n\nAn abstract class implementing [Passport](http://passportjs.org/)'s strategy\nAPI.\n\n## Install\n\n $ npm install passport-strategy\n\n## Usage\n\nThis module exports an abstract `Strategy` class that is intended to be\nsubclassed when implementing concrete authentication strategies. Once\nimplemented, such strategies can be used by applications that utilize Passport\nmiddleware for authentication.\n\n#### Subclass Strategy\n\nCreate a new `CustomStrategy` constructor which inherits from `Strategy`:\n\n```javascript\nvar util = require('util')\n , Strategy = require('passport-strategy');\n\nfunction CustomStrategy(...) {\n Strategy.call(this);\n}\n\nutil.inherits(CustomStrategy, Strategy);\n```\n\n#### Implement Authentication\n\nImplement `autheticate()`, performing the necessary operations required by the\nauthentication scheme or protocol being implemented.\n\n```javascript\nCustomStrategy.prototype.authenticate = function(req, options) {\n // TODO: authenticate request\n}\n```\n\n## Tests\n\n $ npm install\n $ npm test\n\n## Credits\n\n - [Jared Hanson](http://github.com/jaredhanson)\n\n## License\n\n[The MIT License](http://opensource.org/licenses/MIT)\n\nCopyright (c) 2011-2013 Jared Hanson <[http://jaredhanson.net/](http://jaredhanson.net/)>\n",
+ "readmeFilename": "README.md",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/jaredhanson/passport-strategy.git"
+ },
+ "scripts": {
+ "test": "node_modules/.bin/mocha --reporter spec --require test/bootstrap/node test/*.test.js"
+ },
+ "testling": {
+ "browsers": [
+ "chrome/latest"
+ ],
+ "files": [
+ "test/*.test.js",
+ "test/bootstrap/testling.js"
+ ],
+ "harness": "mocha"
+ },
+ "version": "1.0.0"
+}
diff --git a/node_modules/passport/LICENSE b/node_modules/passport/LICENSE
new file mode 100644
index 0000000..b28e901
--- /dev/null
+++ b/node_modules/passport/LICENSE
@@ -0,0 +1,20 @@
+The MIT License (MIT)
+
+Copyright (c) 2011-2015 Jared Hanson
+
+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/passport/lib/authenticator.js b/node_modules/passport/lib/authenticator.js
new file mode 100644
index 0000000..43b870b
--- /dev/null
+++ b/node_modules/passport/lib/authenticator.js
@@ -0,0 +1,461 @@
+/**
+ * Module dependencies.
+ */
+var SessionStrategy = require('./strategies/session');
+
+
+/**
+ * `Authenticator` constructor.
+ *
+ * @api public
+ */
+function Authenticator() {
+ this._key = 'passport';
+ this._strategies = {};
+ this._serializers = [];
+ this._deserializers = [];
+ this._infoTransformers = [];
+ this._framework = null;
+ this._userProperty = 'user';
+
+ this.init();
+}
+
+/**
+ * Initialize authenticator.
+ *
+ * @api protected
+ */
+Authenticator.prototype.init = function() {
+ this.framework(require('./framework/connect')());
+ this.use(new SessionStrategy());
+};
+
+/**
+ * Utilize the given `strategy` with optional `name`, overridding the strategy's
+ * default name.
+ *
+ * Examples:
+ *
+ * passport.use(new TwitterStrategy(...));
+ *
+ * passport.use('api', new http.BasicStrategy(...));
+ *
+ * @param {String|Strategy} name
+ * @param {Strategy} strategy
+ * @return {Authenticator} for chaining
+ * @api public
+ */
+Authenticator.prototype.use = function(name, strategy) {
+ if (!strategy) {
+ strategy = name;
+ name = strategy.name;
+ }
+ if (!name) { throw new Error('Authentication strategies must have a name'); }
+
+ this._strategies[name] = strategy;
+ return this;
+};
+
+/**
+ * Un-utilize the `strategy` with given `name`.
+ *
+ * In typical applications, the necessary authentication strategies are static,
+ * configured once and always available. As such, there is often no need to
+ * invoke this function.
+ *
+ * However, in certain situations, applications may need dynamically configure
+ * and de-configure authentication strategies. The `use()`/`unuse()`
+ * combination satisfies these scenarios.
+ *
+ * Examples:
+ *
+ * passport.unuse('legacy-api');
+ *
+ * @param {String} name
+ * @return {Authenticator} for chaining
+ * @api public
+ */
+Authenticator.prototype.unuse = function(name) {
+ delete this._strategies[name];
+ return this;
+};
+
+/**
+ * Setup Passport to be used under framework.
+ *
+ * By default, Passport exposes middleware that operate using Connect-style
+ * middleware using a `fn(req, res, next)` signature. Other popular frameworks
+ * have different expectations, and this function allows Passport to be adapted
+ * to operate within such environments.
+ *
+ * If you are using a Connect-compatible framework, including Express, there is
+ * no need to invoke this function.
+ *
+ * Examples:
+ *
+ * passport.framework(require('hapi-passport')());
+ *
+ * @param {Object} name
+ * @return {Authenticator} for chaining
+ * @api public
+ */
+Authenticator.prototype.framework = function(fw) {
+ this._framework = fw;
+ return this;
+};
+
+/**
+ * Passport's primary initialization middleware.
+ *
+ * This middleware must be in use by the Connect/Express application for
+ * Passport to operate.
+ *
+ * Options:
+ * - `userProperty` Property to set on `req` upon login, defaults to _user_
+ *
+ * Examples:
+ *
+ * app.use(passport.initialize());
+ *
+ * app.use(passport.initialize({ userProperty: 'currentUser' }));
+ *
+ * @param {Object} options
+ * @return {Function} middleware
+ * @api public
+ */
+Authenticator.prototype.initialize = function(options) {
+ options = options || {};
+ this._userProperty = options.userProperty || 'user';
+
+ return this._framework.initialize(this, options);
+};
+
+/**
+ * Middleware that will authenticate a request using the given `strategy` name,
+ * with optional `options` and `callback`.
+ *
+ * Examples:
+ *
+ * passport.authenticate('local', { successRedirect: '/', failureRedirect: '/login' })(req, res);
+ *
+ * passport.authenticate('local', function(err, user) {
+ * if (!user) { return res.redirect('/login'); }
+ * res.end('Authenticated!');
+ * })(req, res);
+ *
+ * passport.authenticate('basic', { session: false })(req, res);
+ *
+ * app.get('/auth/twitter', passport.authenticate('twitter'), function(req, res) {
+ * // request will be redirected to Twitter
+ * });
+ * app.get('/auth/twitter/callback', passport.authenticate('twitter'), function(req, res) {
+ * res.json(req.user);
+ * });
+ *
+ * @param {String} strategy
+ * @param {Object} options
+ * @param {Function} callback
+ * @return {Function} middleware
+ * @api public
+ */
+Authenticator.prototype.authenticate = function(strategy, options, callback) {
+ return this._framework.authenticate(this, strategy, options, callback);
+};
+
+/**
+ * Middleware that will authorize a third-party account using the given
+ * `strategy` name, with optional `options`.
+ *
+ * If authorization is successful, the result provided by the strategy's verify
+ * callback will be assigned to `req.account`. The existing login session and
+ * `req.user` will be unaffected.
+ *
+ * This function is particularly useful when connecting third-party accounts
+ * to the local account of a user that is currently authenticated.
+ *
+ * Examples:
+ *
+ * passport.authorize('twitter-authz', { failureRedirect: '/account' });
+ *
+ * @param {String} strategy
+ * @param {Object} options
+ * @return {Function} middleware
+ * @api public
+ */
+Authenticator.prototype.authorize = function(strategy, options, callback) {
+ options = options || {};
+ options.assignProperty = 'account';
+
+ var fn = this._framework.authorize || this._framework.authenticate;
+ return fn(this, strategy, options, callback);
+};
+
+/**
+ * Middleware that will restore login state from a session.
+ *
+ * Web applications typically use sessions to maintain login state between
+ * requests. For example, a user will authenticate by entering credentials into
+ * a form which is submitted to the server. If the credentials are valid, a
+ * login session is established by setting a cookie containing a session
+ * identifier in the user's web browser. The web browser will send this cookie
+ * in subsequent requests to the server, allowing a session to be maintained.
+ *
+ * If sessions are being utilized, and a login session has been established,
+ * this middleware will populate `req.user` with the current user.
+ *
+ * Note that sessions are not strictly required for Passport to operate.
+ * However, as a general rule, most web applications will make use of sessions.
+ * An exception to this rule would be an API server, which expects each HTTP
+ * request to provide credentials in an Authorization header.
+ *
+ * Examples:
+ *
+ * app.use(connect.cookieParser());
+ * app.use(connect.session({ secret: 'keyboard cat' }));
+ * app.use(passport.initialize());
+ * app.use(passport.session());
+ *
+ * Options:
+ * - `pauseStream` Pause the request stream before deserializing the user
+ * object from the session. Defaults to _false_. Should
+ * be set to true in cases where middleware consuming the
+ * request body is configured after passport and the
+ * deserializeUser method is asynchronous.
+ *
+ * @param {Object} options
+ * @return {Function} middleware
+ * @api public
+ */
+Authenticator.prototype.session = function(options) {
+ return this.authenticate('session', options);
+};
+
+/**
+ * Registers a function used to serialize user objects into the session.
+ *
+ * Examples:
+ *
+ * passport.serializeUser(function(user, done) {
+ * done(null, user.id);
+ * });
+ *
+ * @api public
+ */
+Authenticator.prototype.serializeUser = function(fn, req, done) {
+ if (typeof fn === 'function') {
+ return this._serializers.push(fn);
+ }
+
+ // private implementation that traverses the chain of serializers, attempting
+ // to serialize a user
+ var user = fn;
+
+ // For backwards compatibility
+ if (typeof req === 'function') {
+ done = req;
+ req = undefined;
+ }
+
+ var stack = this._serializers;
+ (function pass(i, err, obj) {
+ // serializers use 'pass' as an error to skip processing
+ if ('pass' === err) {
+ err = undefined;
+ }
+ // an error or serialized object was obtained, done
+ if (err || obj || obj === 0) { return done(err, obj); }
+
+ var layer = stack[i];
+ if (!layer) {
+ return done(new Error('Failed to serialize user into session'));
+ }
+
+
+ function serialized(e, o) {
+ pass(i + 1, e, o);
+ }
+
+ try {
+ var arity = layer.length;
+ if (arity == 3) {
+ layer(req, user, serialized);
+ } else {
+ layer(user, serialized);
+ }
+ } catch(e) {
+ return done(e);
+ }
+ })(0);
+};
+
+/**
+ * Registers a function used to deserialize user objects out of the session.
+ *
+ * Examples:
+ *
+ * passport.deserializeUser(function(id, done) {
+ * User.findById(id, function (err, user) {
+ * done(err, user);
+ * });
+ * });
+ *
+ * @api public
+ */
+Authenticator.prototype.deserializeUser = function(fn, req, done) {
+ if (typeof fn === 'function') {
+ return this._deserializers.push(fn);
+ }
+
+ // private implementation that traverses the chain of deserializers,
+ // attempting to deserialize a user
+ var obj = fn;
+
+ // For backwards compatibility
+ if (typeof req === 'function') {
+ done = req;
+ req = undefined;
+ }
+
+ var stack = this._deserializers;
+ (function pass(i, err, user) {
+ // deserializers use 'pass' as an error to skip processing
+ if ('pass' === err) {
+ err = undefined;
+ }
+ // an error or deserialized user was obtained, done
+ if (err || user) { return done(err, user); }
+ // a valid user existed when establishing the session, but that user has
+ // since been removed
+ if (user === null || user === false) { return done(null, false); }
+
+ var layer = stack[i];
+ if (!layer) {
+ return done(new Error('Failed to deserialize user out of session'));
+ }
+
+
+ function deserialized(e, u) {
+ pass(i + 1, e, u);
+ }
+
+ try {
+ var arity = layer.length;
+ if (arity == 3) {
+ layer(req, obj, deserialized);
+ } else {
+ layer(obj, deserialized);
+ }
+ } catch(e) {
+ return done(e);
+ }
+ })(0);
+};
+
+/**
+ * Registers a function used to transform auth info.
+ *
+ * In some circumstances authorization details are contained in authentication
+ * credentials or loaded as part of verification.
+ *
+ * For example, when using bearer tokens for API authentication, the tokens may
+ * encode (either directly or indirectly in a database), details such as scope
+ * of access or the client to which the token was issued.
+ *
+ * Such authorization details should be enforced separately from authentication.
+ * Because Passport deals only with the latter, this is the responsiblity of
+ * middleware or routes further along the chain. However, it is not optimal to
+ * decode the same data or execute the same database query later. To avoid
+ * this, Passport accepts optional `info` along with the authenticated `user`
+ * in a strategy's `success()` action. This info is set at `req.authInfo`,
+ * where said later middlware or routes can access it.
+ *
+ * Optionally, applications can register transforms to proccess this info,
+ * which take effect prior to `req.authInfo` being set. This is useful, for
+ * example, when the info contains a client ID. The transform can load the
+ * client from the database and include the instance in the transformed info,
+ * allowing the full set of client properties to be convieniently accessed.
+ *
+ * If no transforms are registered, `info` supplied by the strategy will be left
+ * unmodified.
+ *
+ * Examples:
+ *
+ * passport.transformAuthInfo(function(info, done) {
+ * Client.findById(info.clientID, function (err, client) {
+ * info.client = client;
+ * done(err, info);
+ * });
+ * });
+ *
+ * @api public
+ */
+Authenticator.prototype.transformAuthInfo = function(fn, req, done) {
+ if (typeof fn === 'function') {
+ return this._infoTransformers.push(fn);
+ }
+
+ // private implementation that traverses the chain of transformers,
+ // attempting to transform auth info
+ var info = fn;
+
+ // For backwards compatibility
+ if (typeof req === 'function') {
+ done = req;
+ req = undefined;
+ }
+
+ var stack = this._infoTransformers;
+ (function pass(i, err, tinfo) {
+ // transformers use 'pass' as an error to skip processing
+ if ('pass' === err) {
+ err = undefined;
+ }
+ // an error or transformed info was obtained, done
+ if (err || tinfo) { return done(err, tinfo); }
+
+ var layer = stack[i];
+ if (!layer) {
+ // if no transformers are registered (or they all pass), the default
+ // behavior is to use the un-transformed info as-is
+ return done(null, info);
+ }
+
+
+ function transformed(e, t) {
+ pass(i + 1, e, t);
+ }
+
+ try {
+ var arity = layer.length;
+ if (arity == 1) {
+ // sync
+ var t = layer(info);
+ transformed(null, t);
+ } else if (arity == 3) {
+ layer(req, info, transformed);
+ } else {
+ layer(info, transformed);
+ }
+ } catch(e) {
+ return done(e);
+ }
+ })(0);
+};
+
+/**
+ * Return strategy with given `name`.
+ *
+ * @param {String} name
+ * @return {Strategy}
+ * @api private
+ */
+Authenticator.prototype._strategy = function(name) {
+ return this._strategies[name];
+};
+
+
+/**
+ * Expose `Authenticator`.
+ */
+module.exports = Authenticator;
diff --git a/node_modules/passport/lib/errors/authenticationerror.js b/node_modules/passport/lib/errors/authenticationerror.js
new file mode 100644
index 0000000..04cbbe5
--- /dev/null
+++ b/node_modules/passport/lib/errors/authenticationerror.js
@@ -0,0 +1,23 @@
+/**
+ * `AuthenticationError` error.
+ *
+ * @api private
+ */
+function AuthenticationError(message, status) {
+ Error.call(this);
+ Error.captureStackTrace(this, arguments.callee);
+ this.name = 'AuthenticationError';
+ this.message = message;
+ this.status = status || 401;
+}
+
+/**
+ * Inherit from `Error`.
+ */
+AuthenticationError.prototype.__proto__ = Error.prototype;
+
+
+/**
+ * Expose `AuthenticationError`.
+ */
+module.exports = AuthenticationError;
diff --git a/node_modules/passport/lib/framework/connect.js b/node_modules/passport/lib/framework/connect.js
new file mode 100644
index 0000000..5c5beb0
--- /dev/null
+++ b/node_modules/passport/lib/framework/connect.js
@@ -0,0 +1,39 @@
+/**
+ * Module dependencies.
+ */
+var initialize = require('../middleware/initialize')
+ , authenticate = require('../middleware/authenticate');
+
+/**
+ * Framework support for Connect/Express.
+ *
+ * This module provides support for using Passport with Express. It exposes
+ * middleware that conform to the `fn(req, res, next)` signature and extends
+ * Node's built-in HTTP request object with useful authentication-related
+ * functions.
+ *
+ * @return {Object}
+ * @api protected
+ */
+exports = module.exports = function() {
+
+ // HTTP extensions.
+ exports.__monkeypatchNode();
+
+ return {
+ initialize: initialize,
+ authenticate: authenticate
+ };
+};
+
+exports.__monkeypatchNode = function() {
+ var http = require('http');
+ var IncomingMessageExt = require('../http/request');
+
+ http.IncomingMessage.prototype.login =
+ http.IncomingMessage.prototype.logIn = IncomingMessageExt.logIn;
+ http.IncomingMessage.prototype.logout =
+ http.IncomingMessage.prototype.logOut = IncomingMessageExt.logOut;
+ http.IncomingMessage.prototype.isAuthenticated = IncomingMessageExt.isAuthenticated;
+ http.IncomingMessage.prototype.isUnauthenticated = IncomingMessageExt.isUnauthenticated;
+};
diff --git a/node_modules/passport/lib/http/request.js b/node_modules/passport/lib/http/request.js
new file mode 100644
index 0000000..b6fc99a
--- /dev/null
+++ b/node_modules/passport/lib/http/request.js
@@ -0,0 +1,108 @@
+/**
+ * Module dependencies.
+ */
+//var http = require('http')
+// , req = http.IncomingMessage.prototype;
+
+
+var req = exports = module.exports = {};
+
+/**
+ * Intiate a login session for `user`.
+ *
+ * Options:
+ * - `session` Save login state in session, defaults to _true_
+ *
+ * Examples:
+ *
+ * req.logIn(user, { session: false });
+ *
+ * req.logIn(user, function(err) {
+ * if (err) { throw err; }
+ * // session saved
+ * });
+ *
+ * @param {User} user
+ * @param {Object} options
+ * @param {Function} done
+ * @api public
+ */
+req.login =
+req.logIn = function(user, options, done) {
+ if (typeof options == 'function') {
+ done = options;
+ options = {};
+ }
+ options = options || {};
+
+ var property = 'user';
+ if (this._passport && this._passport.instance) {
+ property = this._passport.instance._userProperty || 'user';
+ }
+ var session = (options.session === undefined) ? true : options.session;
+
+ this[property] = user;
+ if (session) {
+ if (!this._passport) { throw new Error('passport.initialize() middleware not in use'); }
+ if (typeof done != 'function') { throw new Error('req#login requires a callback function'); }
+
+ var self = this;
+ this._passport.instance.serializeUser(user, this, function(err, obj) {
+ if (err) { self[property] = null; return done(err); }
+ if (!self._passport.session) {
+ self._passport.session = {};
+ }
+ self._passport.session.user = obj;
+ if (!self.session) {
+ self.session = {};
+ }
+ self.session[self._passport.instance._key] = self._passport.session;
+ done();
+ });
+ } else {
+ done && done();
+ }
+};
+
+/**
+ * Terminate an existing login session.
+ *
+ * @api public
+ */
+req.logout =
+req.logOut = function() {
+ var property = 'user';
+ if (this._passport && this._passport.instance) {
+ property = this._passport.instance._userProperty || 'user';
+ }
+
+ this[property] = null;
+ if (this._passport && this._passport.session) {
+ delete this._passport.session.user;
+ }
+};
+
+/**
+ * Test if request is authenticated.
+ *
+ * @return {Boolean}
+ * @api public
+ */
+req.isAuthenticated = function() {
+ var property = 'user';
+ if (this._passport && this._passport.instance) {
+ property = this._passport.instance._userProperty || 'user';
+ }
+
+ return (this[property]) ? true : false;
+};
+
+/**
+ * Test if request is unauthenticated.
+ *
+ * @return {Boolean}
+ * @api public
+ */
+req.isUnauthenticated = function() {
+ return !this.isAuthenticated();
+};
diff --git a/node_modules/passport/lib/index.js b/node_modules/passport/lib/index.js
new file mode 100644
index 0000000..ab17469
--- /dev/null
+++ b/node_modules/passport/lib/index.js
@@ -0,0 +1,26 @@
+/**
+ * Module dependencies.
+ */
+var Passport = require('./authenticator')
+ , SessionStrategy = require('./strategies/session');
+
+
+/**
+ * Export default singleton.
+ *
+ * @api public
+ */
+exports = module.exports = new Passport();
+
+/**
+ * Expose constructors.
+ */
+exports.Passport =
+exports.Authenticator = Passport;
+exports.Strategy = require('passport-strategy');
+
+/**
+ * Expose strategies.
+ */
+exports.strategies = {};
+exports.strategies.SessionStrategy = SessionStrategy;
diff --git a/node_modules/passport/lib/middleware/authenticate.js b/node_modules/passport/lib/middleware/authenticate.js
new file mode 100644
index 0000000..db0cb18
--- /dev/null
+++ b/node_modules/passport/lib/middleware/authenticate.js
@@ -0,0 +1,351 @@
+/**
+ * Module dependencies.
+ */
+var http = require('http')
+ , IncomingMessageExt = require('../http/request')
+ , AuthenticationError = require('../errors/authenticationerror');
+
+
+/**
+ * Authenticates requests.
+ *
+ * Applies the `name`ed strategy (or strategies) to the incoming request, in
+ * order to authenticate the request. If authentication is successful, the user
+ * will be logged in and populated at `req.user` and a session will be
+ * established by default. If authentication fails, an unauthorized response
+ * will be sent.
+ *
+ * Options:
+ * - `session` Save login state in session, defaults to _true_
+ * - `successRedirect` After successful login, redirect to given URL
+ * - `failureRedirect` After failed login, redirect to given URL
+ * - `assignProperty` Assign the object provided by the verify callback to given property
+ *
+ * An optional `callback` can be supplied to allow the application to overrride
+ * the default manner in which authentication attempts are handled. The
+ * callback has the following signature, where `user` will be set to the
+ * authenticated user on a successful authentication attempt, or `false`
+ * otherwise. An optional `info` argument will be passed, containing additional
+ * details provided by the strategy's verify callback.
+ *
+ * app.get('/protected', function(req, res, next) {
+ * passport.authenticate('local', function(err, user, info) {
+ * if (err) { return next(err) }
+ * if (!user) { return res.redirect('/signin') }
+ * res.redirect('/account');
+ * })(req, res, next);
+ * });
+ *
+ * Note that if a callback is supplied, it becomes the application's
+ * responsibility to log-in the user, establish a session, and otherwise perform
+ * the desired operations.
+ *
+ * Examples:
+ *
+ * passport.authenticate('local', { successRedirect: '/', failureRedirect: '/login' });
+ *
+ * passport.authenticate('basic', { session: false });
+ *
+ * passport.authenticate('twitter');
+ *
+ * @param {String|Array} name
+ * @param {Object} options
+ * @param {Function} callback
+ * @return {Function}
+ * @api public
+ */
+module.exports = function authenticate(passport, name, options, callback) {
+ if (typeof options == 'function') {
+ callback = options;
+ options = {};
+ }
+ options = options || {};
+
+ var multi = true;
+
+ // Cast `name` to an array, allowing authentication to pass through a chain of
+ // strategies. The first strategy to succeed, redirect, or error will halt
+ // the chain. Authentication failures will proceed through each strategy in
+ // series, ultimately failing if all strategies fail.
+ //
+ // This is typically used on API endpoints to allow clients to authenticate
+ // using their preferred choice of Basic, Digest, token-based schemes, etc.
+ // It is not feasible to construct a chain of multiple strategies that involve
+ // redirection (for example both Facebook and Twitter), since the first one to
+ // redirect will halt the chain.
+ if (!Array.isArray(name)) {
+ name = [ name ];
+ multi = false;
+ }
+
+ return function authenticate(req, res, next) {
+ if (http.IncomingMessage.prototype.logIn
+ && http.IncomingMessage.prototype.logIn !== IncomingMessageExt.logIn) {
+ require('../framework/connect').__monkeypatchNode();
+ }
+
+
+ // accumulator for failures from each strategy in the chain
+ var failures = [];
+
+ function allFailed() {
+ if (callback) {
+ if (!multi) {
+ return callback(null, false, failures[0].challenge, failures[0].status);
+ } else {
+ var challenges = failures.map(function(f) { return f.challenge; });
+ var statuses = failures.map(function(f) { return f.status; });
+ return callback(null, false, challenges, statuses);
+ }
+ }
+
+ // Strategies are ordered by priority. For the purpose of flashing a
+ // message, the first failure will be displayed.
+ var failure = failures[0] || {}
+ , challenge = failure.challenge || {}
+ , msg;
+
+ if (options.failureFlash) {
+ var flash = options.failureFlash;
+ if (typeof flash == 'string') {
+ flash = { type: 'error', message: flash };
+ }
+ flash.type = flash.type || 'error';
+
+ var type = flash.type || challenge.type || 'error';
+ msg = flash.message || challenge.message || challenge;
+ if (typeof msg == 'string') {
+ req.flash(type, msg);
+ }
+ }
+ if (options.failureMessage) {
+ msg = options.failureMessage;
+ if (typeof msg == 'boolean') {
+ msg = challenge.message || challenge;
+ }
+ if (typeof msg == 'string') {
+ req.session.messages = req.session.messages || [];
+ req.session.messages.push(msg);
+ }
+ }
+ if (options.failureRedirect) {
+ return res.redirect(options.failureRedirect);
+ }
+
+ // When failure handling is not delegated to the application, the default
+ // is to respond with 401 Unauthorized. Note that the WWW-Authenticate
+ // header will be set according to the strategies in use (see
+ // actions#fail). If multiple strategies failed, each of their challenges
+ // will be included in the response.
+ var rchallenge = []
+ , rstatus, status;
+
+ for (var j = 0, len = failures.length; j < len; j++) {
+ failure = failures[j];
+ challenge = failure.challenge;
+ status = failure.status;
+
+ rstatus = rstatus || status;
+ if (typeof challenge == 'string') {
+ rchallenge.push(challenge);
+ }
+ }
+
+ res.statusCode = rstatus || 401;
+ if (res.statusCode == 401 && rchallenge.length) {
+ res.setHeader('WWW-Authenticate', rchallenge);
+ }
+ if (options.failWithError) {
+ return next(new AuthenticationError(http.STATUS_CODES[res.statusCode], rstatus));
+ }
+ res.end(http.STATUS_CODES[res.statusCode]);
+ }
+
+ (function attempt(i) {
+ var layer = name[i];
+ // If no more strategies exist in the chain, authentication has failed.
+ if (!layer) { return allFailed(); }
+
+ // Get the strategy, which will be used as prototype from which to create
+ // a new instance. Action functions will then be bound to the strategy
+ // within the context of the HTTP request/response pair.
+ var prototype = passport._strategy(layer);
+ if (!prototype) { return next(new Error('Unknown authentication strategy "' + layer + '"')); }
+
+ var strategy = Object.create(prototype);
+
+
+ // ----- BEGIN STRATEGY AUGMENTATION -----
+ // Augment the new strategy instance with action functions. These action
+ // functions are bound via closure the the request/response pair. The end
+ // goal of the strategy is to invoke *one* of these action methods, in
+ // order to indicate successful or failed authentication, redirect to a
+ // third-party identity provider, etc.
+
+ /**
+ * Authenticate `user`, with optional `info`.
+ *
+ * Strategies should call this function to successfully authenticate a
+ * user. `user` should be an object supplied by the application after it
+ * has been given an opportunity to verify credentials. `info` is an
+ * optional argument containing additional user information. This is
+ * useful for third-party authentication strategies to pass profile
+ * details.
+ *
+ * @param {Object} user
+ * @param {Object} info
+ * @api public
+ */
+ strategy.success = function(user, info) {
+ if (callback) {
+ return callback(null, user, info);
+ }
+
+ info = info || {};
+ var msg;
+
+ if (options.successFlash) {
+ var flash = options.successFlash;
+ if (typeof flash == 'string') {
+ flash = { type: 'success', message: flash };
+ }
+ flash.type = flash.type || 'success';
+
+ var type = flash.type || info.type || 'success';
+ msg = flash.message || info.message || info;
+ if (typeof msg == 'string') {
+ req.flash(type, msg);
+ }
+ }
+ if (options.successMessage) {
+ msg = options.successMessage;
+ if (typeof msg == 'boolean') {
+ msg = info.message || info;
+ }
+ if (typeof msg == 'string') {
+ req.session.messages = req.session.messages || [];
+ req.session.messages.push(msg);
+ }
+ }
+ if (options.assignProperty) {
+ req[options.assignProperty] = user;
+ return next();
+ }
+
+ req.logIn(user, options, function(err) {
+ if (err) { return next(err); }
+
+ function complete() {
+ if (options.successReturnToOrRedirect) {
+ var url = options.successReturnToOrRedirect;
+ if (req.session && req.session.returnTo) {
+ url = req.session.returnTo;
+ delete req.session.returnTo;
+ }
+ return res.redirect(url);
+ }
+ if (options.successRedirect) {
+ return res.redirect(options.successRedirect);
+ }
+ next();
+ }
+
+ if (options.authInfo !== false) {
+ passport.transformAuthInfo(info, req, function(err, tinfo) {
+ if (err) { return next(err); }
+ req.authInfo = tinfo;
+ complete();
+ });
+ } else {
+ complete();
+ }
+ });
+ };
+
+ /**
+ * Fail authentication, with optional `challenge` and `status`, defaulting
+ * to 401.
+ *
+ * Strategies should call this function to fail an authentication attempt.
+ *
+ * @param {String} challenge
+ * @param {Number} status
+ * @api public
+ */
+ strategy.fail = function(challenge, status) {
+ if (typeof challenge == 'number') {
+ status = challenge;
+ challenge = undefined;
+ }
+
+ // push this failure into the accumulator and attempt authentication
+ // using the next strategy
+ failures.push({ challenge: challenge, status: status });
+ attempt(i + 1);
+ };
+
+ /**
+ * Redirect to `url` with optional `status`, defaulting to 302.
+ *
+ * Strategies should call this function to redirect the user (via their
+ * user agent) to a third-party website for authentication.
+ *
+ * @param {String} url
+ * @param {Number} status
+ * @api public
+ */
+ strategy.redirect = function(url, status) {
+ // NOTE: Do not use `res.redirect` from Express, because it can't decide
+ // what it wants.
+ //
+ // Express 2.x: res.redirect(url, status)
+ // Express 3.x: res.redirect(status, url) -OR- res.redirect(url, status)
+ // - as of 3.14.0, deprecated warnings are issued if res.redirect(url, status)
+ // is used
+ // Express 4.x: res.redirect(status, url)
+ // - all versions (as of 4.8.7) continue to accept res.redirect(url, status)
+ // but issue deprecated versions
+
+ res.statusCode = status || 302;
+ res.setHeader('Location', url);
+ res.setHeader('Content-Length', '0');
+ res.end();
+ };
+
+ /**
+ * Pass without making a success or fail decision.
+ *
+ * Under most circumstances, Strategies should not need to call this
+ * function. It exists primarily to allow previous authentication state
+ * to be restored, for example from an HTTP session.
+ *
+ * @api public
+ */
+ strategy.pass = function() {
+ next();
+ };
+
+ /**
+ * Internal error while performing authentication.
+ *
+ * Strategies should call this function when an internal error occurs
+ * during the process of performing authentication; for example, if the
+ * user directory is not available.
+ *
+ * @param {Error} err
+ * @api public
+ */
+ strategy.error = function(err) {
+ if (callback) {
+ return callback(err);
+ }
+
+ next(err);
+ };
+
+ // ----- END STRATEGY AUGMENTATION -----
+
+ strategy.authenticate(req, options);
+ })(0); // attempt
+ };
+};
diff --git a/node_modules/passport/lib/middleware/initialize.js b/node_modules/passport/lib/middleware/initialize.js
new file mode 100644
index 0000000..53ce3d8
--- /dev/null
+++ b/node_modules/passport/lib/middleware/initialize.js
@@ -0,0 +1,55 @@
+/**
+ * Passport initialization.
+ *
+ * Intializes Passport for incoming requests, allowing authentication strategies
+ * to be applied.
+ *
+ * If sessions are being utilized, applications must set up Passport with
+ * functions to serialize a user into and out of a session. For example, a
+ * common pattern is to serialize just the user ID into the session (due to the
+ * fact that it is desirable to store the minimum amount of data in a session).
+ * When a subsequent request arrives for the session, the full User object can
+ * be loaded from the database by ID.
+ *
+ * Note that additional middleware is required to persist login state, so we
+ * must use the `connect.session()` middleware _before_ `passport.initialize()`.
+ *
+ * If sessions are being used, this middleware must be in use by the
+ * Connect/Express application for Passport to operate. If the application is
+ * entirely stateless (not using sessions), this middleware is not necessary,
+ * but its use will not have any adverse impact.
+ *
+ * Examples:
+ *
+ * app.use(connect.cookieParser());
+ * app.use(connect.session({ secret: 'keyboard cat' }));
+ * app.use(passport.initialize());
+ * app.use(passport.session());
+ *
+ * passport.serializeUser(function(user, done) {
+ * done(null, user.id);
+ * });
+ *
+ * passport.deserializeUser(function(id, done) {
+ * User.findById(id, function (err, user) {
+ * done(err, user);
+ * });
+ * });
+ *
+ * @return {Function}
+ * @api public
+ */
+module.exports = function initialize(passport) {
+
+ return function initialize(req, res, next) {
+ req._passport = {};
+ req._passport.instance = passport;
+
+ if (req.session && req.session[passport._key]) {
+ // load data from existing session
+ req._passport.session = req.session[passport._key];
+ }
+
+ next();
+ };
+};
diff --git a/node_modules/passport/lib/strategies/session.js b/node_modules/passport/lib/strategies/session.js
new file mode 100644
index 0000000..f2db338
--- /dev/null
+++ b/node_modules/passport/lib/strategies/session.js
@@ -0,0 +1,79 @@
+/**
+ * Module dependencies.
+ */
+var pause = require('pause')
+ , util = require('util')
+ , Strategy = require('passport-strategy');
+
+
+/**
+ * `SessionStrategy` constructor.
+ *
+ * @api public
+ */
+function SessionStrategy() {
+ Strategy.call(this);
+ this.name = 'session';
+}
+
+/**
+ * Inherit from `Strategy`.
+ */
+util.inherits(SessionStrategy, Strategy);
+
+/**
+ * Authenticate request based on the current session state.
+ *
+ * The session authentication strategy uses the session to restore any login
+ * state across requests. If a login session has been established, `req.user`
+ * will be populated with the current user.
+ *
+ * This strategy is registered automatically by Passport.
+ *
+ * @param {Object} req
+ * @param {Object} options
+ * @api protected
+ */
+SessionStrategy.prototype.authenticate = function(req, options) {
+ if (!req._passport) { return this.error(new Error('passport.initialize() middleware not in use')); }
+ options = options || {};
+
+ var self = this,
+ su;
+ if (req._passport.session) {
+ su = req._passport.session.user;
+ }
+
+ if (su || su === 0) {
+ // NOTE: Stream pausing is desirable in the case where later middleware is
+ // listening for events emitted from request. For discussion on the
+ // matter, refer to: https://github.com/jaredhanson/passport/pull/106
+
+ var paused = options.pauseStream ? pause(req) : null;
+ req._passport.instance.deserializeUser(su, req, function(err, user) {
+ if (err) { return self.error(err); }
+ if (!user) {
+ delete req._passport.session.user;
+ self.pass();
+ if (paused) {
+ paused.resume();
+ }
+ return;
+ }
+ var property = req._passport.instance._userProperty || 'user';
+ req[property] = user;
+ self.pass();
+ if (paused) {
+ paused.resume();
+ }
+ });
+ } else {
+ self.pass();
+ }
+};
+
+
+/**
+ * Expose `SessionStrategy`.
+ */
+module.exports = SessionStrategy;
diff --git a/node_modules/passport/package.json b/node_modules/passport/package.json
new file mode 100644
index 0000000..d99e562
--- /dev/null
+++ b/node_modules/passport/package.json
@@ -0,0 +1,97 @@
+{
+ "_args": [
+ [
+ "passport",
+ "/home/humair/School/csc309/a4/solutions_repo"
+ ]
+ ],
+ "_from": "passport@latest",
+ "_id": "passport@0.3.2",
+ "_inCache": true,
+ "_installable": true,
+ "_location": "/passport",
+ "_npmUser": {
+ "email": "jaredhanson@gmail.com",
+ "name": "jaredhanson"
+ },
+ "_npmVersion": "1.4.28",
+ "_phantomChildren": {},
+ "_requested": {
+ "name": "passport",
+ "raw": "passport",
+ "rawSpec": "",
+ "scope": null,
+ "spec": "latest",
+ "type": "tag"
+ },
+ "_requiredBy": [
+ "/"
+ ],
+ "_resolved": "https://registry.npmjs.org/passport/-/passport-0.3.2.tgz",
+ "_shasum": "9dd009f915e8fe095b0124a01b8f82da07510102",
+ "_shrinkwrap": null,
+ "_spec": "passport",
+ "_where": "/home/humair/School/csc309/a4/solutions_repo",
+ "author": {
+ "email": "jaredhanson@gmail.com",
+ "name": "Jared Hanson",
+ "url": "http://www.jaredhanson.net/"
+ },
+ "bugs": {
+ "url": "http://github.com/jaredhanson/passport/issues"
+ },
+ "dependencies": {
+ "passport-strategy": "1.x.x",
+ "pause": "0.0.1"
+ },
+ "description": "Simple, unobtrusive authentication for Node.js.",
+ "devDependencies": {
+ "chai": "2.x.x",
+ "chai-connect-middleware": "0.3.x",
+ "chai-passport-strategy": "0.2.x",
+ "mocha": "2.x.x",
+ "proxyquire": "1.x.x"
+ },
+ "directories": {},
+ "dist": {
+ "shasum": "9dd009f915e8fe095b0124a01b8f82da07510102",
+ "tarball": "https://registry.npmjs.org/passport/-/passport-0.3.2.tgz"
+ },
+ "engines": {
+ "node": ">= 0.4.0"
+ },
+ "gitHead": "ee57813037914642906aa9ed9e1c9ecbebf905ff",
+ "homepage": "http://passportjs.org/",
+ "keywords": [
+ "auth",
+ "authentication",
+ "authn",
+ "connect",
+ "express"
+ ],
+ "license": "MIT",
+ "licenses": [
+ {
+ "type": "MIT",
+ "url": "http://www.opensource.org/licenses/MIT"
+ }
+ ],
+ "main": "./lib",
+ "maintainers": [
+ {
+ "name": "jaredhanson",
+ "email": "jaredhanson@gmail.com"
+ }
+ ],
+ "name": "passport",
+ "optionalDependencies": {},
+ "readme": "ERROR: No README data found!",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/jaredhanson/passport.git"
+ },
+ "scripts": {
+ "test": "mocha --reporter spec --require test/bootstrap/node test/*.test.js test/**/*.test.js"
+ },
+ "version": "0.3.2"
+}
diff --git a/node_modules/pause/.npmignore b/node_modules/pause/.npmignore
new file mode 100644
index 0000000..f1250e5
--- /dev/null
+++ b/node_modules/pause/.npmignore
@@ -0,0 +1,4 @@
+support
+test
+examples
+*.sock
diff --git a/node_modules/pause/History.md b/node_modules/pause/History.md
new file mode 100644
index 0000000..c8aa68f
--- /dev/null
+++ b/node_modules/pause/History.md
@@ -0,0 +1,5 @@
+
+0.0.1 / 2010-01-03
+==================
+
+ * Initial release
diff --git a/node_modules/pause/Makefile b/node_modules/pause/Makefile
new file mode 100644
index 0000000..4e9c8d3
--- /dev/null
+++ b/node_modules/pause/Makefile
@@ -0,0 +1,7 @@
+
+test:
+ @./node_modules/.bin/mocha \
+ --require should \
+ --reporter spec
+
+.PHONY: test \ No newline at end of file
diff --git a/node_modules/pause/Readme.md b/node_modules/pause/Readme.md
new file mode 100644
index 0000000..1cdd68a
--- /dev/null
+++ b/node_modules/pause/Readme.md
@@ -0,0 +1,29 @@
+
+# pause
+
+ Pause streams...
+
+## License
+
+(The MIT License)
+
+Copyright (c) 2012 TJ Holowaychuk &lt;tj@vision-media.ca&gt;
+
+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. \ No newline at end of file
diff --git a/node_modules/pause/index.js b/node_modules/pause/index.js
new file mode 100644
index 0000000..1b7b379
--- /dev/null
+++ b/node_modules/pause/index.js
@@ -0,0 +1,29 @@
+
+module.exports = function(obj){
+ var onData
+ , onEnd
+ , events = [];
+
+ // buffer data
+ obj.on('data', onData = function(data, encoding){
+ events.push(['data', data, encoding]);
+ });
+
+ // buffer end
+ obj.on('end', onEnd = function(data, encoding){
+ events.push(['end', data, encoding]);
+ });
+
+ return {
+ end: function(){
+ obj.removeListener('data', onData);
+ obj.removeListener('end', onEnd);
+ },
+ resume: function(){
+ this.end();
+ for (var i = 0, len = events.length; i < len; ++i) {
+ obj.emit.apply(obj, events[i]);
+ }
+ }
+ };
+}; \ No newline at end of file
diff --git a/node_modules/pause/package.json b/node_modules/pause/package.json
new file mode 100644
index 0000000..5cf7ebb
--- /dev/null
+++ b/node_modules/pause/package.json
@@ -0,0 +1,57 @@
+{
+ "_args": [
+ [
+ "pause@0.0.1",
+ "/home/humair/School/csc309/a4/solutions_repo/node_modules/passport"
+ ]
+ ],
+ "_from": "pause@0.0.1",
+ "_id": "pause@0.0.1",
+ "_inCache": true,
+ "_installable": true,
+ "_location": "/pause",
+ "_phantomChildren": {},
+ "_requested": {
+ "name": "pause",
+ "raw": "pause@0.0.1",
+ "rawSpec": "0.0.1",
+ "scope": null,
+ "spec": "0.0.1",
+ "type": "version"
+ },
+ "_requiredBy": [
+ "/passport"
+ ],
+ "_resolved": "https://registry.npmjs.org/pause/-/pause-0.0.1.tgz",
+ "_shasum": "1d408b3fdb76923b9543d96fb4c9dfd535d9cb5d",
+ "_shrinkwrap": null,
+ "_spec": "pause@0.0.1",
+ "_where": "/home/humair/School/csc309/a4/solutions_repo/node_modules/passport",
+ "author": {
+ "email": "tj@vision-media.ca",
+ "name": "TJ Holowaychuk"
+ },
+ "dependencies": {},
+ "description": "Pause streams...",
+ "devDependencies": {
+ "mocha": "*",
+ "should": "*"
+ },
+ "directories": {},
+ "dist": {
+ "shasum": "1d408b3fdb76923b9543d96fb4c9dfd535d9cb5d",
+ "tarball": "https://registry.npmjs.org/pause/-/pause-0.0.1.tgz"
+ },
+ "keywords": [],
+ "main": "index",
+ "maintainers": [
+ {
+ "name": "tjholowaychuk",
+ "email": "tj@vision-media.ca"
+ }
+ ],
+ "name": "pause",
+ "optionalDependencies": {},
+ "readme": "ERROR: No README data found!",
+ "version": "0.0.1"
+}
diff --git a/node_modules/random-bytes/HISTORY.md b/node_modules/random-bytes/HISTORY.md
new file mode 100644
index 0000000..8cabd9d
--- /dev/null
+++ b/node_modules/random-bytes/HISTORY.md
@@ -0,0 +1,4 @@
+1.0.0 / 2016-01-17
+==================
+
+ * Initial release
diff --git a/node_modules/random-bytes/LICENSE b/node_modules/random-bytes/LICENSE
new file mode 100644
index 0000000..c24dbe3
--- /dev/null
+++ b/node_modules/random-bytes/LICENSE
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 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/random-bytes/README.md b/node_modules/random-bytes/README.md
new file mode 100644
index 0000000..df5aacc
--- /dev/null
+++ b/node_modules/random-bytes/README.md
@@ -0,0 +1,77 @@
+# random-bytes
+
+[![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]
+
+Generate strong pseudo-random bytes.
+
+This module is a simple wrapper around the Node.js core `crypto.randomBytes` API,
+with the following additions:
+
+ * A `Promise` interface for environments with promises.
+ * For Node.js versions that do not wait for the PRNG to be seeded, this module
+ will wait a bit.
+
+## Installation
+
+```sh
+$ npm install random-bytes
+```
+
+## API
+
+```js
+var randomBytes = require('random-bytes')
+```
+
+### randomBytes(size, callback)
+
+Generates strong pseudo-random bytes. The `size` argument is a number indicating
+the number of bytes to generate.
+
+```js
+randomBytes(12, function (error, bytes) {
+ if (error) throw error
+ // do something with the bytes
+})
+```
+
+### randomBytes(size)
+
+Generates strong pseudo-random bytes and return a `Promise`. The `size` argument is
+a number indicating the number of bytes to generate.
+
+**Note**: To use promises in Node.js _prior to 0.12_, promises must be
+"polyfilled" using `global.Promise = require('bluebird')`.
+
+```js
+randomBytes(18).then(function (string) {
+ // do something with the string
+})
+```
+
+### randomBytes.sync(size)
+
+A synchronous version of above.
+
+```js
+var bytes = randomBytes.sync(18)
+```
+
+## License
+
+[MIT](LICENSE)
+
+[npm-image]: https://img.shields.io/npm/v/random-bytes.svg
+[npm-url]: https://npmjs.org/package/random-bytes
+[node-version-image]: https://img.shields.io/node/v/random-bytes.svg
+[node-version-url]: http://nodejs.org/download/
+[travis-image]: https://img.shields.io/travis/crypto-utils/random-bytes/master.svg
+[travis-url]: https://travis-ci.org/crypto-utils/random-bytes
+[coveralls-image]: https://img.shields.io/coveralls/crypto-utils/random-bytes/master.svg
+[coveralls-url]: https://coveralls.io/r/crypto-utils/random-bytes?branch=master
+[downloads-image]: https://img.shields.io/npm/dm/random-bytes.svg
+[downloads-url]: https://npmjs.org/package/random-bytes
diff --git a/node_modules/random-bytes/index.js b/node_modules/random-bytes/index.js
new file mode 100644
index 0000000..9ad930f
--- /dev/null
+++ b/node_modules/random-bytes/index.js
@@ -0,0 +1,101 @@
+/*!
+ * random-bytes
+ * Copyright(c) 2016 Douglas Christopher Wilson
+ * MIT Licensed
+ */
+
+'use strict'
+
+/**
+ * Module dependencies.
+ * @private
+ */
+
+var crypto = require('crypto')
+
+/**
+ * Module variables.
+ * @private
+ */
+
+var generateAttempts = crypto.randomBytes === crypto.pseudoRandomBytes ? 1 : 3
+
+/**
+ * Module exports.
+ * @public
+ */
+
+module.exports = randomBytes
+module.exports.sync = randomBytesSync
+
+/**
+ * Generates strong pseudo-random bytes.
+ *
+ * @param {number} size
+ * @param {function} [callback]
+ * @return {Promise}
+ * @public
+ */
+
+function randomBytes(size, 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 generateRandomBytes(size, generateAttempts, callback)
+ }
+
+ return new Promise(function executor(resolve, reject) {
+ generateRandomBytes(size, generateAttempts, function onRandomBytes(err, str) {
+ if (err) return reject(err)
+ resolve(str)
+ })
+ })
+}
+
+/**
+ * Generates strong pseudo-random bytes sync.
+ *
+ * @param {number} size
+ * @return {Buffer}
+ * @public
+ */
+
+function randomBytesSync(size) {
+ var err = null
+
+ for (var i = 0; i < generateAttempts; i++) {
+ try {
+ return crypto.randomBytes(size)
+ } catch (e) {
+ err = e
+ }
+ }
+
+ throw err
+}
+
+/**
+ * Generates strong pseudo-random bytes.
+ *
+ * @param {number} size
+ * @param {number} attempts
+ * @param {function} callback
+ * @private
+ */
+
+function generateRandomBytes(size, attempts, callback) {
+ crypto.randomBytes(size, function onRandomBytes(err, buf) {
+ if (!err) return callback(null, buf)
+ if (!--attempts) return callback(err)
+ setTimeout(generateRandomBytes.bind(null, size, attempts, callback), 10)
+ })
+}
diff --git a/node_modules/random-bytes/package.json b/node_modules/random-bytes/package.json
new file mode 100644
index 0000000..c79f37d
--- /dev/null
+++ b/node_modules/random-bytes/package.json
@@ -0,0 +1,94 @@
+{
+ "_args": [
+ [
+ "random-bytes@~1.0.0",
+ "/home/humair/School/csc309/a4/solutions_repo/node_modules/uid-safe"
+ ]
+ ],
+ "_from": "random-bytes@>=1.0.0 <1.1.0",
+ "_id": "random-bytes@1.0.0",
+ "_inCache": true,
+ "_installable": true,
+ "_location": "/random-bytes",
+ "_npmUser": {
+ "email": "doug@somethingdoug.com",
+ "name": "dougwilson"
+ },
+ "_npmVersion": "1.4.28",
+ "_phantomChildren": {},
+ "_requested": {
+ "name": "random-bytes",
+ "raw": "random-bytes@~1.0.0",
+ "rawSpec": "~1.0.0",
+ "scope": null,
+ "spec": ">=1.0.0 <1.1.0",
+ "type": "range"
+ },
+ "_requiredBy": [
+ "/uid-safe"
+ ],
+ "_resolved": "https://registry.npmjs.org/random-bytes/-/random-bytes-1.0.0.tgz",
+ "_shasum": "4f68a1dc0ae58bd3fb95848c30324db75d64360b",
+ "_shrinkwrap": null,
+ "_spec": "random-bytes@~1.0.0",
+ "_where": "/home/humair/School/csc309/a4/solutions_repo/node_modules/uid-safe",
+ "bugs": {
+ "url": "https://github.com/crypto-utils/random-bytes/issues"
+ },
+ "contributors": [
+ {
+ "name": "Douglas Christopher Wilson",
+ "email": "doug@somethingdoug.com"
+ }
+ ],
+ "dependencies": {},
+ "description": "URL and cookie safe UIDs",
+ "devDependencies": {
+ "bluebird": "3.1.1",
+ "istanbul": "0.4.2",
+ "mocha": "2.3.4",
+ "proxyquire": "1.2.0"
+ },
+ "directories": {},
+ "dist": {
+ "shasum": "4f68a1dc0ae58bd3fb95848c30324db75d64360b",
+ "tarball": "https://registry.npmjs.org/random-bytes/-/random-bytes-1.0.0.tgz"
+ },
+ "engines": {
+ "node": ">= 0.8"
+ },
+ "files": [
+ "HISTORY.md",
+ "LICENSE",
+ "README.md",
+ "index.js"
+ ],
+ "gitHead": "3dcd47425a3dfe858ee8debcd4db0c1222110bc3",
+ "homepage": "https://github.com/crypto-utils/random-bytes",
+ "keywords": [
+ "bytes",
+ "generator",
+ "random",
+ "safe"
+ ],
+ "license": "MIT",
+ "maintainers": [
+ {
+ "name": "dougwilson",
+ "email": "doug@somethingdoug.com"
+ }
+ ],
+ "name": "random-bytes",
+ "optionalDependencies": {},
+ "readme": "ERROR: No README data found!",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/crypto-utils/random-bytes.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": "1.0.0"
+}
diff --git a/node_modules/rndm/LICENSE b/node_modules/rndm/LICENSE
new file mode 100644
index 0000000..a7ae8ee
--- /dev/null
+++ b/node_modules/rndm/LICENSE
@@ -0,0 +1,22 @@
+
+The MIT License (MIT)
+
+Copyright (c) 2014 Jonathan Ong me@jongleberry.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/rndm/README.md b/node_modules/rndm/README.md
new file mode 100644
index 0000000..504b1fd
--- /dev/null
+++ b/node_modules/rndm/README.md
@@ -0,0 +1,27 @@
+
+# RNDM
+
+Random string generator.
+Basically `Math.random().toString(36).slice(2)`,
+but with both upper and lower case letters and arbitrary lengths.
+Useful for creating fast, not cryptographically secure salts.
+
+## API
+
+```js
+// base62 by default
+var rndm = require('rndm')
+var salt = rndm(16)
+```
+
+### var salt = rndm(length)
+
+### var salt = rndm.base62(length)
+
+### var salt = rndm.base36(length)
+
+### var salt = rndm.base10(length)
+
+### var random = rndm.create(characters)
+
+Create a new random generator with custom characters.
diff --git a/node_modules/rndm/index.js b/node_modules/rndm/index.js
new file mode 100644
index 0000000..24b0ebb
--- /dev/null
+++ b/node_modules/rndm/index.js
@@ -0,0 +1,25 @@
+
+var assert = require('assert')
+
+var base62 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
+var base36 = 'abcdefghijklmnopqrstuvwxyz0123456789'
+var base10 = '0123456789'
+
+exports = module.exports = create(base62)
+exports.base62 = exports
+exports.base36 = create(base36)
+exports.base10 = create(base10)
+
+exports.create = create
+
+function create(chars) {
+ assert(typeof chars === 'string', 'the list of characters must be a string!')
+ var length = Buffer.byteLength(chars)
+ return function rndm(len) {
+ len = len || 10
+ assert(typeof len === 'number' && len >= 0, 'the length of the random string must be a number!')
+ var salt = ''
+ for (var i = 0; i < len; i++) salt += chars[Math.floor(length * Math.random())]
+ return salt
+ }
+}
diff --git a/node_modules/rndm/package.json b/node_modules/rndm/package.json
new file mode 100644
index 0000000..a53c74d
--- /dev/null
+++ b/node_modules/rndm/package.json
@@ -0,0 +1,99 @@
+{
+ "_args": [
+ [
+ "rndm@1.2.0",
+ "/home/humair/School/csc309/a4/solutions_repo/node_modules/csrf"
+ ]
+ ],
+ "_from": "rndm@1.2.0",
+ "_id": "rndm@1.2.0",
+ "_inCache": true,
+ "_installable": true,
+ "_location": "/rndm",
+ "_nodeVersion": "4.1.1",
+ "_npmUser": {
+ "email": "coderhaoxin@outlook.com",
+ "name": "coderhaoxin"
+ },
+ "_npmVersion": "2.14.4",
+ "_phantomChildren": {},
+ "_requested": {
+ "name": "rndm",
+ "raw": "rndm@1.2.0",
+ "rawSpec": "1.2.0",
+ "scope": null,
+ "spec": "1.2.0",
+ "type": "version"
+ },
+ "_requiredBy": [
+ "/csrf"
+ ],
+ "_resolved": "https://registry.npmjs.org/rndm/-/rndm-1.2.0.tgz",
+ "_shasum": "f33fe9cfb52bbfd520aa18323bc65db110a1b76c",
+ "_shrinkwrap": null,
+ "_spec": "rndm@1.2.0",
+ "_where": "/home/humair/School/csc309/a4/solutions_repo/node_modules/csrf",
+ "author": {
+ "email": "me@jongleberry.com",
+ "name": "Jonathan Ong",
+ "url": "http://jongleberry.com"
+ },
+ "bugs": {
+ "url": "https://github.com/crypto-utils/rndm/issues"
+ },
+ "dependencies": {},
+ "description": "random string generator",
+ "devDependencies": {
+ "istanbul": "0",
+ "mocha": "2"
+ },
+ "directories": {},
+ "dist": {
+ "shasum": "f33fe9cfb52bbfd520aa18323bc65db110a1b76c",
+ "tarball": "https://registry.npmjs.org/rndm/-/rndm-1.2.0.tgz"
+ },
+ "files": [
+ "index.js"
+ ],
+ "gitHead": "9d566c844a4c83487f3b2621be5b6588d5a2b617",
+ "homepage": "https://github.com/crypto-utils/rndm#readme",
+ "keywords": [
+ "generator",
+ "id",
+ "number",
+ "random",
+ "uid"
+ ],
+ "license": "MIT",
+ "maintainers": [
+ {
+ "name": "coderhaoxin",
+ "email": "coderhaoxin@outlook.com"
+ },
+ {
+ "name": "dougwilson",
+ "email": "doug@somethingdoug.com"
+ },
+ {
+ "name": "fishrock123",
+ "email": "fishrock123@rocketmail.com"
+ },
+ {
+ "name": "jongleberry",
+ "email": "jonathanrichardong@gmail.com"
+ }
+ ],
+ "name": "rndm",
+ "optionalDependencies": {},
+ "readme": "ERROR: No README data found!",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/crypto-utils/rndm.git"
+ },
+ "scripts": {
+ "test": "mocha",
+ "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot",
+ "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter dot"
+ },
+ "version": "1.2.0"
+}
diff --git a/node_modules/tsscmp/.npmignore b/node_modules/tsscmp/.npmignore
new file mode 100644
index 0000000..c2658d7
--- /dev/null
+++ b/node_modules/tsscmp/.npmignore
@@ -0,0 +1 @@
+node_modules/
diff --git a/node_modules/tsscmp/.travis.yml b/node_modules/tsscmp/.travis.yml
new file mode 100644
index 0000000..b85d89f
--- /dev/null
+++ b/node_modules/tsscmp/.travis.yml
@@ -0,0 +1,14 @@
+language: node_js
+node_js:
+ - "6"
+ - "5"
+ - "5.1"
+ - "4"
+ - "4.2"
+ - "4.1"
+ - "4.0"
+ - "0.12"
+ - "0.11"
+ - "0.10"
+ - "0.8"
+ - "0.6"
diff --git a/node_modules/tsscmp/LICENSE b/node_modules/tsscmp/LICENSE
new file mode 100644
index 0000000..c62e51b
--- /dev/null
+++ b/node_modules/tsscmp/LICENSE
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2016
+
+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/tsscmp/README.md b/node_modules/tsscmp/README.md
new file mode 100644
index 0000000..cba99d0
--- /dev/null
+++ b/node_modules/tsscmp/README.md
@@ -0,0 +1,48 @@
+# Timing safe string compare using double HMAC
+
+[![Node.js Version](https://img.shields.io/node/v/tsscmp.svg?style=flat-square)](https://nodejs.org/en/download)
+[![npm](https://img.shields.io/npm/v/tsscmp.svg?style=flat-square)](https://npmjs.org/package/tsscmp)
+[![NPM Downloads](https://img.shields.io/npm/dm/tsscmp.svg?style=flat-square)](https://npmjs.org/package/tsscmp)
+[![Build Status](https://img.shields.io/travis/suryagh/tsscmp/master.svg?style=flat-square)](https://travis-ci.org/suryagh/tsscmp)
+[![Build Status](https://img.shields.io/appveyor/ci/suryagh/tsscmp/master.svg?style=flat-square&label=windows)](https://ci.appveyor.com/project/suryagh/tsscmp)
+[![Dependency Status](http://img.shields.io/david/suryagh/tsscmp.svg?style=flat-square)](https://david-dm.org/suryagh/tsscmp)
+[![npm-license](http://img.shields.io/npm/l/tsscmp.svg?style=flat-square)](LICENSE)
+
+
+Prevents [timing attacks](http://codahale.com/a-lesson-in-timing-attacks/) using Brad Hill's
+[Double HMAC pattern](https://www.nccgroup.trust/us/about-us/newsroom-and-events/blog/2011/february/double-hmac-verification/)
+to perform secure string comparison. Double HMAC avoids the timing atacks by blinding the
+timing channel using random time per attempt comparison against iterative brute force attacks.
+
+
+## Install
+
+```
+npm install tsscmp
+```
+## Why
+To compare secret values like **authentication tokens**, **passwords** or
+**capability urls** so that timing information is not
+leaked to the attacker.
+
+## Example
+
+```js
+var timingSafeCompare = require('tsscmp');
+
+var sessionToken = '127e6fbfe24a750e72930c';
+var givenToken = '127e6fbfe24a750e72930c';
+
+if (timingSafeCompare(sessionToken, givenToken)) {
+ console.log('good token');
+} else {
+ console.log('bad token');
+}
+```
+##License:
+[MIT](LICENSE)
+
+**Credits to:** [@jsha](https://github.com/jsha) |
+[@bnoordhuis](https://github.com/bnoordhuis) |
+[@suryagh](https://github.com/suryagh) |
+ \ No newline at end of file
diff --git a/node_modules/tsscmp/appveyor.yml b/node_modules/tsscmp/appveyor.yml
new file mode 100644
index 0000000..29cd460
--- /dev/null
+++ b/node_modules/tsscmp/appveyor.yml
@@ -0,0 +1,29 @@
+# Test against this version of Node.js
+environment:
+ matrix:
+ # nodejs_version: "0.6" not supported in Windows x86
+ - nodejs_version: "0.8"
+ - nodejs_version: "0.10"
+ - nodejs_version: "0.11"
+ - nodejs_version: "0.12"
+ - nodejs_version: "4.0"
+ - nodejs_version: "5.0"
+ - nodejs_version: "6.0"
+
+# Install scripts. (runs after repo cloning)
+install:
+ # Get the latest stable version of Node.js or io.js
+ - ps: Install-Product node $env:nodejs_version
+ # install modules
+ - npm install
+
+# Post-install test scripts.
+test_script:
+ # Output useful info for debugging.
+ - node --version
+ - npm --version
+ # run tests
+ - npm test
+
+# Don't actually build.
+build: off
diff --git a/node_modules/tsscmp/lib/index.js b/node_modules/tsscmp/lib/index.js
new file mode 100644
index 0000000..7c86142
--- /dev/null
+++ b/node_modules/tsscmp/lib/index.js
@@ -0,0 +1,33 @@
+'use strict';
+
+// Implements Brad Hill's Double HMAC pattern from
+// https://www.nccgroup.trust/us/about-us/newsroom-and-events/blog/2011/february/double-hmac-verification/.
+// The approach is similar to the node's native implementation of timing safe buffer comparison that will be available on v6+.
+// https://github.com/nodejs/node/issues/3043
+// https://github.com/nodejs/node/pull/3073
+
+var crypto = require('crypto');
+
+function bufferEqual(a, b) {
+ if (a.length !== b.length) {
+ return false;
+ }
+ for (var i = 0; i < a.length; i++) {
+ if (a[i] !== b[i]) {
+ return false;
+ }
+ }
+ return true;
+}
+
+function timeSafeCompare(a, b) {
+ var sa = String(a);
+ var sb = String(b);
+ var key = crypto.pseudoRandomBytes(32);
+ var ah = crypto.createHmac('sha256', key).update(sa).digest();
+ var bh = crypto.createHmac('sha256', key).update(sb).digest();
+
+ return bufferEqual(ah, bh) && a === b;
+}
+
+module.exports = timeSafeCompare;
diff --git a/node_modules/tsscmp/package.json b/node_modules/tsscmp/package.json
new file mode 100644
index 0000000..f614168
--- /dev/null
+++ b/node_modules/tsscmp/package.json
@@ -0,0 +1,87 @@
+{
+ "_args": [
+ [
+ "tsscmp@1.0.5",
+ "/home/humair/School/csc309/a4/solutions_repo/node_modules/csrf"
+ ]
+ ],
+ "_from": "tsscmp@1.0.5",
+ "_id": "tsscmp@1.0.5",
+ "_inCache": true,
+ "_installable": true,
+ "_location": "/tsscmp",
+ "_nodeVersion": "5.6.0",
+ "_npmOperationalInternal": {
+ "host": "packages-16-east.internal.npmjs.com",
+ "tmp": "tmp/tsscmp-1.0.5.tgz_1464226502956_0.48576042777858675"
+ },
+ "_npmUser": {
+ "email": "surya.com@gmail.com",
+ "name": "suryagh"
+ },
+ "_npmVersion": "3.6.0",
+ "_phantomChildren": {},
+ "_requested": {
+ "name": "tsscmp",
+ "raw": "tsscmp@1.0.5",
+ "rawSpec": "1.0.5",
+ "scope": null,
+ "spec": "1.0.5",
+ "type": "version"
+ },
+ "_requiredBy": [
+ "/csrf"
+ ],
+ "_resolved": "https://registry.npmjs.org/tsscmp/-/tsscmp-1.0.5.tgz",
+ "_shasum": "7dc4a33af71581ab4337da91d85ca5427ebd9a97",
+ "_shrinkwrap": null,
+ "_spec": "tsscmp@1.0.5",
+ "_where": "/home/humair/School/csc309/a4/solutions_repo/node_modules/csrf",
+ "author": {
+ "name": "suryagh"
+ },
+ "bugs": {
+ "url": "https://github.com/suryagh/tsscmp/issues"
+ },
+ "dependencies": {},
+ "description": "Timing safe string compare using double HMAC",
+ "devDependencies": {},
+ "directories": {},
+ "dist": {
+ "shasum": "7dc4a33af71581ab4337da91d85ca5427ebd9a97",
+ "tarball": "https://registry.npmjs.org/tsscmp/-/tsscmp-1.0.5.tgz"
+ },
+ "engines": {
+ "node": ">=0.6.x"
+ },
+ "gitHead": "095fb02b3e6102cbd1d2bdc9613e3da54e782f59",
+ "homepage": "https://github.com/suryagh/tsscmp#readme",
+ "keywords": [
+ "double hmac string compare",
+ "hmac",
+ "safe string compare",
+ "timing safe string compare"
+ ],
+ "license": "MIT",
+ "main": "lib/index.js",
+ "maintainers": [
+ {
+ "name": "suryagh",
+ "email": "surya.com@gmail.com"
+ }
+ ],
+ "name": "tsscmp",
+ "optionalDependencies": {},
+ "publishConfig": {
+ "registry": "https://registry.npmjs.org"
+ },
+ "readme": "ERROR: No README data found!",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/suryagh/tsscmp.git"
+ },
+ "scripts": {
+ "test": "node test/unit && node test/benchmark"
+ },
+ "version": "1.0.5"
+}
diff --git a/node_modules/tsscmp/test/benchmark/index.js b/node_modules/tsscmp/test/benchmark/index.js
new file mode 100644
index 0000000..fd93e42
--- /dev/null
+++ b/node_modules/tsscmp/test/benchmark/index.js
@@ -0,0 +1,30 @@
+'use strict';
+
+var timeSafeCompare = require('../../lib/index');
+
+function random(length) {
+
+ length = length || 32;
+ var result = "";
+ var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()-+/*[]{}-=\|;\':\"<>?,./";
+
+ for( var i=0; i < length; i++ ){
+ result += possible.charAt(Math.floor(Math.random() * possible.length));
+ }
+ return result;
+}
+
+function run(count) {
+ count = count || 100*1000;
+ console.log('benchmark count: ' + count/1000 + 'k');
+ console.time('benchmark');
+
+ while(count--){
+ timeSafeCompare(random(), random());
+ }
+ console.timeEnd('benchmark');
+}
+
+run(100000);
+
+module.exports = run;
diff --git a/node_modules/tsscmp/test/unit/index.js b/node_modules/tsscmp/test/unit/index.js
new file mode 100644
index 0000000..0335423
--- /dev/null
+++ b/node_modules/tsscmp/test/unit/index.js
@@ -0,0 +1,69 @@
+'use strict';
+
+var assert = require('assert');
+var timeSafeCompare = require('../../lib/index');
+
+process.on('error', function (e) {
+ console.log('caught: ' + e);
+});
+
+function testEqual(a, b) {
+ assert(timeSafeCompare(a, b));
+
+ // lets also do a parity check with the strict equal to operator
+ assert(a === b);
+}
+
+function testNotEqual(a, b) {
+ assert(!timeSafeCompare(a, b));
+
+ // lets also do a parity check with the strict not equal to operator
+ assert(a !== b);
+}
+
+// note: lets also make sure tsscmp can be inline replaced for any types -
+// just incase if anyone is interested
+
+// positive tests
+testEqual('127e6fbfe24a750e72930c220a8e138275656b8e5d8f48a98c3c92df2caba935',
+ '127e6fbfe24a750e72930c220a8e138275656b8e5d8f48a98c3c92df2caba935',
+ 'test ');
+testEqual('a', 'a');
+testEqual('', '');
+testEqual(undefined, undefined);
+testEqual(true, true);
+testEqual(false, false);
+(function () {
+ var a = { a: 1 };
+ testEqual(a, a);
+})();
+(function () {
+ function f1() { return 1; };
+ testEqual(f1, f1);
+})();
+
+// negative tests
+testNotEqual('');
+testNotEqual('a', 'b');
+testNotEqual('a', 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
+testNotEqual('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'a');
+testNotEqual('alpha', 'beta');
+testNotEqual(false, true);
+testNotEqual(false, undefined);
+testNotEqual(function () { }, function () { });
+testNotEqual({}, {});
+testNotEqual({ a: 1 }, { a: 1 });
+testNotEqual({ a: 1 }, { a: 2 });
+testNotEqual([1, 2], [1, 2]);
+testNotEqual([1, 2], [1, 2, 3]);
+(function () {
+ var a = { p: 1 };
+ var b = { p: 1 };
+ testNotEqual(a, b);
+})();
+(function () {
+ function f1() { return 1; };
+ function f2() { return 1; };
+ testNotEqual(f1, f2);
+})();
+console.log('Success: all tests complete.');
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"
+}
diff --git a/node_simple.js b/node_simple.js
index 33e9862..b611302 100644
--- a/node_simple.js
+++ b/node_simple.js
@@ -54,8 +54,8 @@ var mongoFactory = require('mongo-factory');
var ObjectId = require('mongodb').ObjectID;
// Standard URI format: mongodb://[dbuser:dbpassword@]host:port/dbname
-var uri = 'mongodb://general:assignment4@ds057862.mlab.com:57862/solutions_repo';
-
+//var uri = 'mongodb://general:assignment4@ds057862.mlab.com:57862/solutions_repo';
+var uri = 'mongodb://localhost:27017/db';
//***********************PRELIMINARY TESTING******************************************|
diff --git a/package.json b/package.json
index 6a63d65..8932e0c 100644
--- a/package.json
+++ b/package.json
@@ -19,13 +19,17 @@
"homepage": "https://github.com/HumairAK/solutions_repo#readme",
"dependencies": {
"body-parser": "^1.15.2",
+ "connect-flash": "^0.1.1",
"cookie-parser": "^1.4.3",
+ "csurf": "^1.9.0",
"debug": "^2.2.0",
"express": "^4.14.0",
"express-handlebars": "^3.0.0",
+ "express-session": "^1.14.0",
"mongo-factory": "^1.0.0",
"mongodb": "^2.2.2",
"object-assign": "^4.1.0",
+ "passport": "^0.3.2",
"sanitizer": "^0.1.3"
}
}
diff --git a/routes/index.js b/routes/index.js
index 16f5778..ff7de10 100644
--- a/routes/index.js
+++ b/routes/index.js
@@ -59,10 +59,11 @@ router.get('/exams/:id', function(req, res, next) {
//console.log(exams);
//only pass over the information that is necessary for the exams page
for (var i = 0; i<exams.length;i++){
+ var getInstructors = exams[i].instructors.join(", ");
var minExamInfo = { courseCode:exams[i].course_code,
year:exams[i].year,
term:toProperCase(exams[i].term),
- instructors:exams[i].instructors,
+ instructors: getInstructors,
type:toProperCase(exams[i].type) + " Examination",
title:exams[i].title,
id:exams[i]._id
@@ -72,7 +73,7 @@ router.get('/exams/:id', function(req, res, next) {
}
}
console.log(minExamInfoArray);
- res.render('exams', {query: minExamInfoArray});
+ res.render('exams', {query: req.params.id, result: minExamInfoArray});
});
});
diff --git a/views/exams.hbs b/views/exams.hbs
index fc9e7d5..5a5955c 100644
--- a/views/exams.hbs
+++ b/views/exams.hbs
@@ -1,40 +1,18 @@
<main id = 'solutions-main'>
<div class = 'search container' id = 'solutions-div'>
- <h4 class='search-head'>Search results for "{{query}}"</h4>
+ <h4 class='search-head'>Search results for "{{query}}"</h4>
+ {{# each result}}
<a href="/questions">
- <section class = 'solutions-card'>
- <h3 class = 'solutions-title'>CSC148 - Introduction to Computer Science</h3>
- <p class = 'solutions-time' ><em>Term: </em>Winter 2015</p>
- <p class = 'exam-instr'><em>Instructors: </em>Fairgrieve and Hangerman</p>
- <p class = 'solutions-type'>Final Examination</p>
- </section>
+ <section class = 'solutions-card'>
+ <h3 class = 'solutions-title'>{{this.title}}</h3>
+ <p class = 'solutions-time' ><em>Term: </em>{{this.term}} {{this.year}}</p>
+ <p class = 'exam-instr'><em>Instructors: </em>
+ {{this.instructors}}
+ </p>
+ <p class = 'solutions-type'>{{result.type}}</p>
+ </section>
</a>
+ {{/each}}
- <a href="/questions">
- <section class = 'solutions-card'>
- <h3 class = 'solutions-title'>CSC148 - Introduction to Computer Science</h3>
- <p class = 'solutions-time' ><em>Term: </em>Fall 2014</p>
- <p class = 'exam-instr'><em>Instructors: </em>Campbell and Fairgrieve</p>
- <p class = 'solutions-type'>Midterm Examination</p>
- </section>
- </a>
-
- <a href="/questions">
- <section class = 'solutions-card'>
- <h3 class = 'solutions-title'>CSC148 - Introduction to Computer Science</h3>
- <p class = 'solutions-time' ><em>Term: </em>Winter 2014</p>
- <p class = 'exam-instr'><em>Instructors: </em>Campbell and Papadopoulou</p>
- <p class = 'solutions-type'>Final Examination</p>
- </section>
- </a>
-
- <a href="/questions">
- <section class = 'solutions-card'>
- <h3 class = 'solutions-title'>CSC148 - Introduction to Computer Science</h3>
- <p class = 'solutions-time' ><em>Term: </em>Fall 2013</p>
- <p class = 'exam-instr'><em>Instructors: </em>Craig and Gries</p>
- <p class = 'solutions-type'>Final Examination</p>
- </section>
- </a>
</div>
</main>