Used ejs to conditionally render login/logout text. Main index file is now index.ejs
This commit is contained in:
4
node_modules/random-bytes/HISTORY.md
generated
vendored
Normal file
4
node_modules/random-bytes/HISTORY.md
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
1.0.0 / 2016-01-17
|
||||
==================
|
||||
|
||||
* Initial release
|
21
node_modules/random-bytes/LICENSE
generated
vendored
Normal file
21
node_modules/random-bytes/LICENSE
generated
vendored
Normal file
@@ -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.
|
77
node_modules/random-bytes/README.md
generated
vendored
Normal file
77
node_modules/random-bytes/README.md
generated
vendored
Normal file
@@ -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
|
101
node_modules/random-bytes/index.js
generated
vendored
Normal file
101
node_modules/random-bytes/index.js
generated
vendored
Normal file
@@ -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)
|
||||
})
|
||||
}
|
36
node_modules/random-bytes/package.json
generated
vendored
Normal file
36
node_modules/random-bytes/package.json
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"name": "random-bytes",
|
||||
"description": "URL and cookie safe UIDs",
|
||||
"version": "1.0.0",
|
||||
"contributors": [
|
||||
"Douglas Christopher Wilson <doug@somethingdoug.com>"
|
||||
],
|
||||
"license": "MIT",
|
||||
"repository": "crypto-utils/random-bytes",
|
||||
"devDependencies": {
|
||||
"bluebird": "3.1.1",
|
||||
"istanbul": "0.4.2",
|
||||
"mocha": "2.3.4",
|
||||
"proxyquire": "1.2.0"
|
||||
},
|
||||
"files": [
|
||||
"LICENSE",
|
||||
"HISTORY.md",
|
||||
"README.md",
|
||||
"index.js"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
},
|
||||
"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/"
|
||||
},
|
||||
"keywords": [
|
||||
"bytes",
|
||||
"generator",
|
||||
"random",
|
||||
"safe"
|
||||
]
|
||||
}
|
Reference in New Issue
Block a user