client manager complete, client and client channels next
This commit is contained in:
parent
97ed2476f4
commit
8fa7f98493
6
dist/server/channelManager.js
vendored
Normal file
6
dist/server/channelManager.js
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
"use strict";
|
||||
class ChannelManager {
|
||||
}
|
||||
;
|
||||
module.exports = ChannelManager;
|
||||
//# sourceMappingURL=channelManager.js.map
|
1
dist/server/channelManager.js.map
vendored
Normal file
1
dist/server/channelManager.js.map
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"channelManager.js","sourceRoot":"","sources":["../../src/channelManager.ts"],"names":[],"mappings":";AAAA,MAAM,cAAc;CAEnB;AAAA,CAAC;AAEF,MAAM,CAAC,OAAO,GAAG,cAAc,CAAC"}
|
20
dist/server/clientManager.js
vendored
Normal file
20
dist/server/clientManager.js
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
"use strict";
|
||||
class ClientManager {
|
||||
constructor(data, ws) {
|
||||
this.ws = ws;
|
||||
this.client(data);
|
||||
}
|
||||
client(data) {
|
||||
if (data.site) {
|
||||
console.log('legit: ' + data.site);
|
||||
}
|
||||
else {
|
||||
console.log('no client type designated, socket disconnect.');
|
||||
this.ws.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
;
|
||||
module.exports = ClientManager;
|
||||
// user_type: 'user', user_id: 125, site: 'mhs' }
|
||||
//# sourceMappingURL=clientManager.js.map
|
1
dist/server/clientManager.js.map
vendored
Normal file
1
dist/server/clientManager.js.map
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"clientManager.js","sourceRoot":"","sources":["../../src/clientManager.ts"],"names":[],"mappings":";AAAA,MAAM,aAAa;IAGjB,YAAY,IAAY,EAAE,EAAU;QAClC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC;IAED,MAAM,CAAC,IAAS;QACd,IAAI,IAAI,CAAC,IAAI,EAAE;YACb,OAAO,CAAC,GAAG,CAAC,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,CAAA;SACnC;aAAM;YACL,OAAO,CAAC,GAAG,CAAC,+CAA+C,CAAC,CAAA;YAC5D,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC;SACjB;IACH,CAAC;CACF;AAAA,CAAC;AAEF,MAAM,CAAC,OAAO,GAAG,aAAa,CAAC;AAG9B,iDAAiD"}
|
17
dist/server/config/app.js
vendored
Normal file
17
dist/server/config/app.js
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
module.exports = {
|
||||
version: '0.2.1',
|
||||
whitelist: (process.env.WHITELIST || "http://admin.localhost").split(','),
|
||||
secret: process.env.API_TOKEN || "test",
|
||||
devToken: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkYXRhIjoidGVzdCBkYXRhIiwiYXVkIjoiaW50ZXJuYWwiLCJpc3MiOiJZYXJkc3RpY2sgU29mdHdhcmUiLCJzdWIiOiJCcmFpZCBKV1QifQ.t6LFXWPEVz3aLXwtrucarggqTkGY_2NnZB8ZTMaJ2oI',
|
||||
port: process.env.PORT || 8443,
|
||||
hostname: process.env.HOSTNAME || 'ysbraid.localhost',
|
||||
environment: process.env.ENVIRONMENT || 'development',
|
||||
signOptions: {
|
||||
issuer: 'Yardstick Software',
|
||||
subject: 'Braid JWT',
|
||||
audience: 'internal',
|
||||
algorithm: ["HS256"]
|
||||
}
|
||||
};
|
||||
//# sourceMappingURL=app.js.map
|
1
dist/server/config/app.js.map
vendored
Normal file
1
dist/server/config/app.js.map
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../../src/config/app.ts"],"names":[],"mappings":";AAAA,MAAM,CAAC,OAAO,GAAG;IACf,OAAO,EAAG,OAAO;IACjB,SAAS,EAAG,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,wBAAwB,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC;IAC1E,MAAM,EAAG,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,MAAM;IACxC,QAAQ,EAAE,iMAAiM;IAC3M,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,IAAI;IAC9B,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,mBAAmB;IACrD,WAAW,EAAE,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,aAAa;IACrD,WAAW,EAAG;QACZ,MAAM,EAAG,oBAAoB;QAC7B,OAAO,EAAG,WAAW;QACrB,QAAQ,EAAG,UAAU;QACrB,SAAS,EAAG,CAAC,OAAO,CAAC;KACtB;CACF,CAAA"}
|
8
dist/server/controllers/appController.js
vendored
Normal file
8
dist/server/controllers/appController.js
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
"use strict";
|
||||
var app = require('../config/app');
|
||||
module.exports = {
|
||||
home: (req, res) => {
|
||||
res.send(`Welcome to Braid v${app.version}`);
|
||||
}
|
||||
};
|
||||
//# sourceMappingURL=appController.js.map
|
1
dist/server/controllers/appController.js.map
vendored
Normal file
1
dist/server/controllers/appController.js.map
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"appController.js","sourceRoot":"","sources":["../../../src/controllers/appController.ts"],"names":[],"mappings":";AAAA,IAAI,GAAG,GAAG,OAAO,CAAC,eAAe,CAAC,CAAA;AAElC,MAAM,CAAC,OAAO,GAAG;IACf,IAAI,EAAG,CAAC,GAAQ,EAAE,GAAQ,EAAE,EAAE;QAC5B,GAAG,CAAC,IAAI,CAAC,qBAAqB,GAAG,CAAC,OAAO,EAAE,CAAC,CAAA;IAC9C,CAAC;CACF,CAAA"}
|
13
dist/server/controllers/authController.js
vendored
Normal file
13
dist/server/controllers/authController.js
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const jwt = require("jsonwebtoken");
|
||||
var app = require('../config/app');
|
||||
module.exports = {
|
||||
confirmToken: (req, res) => {
|
||||
var token = req.body.token;
|
||||
res.json({
|
||||
response: JSON.stringify(jwt.verify(token, app.secret, app.signOptions))
|
||||
});
|
||||
}
|
||||
};
|
||||
//# sourceMappingURL=authController.js.map
|
1
dist/server/controllers/authController.js.map
vendored
Normal file
1
dist/server/controllers/authController.js.map
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"authController.js","sourceRoot":"","sources":["../../../src/controllers/authController.ts"],"names":[],"mappings":";;AAAA,oCAAoC;AAEpC,IAAI,GAAG,GAAG,OAAO,CAAC,eAAe,CAAC,CAAA;AAElC,MAAM,CAAC,OAAO,GAAG;IACf,YAAY,EAAG,CAAC,GAAQ,EAAE,GAAQ,EAAE,EAAE;QACpC,IAAI,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,KAAK,CAAA;QAC1B,GAAG,CAAC,IAAI,CAAC;YACP,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC;SACzE,CAAC,CAAC;IACL,CAAC;CACF,CAAA"}
|
24
dist/server/routes.js
vendored
Normal file
24
dist/server/routes.js
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const cors = require("cors");
|
||||
const express = require("express");
|
||||
var app = require('./config/app');
|
||||
var corsOptions = {
|
||||
origin: (origin, callback) => {
|
||||
if (app.whitelist.indexOf(origin) !== -1) {
|
||||
callback(null, true);
|
||||
}
|
||||
else {
|
||||
callback(new Error(`Not allowed by CORS. Origin: ${origin}`));
|
||||
}
|
||||
}
|
||||
};
|
||||
var router = express.Router();
|
||||
//application
|
||||
var appController = require('./controllers/appController');
|
||||
router.route(['/', '/home']).get(appController.home);
|
||||
//auth
|
||||
var authController = require('./controllers/authController');
|
||||
router.route('/auth/user').post(cors(corsOptions), authController.confirmToken);
|
||||
module.exports = router;
|
||||
//# sourceMappingURL=routes.js.map
|
1
dist/server/routes.js.map
vendored
Normal file
1
dist/server/routes.js.map
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"routes.js","sourceRoot":"","sources":["../../src/routes.ts"],"names":[],"mappings":";;AAAA,6BAA6B;AAC7B,mCAAmC;AAEnC,IAAI,GAAG,GAAG,OAAO,CAAC,cAAc,CAAC,CAAA;AACjC,IAAI,WAAW,GAAG;IAChB,MAAM,EAAE,CAAC,MAAc,EAAE,QAAkB,EAAE,EAAE;QAC7C,IAAI,GAAG,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE;YACxC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;SACrB;aAAM;YACL,QAAQ,CAAC,IAAI,KAAK,CAAC,gCAAgC,MAAM,EAAE,CAAC,CAAC,CAAA;SAC9D;IACH,CAAC;CACF,CAAA;AAED,IAAI,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;AAE9B,aAAa;AACb,IAAI,aAAa,GAAG,OAAO,CAAC,6BAA6B,CAAC,CAAC;AAC3D,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,aAAa,CAAC,IAAI,CAAC,CAAA;AAEpD,MAAM;AACN,IAAI,cAAc,GAAG,OAAO,CAAC,8BAA8B,CAAC,CAAC;AAC7D,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,cAAc,CAAC,YAAY,CAAC,CAAC;AAEhF,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC"}
|
100
dist/server/server.js
vendored
100
dist/server/server.js
vendored
@ -1,41 +1,87 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//external imports
|
||||
const express = require("express");
|
||||
const https = require("https");
|
||||
const WebSocket = require("ws");
|
||||
const fs = require("fs");
|
||||
const jwt = require("jsonwebtoken");
|
||||
const url = require("url");
|
||||
//internal imports
|
||||
var routes = require('./routes');
|
||||
var app = require('./config/app');
|
||||
var privateKey = fs.readFileSync('certs/key.pem', 'utf8');
|
||||
var certificate = fs.readFileSync('certs/cert.pem', 'utf8');
|
||||
var credentials = { key: privateKey, cert: certificate };
|
||||
const app = express();
|
||||
const server = https.createServer(credentials, app);
|
||||
const wss = new WebSocket.Server({ server, maxPayload: 250000 });
|
||||
wss.on('connection', (ws) => {
|
||||
var options = { key: privateKey, cert: certificate, hostname: app.hostname };
|
||||
const application = express();
|
||||
const server = https.createServer(options, application);
|
||||
const wss = new WebSocket.Server({ noServer: true, maxPayload: 250000, host: app.hostname });
|
||||
application.use(express.json());
|
||||
application.use('', routes);
|
||||
wss.on('connection', (ws, request, args) => {
|
||||
console.log('client connected');
|
||||
ws.on('message', (message) => {
|
||||
console.log('received: %s', message);
|
||||
const broadcastRegex = /^broadcast\:/;
|
||||
if (broadcastRegex.test(message)) {
|
||||
message = message.replace(broadcastRegex, '');
|
||||
//send back the message to the other clients
|
||||
wss.clients
|
||||
.forEach(client => {
|
||||
if (client != ws) {
|
||||
client.send(`Hello, broadcast message -> ${message}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
ws.send(`Hello, you sent -> ${message}`);
|
||||
}
|
||||
});
|
||||
var data = JSON.parse(args).data;
|
||||
var ClientManager = require('./clientManager');
|
||||
let clientManager = new ClientManager(data, ws);
|
||||
// ws.on('message', (message: string) => {
|
||||
// console.log('received: %s', message);
|
||||
// const broadcastRegex = /^broadcast\:/;
|
||||
// if (broadcastRegex.test(message)) {
|
||||
// message = message.replace(broadcastRegex, '');
|
||||
// //send back the message to the other clients
|
||||
// wss.clients
|
||||
// .forEach(client => {
|
||||
// if (client != ws) {
|
||||
// client.send(`Hello, broadcast message -> ${message}`);
|
||||
// }
|
||||
// });
|
||||
// } else {
|
||||
// ws.send(`Hello, you sent -> ${message}`);
|
||||
// }
|
||||
// });
|
||||
ws.send('Hi there, welcome to braid, Measures Web Socket server.\nConnecting all our services!');
|
||||
});
|
||||
// start our server
|
||||
server.listen(process.env.PORT || 8443, () => {
|
||||
console.log(`Server started :)`);
|
||||
server.on('upgrade', function upgrade(request, socket, head) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let args;
|
||||
try {
|
||||
args = yield verifyConnection();
|
||||
}
|
||||
catch (e) {
|
||||
socket.destroy();
|
||||
console.log('connection terminated.');
|
||||
return;
|
||||
}
|
||||
function verifyConnection() {
|
||||
return new Promise((resolve, reject) => {
|
||||
var data = url.parse(request.url, true).query;
|
||||
var token = data["token"] || (app.environment == 'development' ? app.devToken : '');
|
||||
var accepted = true;
|
||||
var result;
|
||||
jwt.verify(token, app.secret, app.signOptions, function (err, decoded) {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
accepted = false;
|
||||
}
|
||||
result = JSON.stringify(decoded);
|
||||
accepted ? resolve(result) : reject('rejected');
|
||||
});
|
||||
});
|
||||
}
|
||||
wss.handleUpgrade(request, socket, head, function done(ws) {
|
||||
wss.emit('connection', ws, request, args);
|
||||
});
|
||||
});
|
||||
});
|
||||
app.get('/', (req, res) => {
|
||||
res.send('Braid v0.1.2 is running!\n');
|
||||
server.listen(app.port, () => {
|
||||
console.log(`Braid v${app.version} is running!\n`);
|
||||
});
|
||||
//# sourceMappingURL=server.js.map
|
2
dist/server/server.js.map
vendored
2
dist/server/server.js.map
vendored
@ -1 +1 @@
|
||||
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/server.ts"],"names":[],"mappings":";;AAAA,mCAAmC;AACnC,+BAA+B;AAC/B,gCAAgC;AAChC,yBAAyB;AAEzB,IAAI,UAAU,GAAI,EAAE,CAAC,YAAY,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC;AAC3D,IAAI,WAAW,GAAG,EAAE,CAAC,YAAY,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC;AAC5D,IAAI,WAAW,GAAG,EAAC,GAAG,EAAE,UAAU,EAAE,IAAI,EAAE,WAAW,EAAC,CAAC;AAEvD,MAAM,GAAG,GAAG,OAAO,EAAE,CAAC;AACtB,MAAM,MAAM,GAAG,KAAK,CAAC,YAAY,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;AACpD,MAAM,GAAG,GAAG,IAAI,SAAS,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,UAAU,EAAC,MAAM,EAAE,CAAC,CAAC;AAEhE,GAAG,CAAC,EAAE,CAAC,YAAY,EAAE,CAAC,EAAa,EAAE,EAAE;IACnC,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAA;IAE/B,EAAE,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,OAAe,EAAE,EAAE;QAEjC,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;QAErC,MAAM,cAAc,GAAG,cAAc,CAAC;QAEtC,IAAI,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE;YAC9B,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC;YAE9C,4CAA4C;YAC5C,GAAG,CAAC,OAAO;iBACN,OAAO,CAAC,MAAM,CAAC,EAAE;gBACd,IAAI,MAAM,IAAI,EAAE,EAAE;oBACd,MAAM,CAAC,IAAI,CAAC,+BAA+B,OAAO,EAAE,CAAC,CAAC;iBACzD;YACL,CAAC,CAAC,CAAC;SAEV;aAAM;YACH,EAAE,CAAC,IAAI,CAAC,sBAAsB,OAAO,EAAE,CAAC,CAAC;SAC5C;IACL,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,IAAI,CAAC,uFAAuF,CAAC,CAAC;AACrG,CAAC,CAAC,CAAC;AAEH,mBAAmB;AACnB,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,IAAI,EAAE,GAAG,EAAE;IACzC,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;AACrC,CAAC,CAAC,CAAC;AAEH,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;IACxB,GAAG,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC;AACzC,CAAC,CAAC,CAAC"}
|
||||
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/server.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,kBAAkB;AAClB,mCAAmC;AACnC,+BAA+B;AAC/B,gCAAgC;AAChC,yBAAyB;AACzB,oCAAoC;AACpC,2BAA2B;AAE3B,kBAAkB;AAClB,IAAI,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AACjC,IAAI,GAAG,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;AAElC,IAAI,UAAU,GAAI,EAAE,CAAC,YAAY,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC;AAC3D,IAAI,WAAW,GAAG,EAAE,CAAC,YAAY,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC;AAC5D,IAAI,OAAO,GAAG,EAAC,GAAG,EAAE,UAAU,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,GAAG,CAAC,QAAQ,EAAC,CAAC;AAE3E,MAAM,WAAW,GAAG,OAAO,EAAE,CAAC;AAC9B,MAAM,MAAM,GAAG,KAAK,CAAC,YAAY,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;AACxD,MAAM,GAAG,GAAG,IAAI,SAAS,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAC,MAAM,EAAE,IAAI,EAAE,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;AAE5F,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;AAChC,WAAW,CAAC,GAAG,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;AAE5B,GAAG,CAAC,EAAE,CAAC,YAAY,EAAE,CAAC,EAAa,EAAE,OAAe,EAAE,IAAY,EAAE,EAAE;IACpE,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;IAChC,IAAI,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAA;IAChC,IAAI,aAAa,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAC/C,IAAI,aAAa,GAAG,IAAI,aAAa,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IAEhD,0CAA0C;IAE1C,0CAA0C;IAE1C,2CAA2C;IAE3C,wCAAwC;IACxC,qDAAqD;IAErD,mDAAmD;IACnD,kBAAkB;IAClB,6BAA6B;IAC7B,8BAA8B;IAC9B,mEAAmE;IACnE,YAAY;IACZ,YAAY;IAEZ,aAAa;IACb,gDAAgD;IAChD,MAAM;IACN,MAAM;IAEN,EAAE,CAAC,IAAI,CAAC,uFAAuF,CAAC,CAAC;AACnG,CAAC,CAAC,CAAC;AAEH,MAAM,CAAC,EAAE,CAAC,SAAS,EAAE,SAAe,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI;;QAC/D,IAAI,IAAQ,CAAC;QAEb,IAAI;YACF,IAAI,GAAG,MAAM,gBAAgB,EAAE,CAAA;SAChC;QAAC,OAAO,CAAC,EAAE;YACV,MAAM,CAAC,OAAO,EAAE,CAAC;YACjB,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC;YACtC,OAAO;SACR;QAED,SAAS,gBAAgB;YACvB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;gBACrC,IAAI,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,KAAK,CAAC;gBAC9C,IAAI,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,WAAW,IAAI,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;gBACpF,IAAI,QAAQ,GAAG,IAAI,CAAC;gBACpB,IAAI,MAAc,CAAC;gBAEnB,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,WAAW,EAAE,UAAS,GAAG,EAAE,OAAO;oBAClE,IAAI,GAAG,EAAE;wBACP,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;wBACjB,QAAQ,GAAG,KAAK,CAAC;qBAClB;oBAED,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAA;oBAChC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;gBAClD,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC;QAED,GAAG,CAAC,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,IAAI,CAAC,EAAE;YACvD,GAAG,CAAC,IAAI,CAAC,YAAY,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;QAC5C,CAAC,CAAC,CAAC;IACL,CAAC;CAAA,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,EAAE;IAC3B,OAAO,CAAC,GAAG,CAAC,UAAU,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC;AACrD,CAAC,CAAC,CAAC"}
|
@ -5,5 +5,7 @@ braid:
|
||||
MEASURE_BASE_URL: http://admin.localhost
|
||||
dns:
|
||||
- 172.17.0.1
|
||||
ports:
|
||||
- "8443"
|
||||
volumes:
|
||||
- /apps/braid:/app
|
||||
|
1
node_modules/.bin/semver
generated
vendored
Symbolic link
1
node_modules/.bin/semver
generated
vendored
Symbolic link
@ -0,0 +1 @@
|
||||
../semver/bin/semver
|
21
node_modules/@types/cors/LICENSE
generated
vendored
Normal file
21
node_modules/@types/cors/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
|
||||
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
|
16
node_modules/@types/cors/README.md
generated
vendored
Normal file
16
node_modules/@types/cors/README.md
generated
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
# Installation
|
||||
> `npm install --save @types/cors`
|
||||
|
||||
# Summary
|
||||
This package contains type definitions for cors (https://github.com/troygoode/node-cors/).
|
||||
|
||||
# Details
|
||||
Files were exported from https://www.github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/cors
|
||||
|
||||
Additional Details
|
||||
* Last updated: Mon, 23 Apr 2018 15:06:47 GMT
|
||||
* Dependencies: express
|
||||
* Global values: none
|
||||
|
||||
# Credits
|
||||
These definitions were written by Alan Plum <https://github.com/pluma>.
|
34
node_modules/@types/cors/index.d.ts
generated
vendored
Normal file
34
node_modules/@types/cors/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
// Type definitions for cors 2.8
|
||||
// Project: https://github.com/troygoode/node-cors/
|
||||
// Definitions by: Alan Plum <https://github.com/pluma>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
import express = require('express');
|
||||
|
||||
type CustomOrigin = (
|
||||
requestOrigin: string,
|
||||
callback: (err: Error | null, allow?: boolean) => void
|
||||
) => void;
|
||||
|
||||
declare namespace e {
|
||||
interface CorsOptions {
|
||||
origin?: boolean | string | RegExp | (string | RegExp)[] | CustomOrigin;
|
||||
methods?: string | string[];
|
||||
allowedHeaders?: string | string[];
|
||||
exposedHeaders?: string | string[];
|
||||
credentials?: boolean;
|
||||
maxAge?: number;
|
||||
preflightContinue?: boolean;
|
||||
optionsSuccessStatus?: number;
|
||||
}
|
||||
type CorsOptionsDelegate = (
|
||||
req: express.Request,
|
||||
callback: (err: Error | null, options?: CorsOptions) => void
|
||||
) => void;
|
||||
}
|
||||
|
||||
declare function e(
|
||||
options?: e.CorsOptions | e.CorsOptionsDelegate
|
||||
): express.RequestHandler;
|
||||
export = e;
|
54
node_modules/@types/cors/package.json
generated
vendored
Normal file
54
node_modules/@types/cors/package.json
generated
vendored
Normal file
@ -0,0 +1,54 @@
|
||||
{
|
||||
"_from": "@types/cors",
|
||||
"_id": "@types/cors@2.8.4",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-ipZjBVsm2tF/n8qFGOuGBkUij9X9ZswVi9G3bx/6dz7POpVa6gVHcj1wsX/LVEn9MMF41fxK/PnZPPoTD1UFPw==",
|
||||
"_location": "/@types/cors",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "tag",
|
||||
"registry": true,
|
||||
"raw": "@types/cors",
|
||||
"name": "@types/cors",
|
||||
"escapedName": "@types%2fcors",
|
||||
"scope": "@types",
|
||||
"rawSpec": "",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "latest"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#DEV:/",
|
||||
"#USER"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.4.tgz",
|
||||
"_shasum": "50991a759a29c0b89492751008c6af7a7c8267b0",
|
||||
"_spec": "@types/cors",
|
||||
"_where": "/Users/josh.burman/Projects/braid",
|
||||
"bugs": {
|
||||
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Alan Plum",
|
||||
"url": "https://github.com/pluma"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"@types/express": "*"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "TypeScript definitions for cors",
|
||||
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped#readme",
|
||||
"license": "MIT",
|
||||
"main": "",
|
||||
"name": "@types/cors",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/DefinitelyTyped/DefinitelyTyped.git"
|
||||
},
|
||||
"scripts": {},
|
||||
"typeScriptVersion": "2.2",
|
||||
"typesPublisherContentHash": "c206254f8940d61a0375ce4f7a7d68e0ebf14d7b49b8abefec6375a8955615f7",
|
||||
"version": "2.8.4"
|
||||
}
|
21
node_modules/@types/jsonwebtoken/LICENSE
generated
vendored
Normal file
21
node_modules/@types/jsonwebtoken/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
|
||||
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
|
16
node_modules/@types/jsonwebtoken/README.md
generated
vendored
Normal file
16
node_modules/@types/jsonwebtoken/README.md
generated
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
# Installation
|
||||
> `npm install --save @types/jsonwebtoken`
|
||||
|
||||
# Summary
|
||||
This package contains type definitions for jsonwebtoken (https://github.com/auth0/node-jsonwebtoken).
|
||||
|
||||
# Details
|
||||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/jsonwebtoken
|
||||
|
||||
Additional Details
|
||||
* Last updated: Thu, 01 Nov 2018 23:52:59 GMT
|
||||
* Dependencies: node
|
||||
* Global values: none
|
||||
|
||||
# Credits
|
||||
These definitions were written by Maxime LUCE <https://github.com/SomaticIT>, Daniel Heim <https://github.com/danielheim>, Brice BERNARD <https://github.com/brikou>, Veli-Pekka Kestilä <https://github.com/vpk>, Daniel Parker <https://github.com/rlgod>.
|
187
node_modules/@types/jsonwebtoken/index.d.ts
generated
vendored
Normal file
187
node_modules/@types/jsonwebtoken/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,187 @@
|
||||
// Type definitions for jsonwebtoken 8.3
|
||||
// Project: https://github.com/auth0/node-jsonwebtoken
|
||||
// Definitions by: Maxime LUCE <https://github.com/SomaticIT>,
|
||||
// Daniel Heim <https://github.com/danielheim>,
|
||||
// Brice BERNARD <https://github.com/brikou>,
|
||||
// Veli-Pekka Kestilä <https://github.com/vpk>,
|
||||
// Daniel Parker <https://github.com/rlgod>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
export class JsonWebTokenError extends Error {
|
||||
inner: Error;
|
||||
|
||||
constructor(message: string, error?: Error);
|
||||
}
|
||||
|
||||
export class TokenExpiredError extends JsonWebTokenError {
|
||||
expiredAt: number;
|
||||
|
||||
constructor(message: string, expiredAt: number);
|
||||
}
|
||||
|
||||
export class NotBeforeError extends JsonWebTokenError {
|
||||
date: Date;
|
||||
|
||||
constructor(message: string, date: Date);
|
||||
}
|
||||
|
||||
export interface SignOptions {
|
||||
/**
|
||||
* Signature algorithm. Could be one of these values :
|
||||
* - HS256: HMAC using SHA-256 hash algorithm (default)
|
||||
* - HS384: HMAC using SHA-384 hash algorithm
|
||||
* - HS512: HMAC using SHA-512 hash algorithm
|
||||
* - RS256: RSASSA using SHA-256 hash algorithm
|
||||
* - RS384: RSASSA using SHA-384 hash algorithm
|
||||
* - RS512: RSASSA using SHA-512 hash algorithm
|
||||
* - ES256: ECDSA using P-256 curve and SHA-256 hash algorithm
|
||||
* - ES384: ECDSA using P-384 curve and SHA-384 hash algorithm
|
||||
* - ES512: ECDSA using P-521 curve and SHA-512 hash algorithm
|
||||
* - none: No digital signature or MAC value included
|
||||
*/
|
||||
algorithm?: string;
|
||||
keyid?: string;
|
||||
/** expressed in seconds or a string describing a time span [zeit/ms](https://github.com/zeit/ms.js). Eg: 60, "2 days", "10h", "7d" */
|
||||
expiresIn?: string | number;
|
||||
/** expressed in seconds or a string describing a time span [zeit/ms](https://github.com/zeit/ms.js). Eg: 60, "2 days", "10h", "7d" */
|
||||
notBefore?: string | number;
|
||||
audience?: string | string[];
|
||||
subject?: string;
|
||||
issuer?: string;
|
||||
jwtid?: string;
|
||||
noTimestamp?: boolean;
|
||||
header?: object;
|
||||
encoding?: string;
|
||||
}
|
||||
|
||||
export interface VerifyOptions {
|
||||
algorithms?: string[];
|
||||
audience?: string | string[];
|
||||
clockTimestamp?: number;
|
||||
clockTolerance?: number;
|
||||
issuer?: string | string[];
|
||||
ignoreExpiration?: boolean;
|
||||
ignoreNotBefore?: boolean;
|
||||
jwtid?: string;
|
||||
subject?: string;
|
||||
/**
|
||||
* @deprecated
|
||||
* Max age of token
|
||||
*/
|
||||
maxAge?: string;
|
||||
}
|
||||
|
||||
export interface DecodeOptions {
|
||||
complete?: boolean;
|
||||
json?: boolean;
|
||||
}
|
||||
export type VerifyErrors= JsonWebTokenError | NotBeforeError | TokenExpiredError;
|
||||
export type VerifyCallback = (
|
||||
err: VerifyErrors,
|
||||
decoded: object | string,
|
||||
) => void;
|
||||
|
||||
export type SignCallback = (
|
||||
err: Error, encoded: string
|
||||
) => void;
|
||||
|
||||
export interface JwtHeader {
|
||||
alg: string;
|
||||
typ?: string;
|
||||
kid?: string;
|
||||
jku?: string;
|
||||
x5u?: string;
|
||||
x5t?: string;
|
||||
}
|
||||
|
||||
export type SigningKeyCallback = (
|
||||
err: any,
|
||||
signingKey?: Secret,
|
||||
) => void;
|
||||
|
||||
export type GetPublicKeyOrSecret = (
|
||||
header: JwtHeader,
|
||||
callback: SigningKeyCallback
|
||||
) => void;
|
||||
|
||||
export type Secret = string | Buffer | { key: string; passphrase: string };
|
||||
|
||||
/**
|
||||
* Synchronously sign the given payload into a JSON Web Token string
|
||||
* payload - Payload to sign, could be an literal, buffer or string
|
||||
* secretOrPrivateKey - Either the secret for HMAC algorithms, or the PEM encoded private key for RSA and ECDSA.
|
||||
* [options] - Options for the signature
|
||||
* returns - The JSON Web Token string
|
||||
*/
|
||||
export function sign(
|
||||
payload: string | Buffer | object,
|
||||
secretOrPrivateKey: Secret,
|
||||
options?: SignOptions,
|
||||
): string;
|
||||
|
||||
/**
|
||||
* Sign the given payload into a JSON Web Token string
|
||||
* payload - Payload to sign, could be an literal, buffer or string
|
||||
* secretOrPrivateKey - Either the secret for HMAC algorithms, or the PEM encoded private key for RSA and ECDSA.
|
||||
* [options] - Options for the signature
|
||||
* callback - Callback to get the encoded token on
|
||||
*/
|
||||
export function sign(
|
||||
payload: string | Buffer | object,
|
||||
secretOrPrivateKey: Secret,
|
||||
callback: SignCallback,
|
||||
): void;
|
||||
export function sign(
|
||||
payload: string | Buffer | object,
|
||||
secretOrPrivateKey: Secret,
|
||||
options: SignOptions,
|
||||
callback: SignCallback,
|
||||
): void;
|
||||
|
||||
/**
|
||||
* Synchronously verify given token using a secret or a public key to get a decoded token
|
||||
* token - JWT string to verify
|
||||
* secretOrPublicKey - Either the secret for HMAC algorithms, or the PEM encoded public key for RSA and ECDSA.
|
||||
* [options] - Options for the verification
|
||||
* returns - The decoded token.
|
||||
*/
|
||||
export function verify(
|
||||
token: string,
|
||||
secretOrPublicKey: string | Buffer,
|
||||
options?: VerifyOptions,
|
||||
): object | string;
|
||||
|
||||
/**
|
||||
* Asynchronously verify given token using a secret or a public key to get a decoded token
|
||||
* token - JWT string to verify
|
||||
* secretOrPublicKey - A string or buffer containing either the secret for HMAC algorithms,
|
||||
* or the PEM encoded public key for RSA and ECDSA. If jwt.verify is called asynchronous,
|
||||
* secretOrPublicKey can be a function that should fetch the secret or public key
|
||||
* [options] - Options for the verification
|
||||
* callback - Callback to get the decoded token on
|
||||
*/
|
||||
export function verify(
|
||||
token: string,
|
||||
secretOrPublicKey: string | Buffer | GetPublicKeyOrSecret,
|
||||
callback?: VerifyCallback,
|
||||
): void;
|
||||
export function verify(
|
||||
token: string,
|
||||
secretOrPublicKey: string | Buffer | GetPublicKeyOrSecret,
|
||||
options?: VerifyOptions,
|
||||
callback?: VerifyCallback,
|
||||
): void;
|
||||
|
||||
/**
|
||||
* Returns the decoded payload without verifying if the signature is valid.
|
||||
* token - JWT string to decode
|
||||
* [options] - Options for decoding
|
||||
* returns - The decoded Token
|
||||
*/
|
||||
export function decode(
|
||||
token: string,
|
||||
options?: DecodeOptions,
|
||||
): null | { [key: string]: any } | string;
|
71
node_modules/@types/jsonwebtoken/package.json
generated
vendored
Normal file
71
node_modules/@types/jsonwebtoken/package.json
generated
vendored
Normal file
@ -0,0 +1,71 @@
|
||||
{
|
||||
"_from": "@types/jsonwebtoken",
|
||||
"_id": "@types/jsonwebtoken@8.3.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-YKnUTR4VxwljbPORPrRon9E3uel1aD8nUdvzqArCCdMTWPvo0gnI2UZkwIHN2QATdj6HYXV/Iq3/KcecAO42Ww==",
|
||||
"_location": "/@types/jsonwebtoken",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "tag",
|
||||
"registry": true,
|
||||
"raw": "@types/jsonwebtoken",
|
||||
"name": "@types/jsonwebtoken",
|
||||
"escapedName": "@types%2fjsonwebtoken",
|
||||
"scope": "@types",
|
||||
"rawSpec": "",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "latest"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#DEV:/",
|
||||
"#USER"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@types/jsonwebtoken/-/jsonwebtoken-8.3.0.tgz",
|
||||
"_shasum": "1fe79489df97b49273401ac3c8019cbf1dae4578",
|
||||
"_spec": "@types/jsonwebtoken",
|
||||
"_where": "/Users/josh.burman/Projects/braid",
|
||||
"bugs": {
|
||||
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Maxime LUCE",
|
||||
"url": "https://github.com/SomaticIT"
|
||||
},
|
||||
{
|
||||
"name": "Daniel Heim",
|
||||
"url": "https://github.com/danielheim"
|
||||
},
|
||||
{
|
||||
"name": "Brice BERNARD",
|
||||
"url": "https://github.com/brikou"
|
||||
},
|
||||
{
|
||||
"name": "Veli-Pekka Kestilä",
|
||||
"url": "https://github.com/vpk"
|
||||
},
|
||||
{
|
||||
"name": "Daniel Parker",
|
||||
"url": "https://github.com/rlgod"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"@types/node": "*"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "TypeScript definitions for jsonwebtoken",
|
||||
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped#readme",
|
||||
"license": "MIT",
|
||||
"main": "",
|
||||
"name": "@types/jsonwebtoken",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/DefinitelyTyped/DefinitelyTyped.git"
|
||||
},
|
||||
"scripts": {},
|
||||
"typeScriptVersion": "2.2",
|
||||
"types": "",
|
||||
"typesPublisherContentHash": "0c6eebd46a6b5087408b4ad4afa03e49ed368589c17d6b6134f16a6942fab234",
|
||||
"version": "8.3.0"
|
||||
}
|
0
node_modules/body-parser/HISTORY.md
generated
vendored
Executable file → Normal file
0
node_modules/body-parser/HISTORY.md
generated
vendored
Executable file → Normal file
0
node_modules/body-parser/LICENSE
generated
vendored
Executable file → Normal file
0
node_modules/body-parser/LICENSE
generated
vendored
Executable file → Normal file
0
node_modules/body-parser/README.md
generated
vendored
Executable file → Normal file
0
node_modules/body-parser/README.md
generated
vendored
Executable file → Normal file
0
node_modules/body-parser/index.js
generated
vendored
Executable file → Normal file
0
node_modules/body-parser/index.js
generated
vendored
Executable file → Normal file
0
node_modules/body-parser/lib/read.js
generated
vendored
Executable file → Normal file
0
node_modules/body-parser/lib/read.js
generated
vendored
Executable file → Normal file
0
node_modules/body-parser/lib/types/json.js
generated
vendored
Executable file → Normal file
0
node_modules/body-parser/lib/types/json.js
generated
vendored
Executable file → Normal file
0
node_modules/body-parser/lib/types/raw.js
generated
vendored
Executable file → Normal file
0
node_modules/body-parser/lib/types/raw.js
generated
vendored
Executable file → Normal file
0
node_modules/body-parser/lib/types/text.js
generated
vendored
Executable file → Normal file
0
node_modules/body-parser/lib/types/text.js
generated
vendored
Executable file → Normal file
0
node_modules/body-parser/lib/types/urlencoded.js
generated
vendored
Executable file → Normal file
0
node_modules/body-parser/lib/types/urlencoded.js
generated
vendored
Executable file → Normal file
16
node_modules/body-parser/package.json
generated
vendored
Executable file → Normal file
16
node_modules/body-parser/package.json
generated
vendored
Executable file → Normal file
@ -1,27 +1,29 @@
|
||||
{
|
||||
"_from": "body-parser@1.18.3",
|
||||
"_from": "body-parser@^1.18.3",
|
||||
"_id": "body-parser@1.18.3",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-WykhmP/dVTs6DyDe0FkrlWlVyLQ=",
|
||||
"_location": "/body-parser",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "body-parser@1.18.3",
|
||||
"raw": "body-parser@^1.18.3",
|
||||
"name": "body-parser",
|
||||
"escapedName": "body-parser",
|
||||
"rawSpec": "1.18.3",
|
||||
"rawSpec": "^1.18.3",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "1.18.3"
|
||||
"fetchSpec": "^1.18.3"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#USER",
|
||||
"/",
|
||||
"/express"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.3.tgz",
|
||||
"_shasum": "5b292198ffdd553b3a0f20ded0592b956955c8b4",
|
||||
"_spec": "body-parser@1.18.3",
|
||||
"_where": "/Users/josh.burman/Projects/braid/node_modules/express",
|
||||
"_spec": "body-parser@^1.18.3",
|
||||
"_where": "/Users/josh.burman/Projects/braid",
|
||||
"bugs": {
|
||||
"url": "https://github.com/expressjs/body-parser/issues"
|
||||
},
|
||||
|
2
node_modules/buffer-equal-constant-time/.npmignore
generated
vendored
Normal file
2
node_modules/buffer-equal-constant-time/.npmignore
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
.*.sw[mnop]
|
||||
node_modules/
|
4
node_modules/buffer-equal-constant-time/.travis.yml
generated
vendored
Normal file
4
node_modules/buffer-equal-constant-time/.travis.yml
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "0.11"
|
||||
- "0.10"
|
12
node_modules/buffer-equal-constant-time/LICENSE.txt
generated
vendored
Normal file
12
node_modules/buffer-equal-constant-time/LICENSE.txt
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
Copyright (c) 2013, GoInstant Inc., a salesforce.com company
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of salesforce.com, nor GoInstant, nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
50
node_modules/buffer-equal-constant-time/README.md
generated
vendored
Normal file
50
node_modules/buffer-equal-constant-time/README.md
generated
vendored
Normal file
@ -0,0 +1,50 @@
|
||||
# buffer-equal-constant-time
|
||||
|
||||
Constant-time `Buffer` comparison for node.js. Should work with browserify too.
|
||||
|
||||
[](https://travis-ci.org/goinstant/buffer-equal-constant-time)
|
||||
|
||||
```sh
|
||||
npm install buffer-equal-constant-time
|
||||
```
|
||||
|
||||
# Usage
|
||||
|
||||
```js
|
||||
var bufferEq = require('buffer-equal-constant-time');
|
||||
|
||||
var a = new Buffer('asdf');
|
||||
var b = new Buffer('asdf');
|
||||
if (bufferEq(a,b)) {
|
||||
// the same!
|
||||
} else {
|
||||
// different in at least one byte!
|
||||
}
|
||||
```
|
||||
|
||||
If you'd like to install an `.equal()` method onto the node.js `Buffer` and
|
||||
`SlowBuffer` prototypes:
|
||||
|
||||
```js
|
||||
require('buffer-equal-constant-time').install();
|
||||
|
||||
var a = new Buffer('asdf');
|
||||
var b = new Buffer('asdf');
|
||||
if (a.equal(b)) {
|
||||
// the same!
|
||||
} else {
|
||||
// different in at least one byte!
|
||||
}
|
||||
```
|
||||
|
||||
To get rid of the installed `.equal()` method, call `.restore()`:
|
||||
|
||||
```js
|
||||
require('buffer-equal-constant-time').restore();
|
||||
```
|
||||
|
||||
# Legal
|
||||
|
||||
© 2013 GoInstant Inc., a salesforce.com company
|
||||
|
||||
Licensed under the BSD 3-clause license.
|
41
node_modules/buffer-equal-constant-time/index.js
generated
vendored
Normal file
41
node_modules/buffer-equal-constant-time/index.js
generated
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
/*jshint node:true */
|
||||
'use strict';
|
||||
var Buffer = require('buffer').Buffer; // browserify
|
||||
var SlowBuffer = require('buffer').SlowBuffer;
|
||||
|
||||
module.exports = bufferEq;
|
||||
|
||||
function bufferEq(a, b) {
|
||||
|
||||
// shortcutting on type is necessary for correctness
|
||||
if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// buffer sizes should be well-known information, so despite this
|
||||
// shortcutting, it doesn't leak any information about the *contents* of the
|
||||
// buffers.
|
||||
if (a.length !== b.length) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var c = 0;
|
||||
for (var i = 0; i < a.length; i++) {
|
||||
/*jshint bitwise:false */
|
||||
c |= a[i] ^ b[i]; // XOR
|
||||
}
|
||||
return c === 0;
|
||||
}
|
||||
|
||||
bufferEq.install = function() {
|
||||
Buffer.prototype.equal = SlowBuffer.prototype.equal = function equal(that) {
|
||||
return bufferEq(this, that);
|
||||
};
|
||||
};
|
||||
|
||||
var origBufEqual = Buffer.prototype.equal;
|
||||
var origSlowBufEqual = SlowBuffer.prototype.equal;
|
||||
bufferEq.restore = function() {
|
||||
Buffer.prototype.equal = origBufEqual;
|
||||
SlowBuffer.prototype.equal = origSlowBufEqual;
|
||||
};
|
55
node_modules/buffer-equal-constant-time/package.json
generated
vendored
Normal file
55
node_modules/buffer-equal-constant-time/package.json
generated
vendored
Normal file
@ -0,0 +1,55 @@
|
||||
{
|
||||
"_from": "buffer-equal-constant-time@1.0.1",
|
||||
"_id": "buffer-equal-constant-time@1.0.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-+OcRMvf/5uAaXJaXpMbz5I1cyBk=",
|
||||
"_location": "/buffer-equal-constant-time",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "buffer-equal-constant-time@1.0.1",
|
||||
"name": "buffer-equal-constant-time",
|
||||
"escapedName": "buffer-equal-constant-time",
|
||||
"rawSpec": "1.0.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "1.0.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/jwa"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz",
|
||||
"_shasum": "f8e71132f7ffe6e01a5c9697a4c6f3e48d5cc819",
|
||||
"_spec": "buffer-equal-constant-time@1.0.1",
|
||||
"_where": "/Users/josh.burman/Projects/braid/node_modules/jwa",
|
||||
"author": {
|
||||
"name": "GoInstant Inc., a salesforce.com company"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/goinstant/buffer-equal-constant-time/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Constant-time comparison of Buffers",
|
||||
"devDependencies": {
|
||||
"mocha": "~1.15.1"
|
||||
},
|
||||
"homepage": "https://github.com/goinstant/buffer-equal-constant-time#readme",
|
||||
"keywords": [
|
||||
"buffer",
|
||||
"equal",
|
||||
"constant-time",
|
||||
"crypto"
|
||||
],
|
||||
"license": "BSD-3-Clause",
|
||||
"main": "index.js",
|
||||
"name": "buffer-equal-constant-time",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+ssh://git@github.com/goinstant/buffer-equal-constant-time.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha test.js"
|
||||
},
|
||||
"version": "1.0.1"
|
||||
}
|
42
node_modules/buffer-equal-constant-time/test.js
generated
vendored
Normal file
42
node_modules/buffer-equal-constant-time/test.js
generated
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
/*jshint node:true */
|
||||
'use strict';
|
||||
|
||||
var bufferEq = require('./index');
|
||||
var assert = require('assert');
|
||||
|
||||
describe('buffer-equal-constant-time', function() {
|
||||
var a = new Buffer('asdfasdf123456');
|
||||
var b = new Buffer('asdfasdf123456');
|
||||
var c = new Buffer('asdfasdf');
|
||||
|
||||
describe('bufferEq', function() {
|
||||
it('says a == b', function() {
|
||||
assert.strictEqual(bufferEq(a, b), true);
|
||||
});
|
||||
|
||||
it('says a != c', function() {
|
||||
assert.strictEqual(bufferEq(a, c), false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('install/restore', function() {
|
||||
before(function() {
|
||||
bufferEq.install();
|
||||
});
|
||||
after(function() {
|
||||
bufferEq.restore();
|
||||
});
|
||||
|
||||
it('installed an .equal method', function() {
|
||||
var SlowBuffer = require('buffer').SlowBuffer;
|
||||
assert.ok(Buffer.prototype.equal);
|
||||
assert.ok(SlowBuffer.prototype.equal);
|
||||
});
|
||||
|
||||
it('infected existing Buffers', function() {
|
||||
assert.strictEqual(a.equal(b), true);
|
||||
assert.strictEqual(a.equal(c), false);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
33
node_modules/cors/CONTRIBUTING.md
generated
vendored
Normal file
33
node_modules/cors/CONTRIBUTING.md
generated
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
# contributing to `cors`
|
||||
|
||||
CORS is a node.js package for providing a [connect](http://www.senchalabs.org/connect/)/[express](http://expressjs.com/) middleware that can be used to enable [CORS](http://en.wikipedia.org/wiki/Cross-origin_resource_sharing) with various options. Learn more about the project in [the README](README.md).
|
||||
|
||||
## The CORS Spec
|
||||
|
||||
[http://www.w3.org/TR/cors/](http://www.w3.org/TR/cors/)
|
||||
|
||||
## Pull Requests Welcome
|
||||
|
||||
* Include `'use strict';` in every javascript file.
|
||||
* 2 space indentation.
|
||||
* Please run the testing steps below before submitting.
|
||||
|
||||
## Testing
|
||||
|
||||
```bash
|
||||
$ npm install
|
||||
$ npm test
|
||||
```
|
||||
|
||||
## Interactive Testing Harness
|
||||
|
||||
[http://node-cors-client.herokuapp.com](http://node-cors-client.herokuapp.com)
|
||||
|
||||
Related git repositories:
|
||||
|
||||
* [https://github.com/TroyGoode/node-cors-server](https://github.com/TroyGoode/node-cors-server)
|
||||
* [https://github.com/TroyGoode/node-cors-client](https://github.com/TroyGoode/node-cors-client)
|
||||
|
||||
## License
|
||||
|
||||
[MIT License](http://www.opensource.org/licenses/mit-license.php)
|
58
node_modules/cors/HISTORY.md
generated
vendored
Normal file
58
node_modules/cors/HISTORY.md
generated
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
2.8.5 / 2018-11-04
|
||||
==================
|
||||
|
||||
* Fix setting `maxAge` option to `0`
|
||||
|
||||
2.8.4 / 2017-07-12
|
||||
==================
|
||||
|
||||
* Work-around Safari bug in default pre-flight response
|
||||
|
||||
2.8.3 / 2017-03-29
|
||||
==================
|
||||
|
||||
* Fix error when options delegate missing `methods` option
|
||||
|
||||
2.8.2 / 2017-03-28
|
||||
==================
|
||||
|
||||
* Fix error when frozen options are passed
|
||||
* Send "Vary: Origin" when using regular expressions
|
||||
* Send "Vary: Access-Control-Request-Headers" when dynamic `allowedHeaders`
|
||||
|
||||
2.8.1 / 2016-09-08
|
||||
==================
|
||||
|
||||
This release only changed documentation.
|
||||
|
||||
2.8.0 / 2016-08-23
|
||||
==================
|
||||
|
||||
* Add `optionsSuccessStatus` option
|
||||
|
||||
2.7.2 / 2016-08-23
|
||||
==================
|
||||
|
||||
* Fix error when Node.js running in strict mode
|
||||
|
||||
2.7.1 / 2015-05-28
|
||||
==================
|
||||
|
||||
* Move module into expressjs organization
|
||||
|
||||
2.7.0 / 2015-05-28
|
||||
==================
|
||||
|
||||
* Allow array of matching condition as `origin` option
|
||||
* Allow regular expression as `origin` option
|
||||
|
||||
2.6.1 / 2015-05-28
|
||||
==================
|
||||
|
||||
* Update `license` in package.json
|
||||
|
||||
2.6.0 / 2015-04-27
|
||||
==================
|
||||
|
||||
* Add `preflightContinue` option
|
||||
* Fix "Vary: Origin" header added for "*"
|
22
node_modules/cors/LICENSE
generated
vendored
Normal file
22
node_modules/cors/LICENSE
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2013 Troy Goode <troygoode@gmail.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.
|
243
node_modules/cors/README.md
generated
vendored
Normal file
243
node_modules/cors/README.md
generated
vendored
Normal file
@ -0,0 +1,243 @@
|
||||
# cors
|
||||
|
||||
[![NPM Version][npm-image]][npm-url]
|
||||
[![NPM Downloads][downloads-image]][downloads-url]
|
||||
[![Build Status][travis-image]][travis-url]
|
||||
[![Test Coverage][coveralls-image]][coveralls-url]
|
||||
|
||||
CORS is a node.js package for providing a [Connect](http://www.senchalabs.org/connect/)/[Express](http://expressjs.com/) middleware that can be used to enable [CORS](http://en.wikipedia.org/wiki/Cross-origin_resource_sharing) with various options.
|
||||
|
||||
**[Follow me (@troygoode) on Twitter!](https://twitter.com/intent/user?screen_name=troygoode)**
|
||||
|
||||
* [Installation](#installation)
|
||||
* [Usage](#usage)
|
||||
* [Simple Usage](#simple-usage-enable-all-cors-requests)
|
||||
* [Enable CORS for a Single Route](#enable-cors-for-a-single-route)
|
||||
* [Configuring CORS](#configuring-cors)
|
||||
* [Configuring CORS Asynchronously](#configuring-cors-asynchronously)
|
||||
* [Enabling CORS Pre-Flight](#enabling-cors-pre-flight)
|
||||
* [Configuration Options](#configuration-options)
|
||||
* [Demo](#demo)
|
||||
* [License](#license)
|
||||
* [Author](#author)
|
||||
|
||||
## Installation
|
||||
|
||||
This is a [Node.js](https://nodejs.org/en/) module available through the
|
||||
[npm registry](https://www.npmjs.com/). Installation is done using the
|
||||
[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
|
||||
|
||||
```sh
|
||||
$ npm install cors
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### Simple Usage (Enable *All* CORS Requests)
|
||||
|
||||
```javascript
|
||||
var express = require('express')
|
||||
var cors = require('cors')
|
||||
var app = express()
|
||||
|
||||
app.use(cors())
|
||||
|
||||
app.get('/products/:id', function (req, res, next) {
|
||||
res.json({msg: 'This is CORS-enabled for all origins!'})
|
||||
})
|
||||
|
||||
app.listen(80, function () {
|
||||
console.log('CORS-enabled web server listening on port 80')
|
||||
})
|
||||
```
|
||||
|
||||
### Enable CORS for a Single Route
|
||||
|
||||
```javascript
|
||||
var express = require('express')
|
||||
var cors = require('cors')
|
||||
var app = express()
|
||||
|
||||
app.get('/products/:id', cors(), function (req, res, next) {
|
||||
res.json({msg: 'This is CORS-enabled for a Single Route'})
|
||||
})
|
||||
|
||||
app.listen(80, function () {
|
||||
console.log('CORS-enabled web server listening on port 80')
|
||||
})
|
||||
```
|
||||
|
||||
### Configuring CORS
|
||||
|
||||
```javascript
|
||||
var express = require('express')
|
||||
var cors = require('cors')
|
||||
var app = express()
|
||||
|
||||
var corsOptions = {
|
||||
origin: 'http://example.com',
|
||||
optionsSuccessStatus: 200 // some legacy browsers (IE11, various SmartTVs) choke on 204
|
||||
}
|
||||
|
||||
app.get('/products/:id', cors(corsOptions), function (req, res, next) {
|
||||
res.json({msg: 'This is CORS-enabled for only example.com.'})
|
||||
})
|
||||
|
||||
app.listen(80, function () {
|
||||
console.log('CORS-enabled web server listening on port 80')
|
||||
})
|
||||
```
|
||||
|
||||
### Configuring CORS w/ Dynamic Origin
|
||||
|
||||
```javascript
|
||||
var express = require('express')
|
||||
var cors = require('cors')
|
||||
var app = express()
|
||||
|
||||
var whitelist = ['http://example1.com', 'http://example2.com']
|
||||
var corsOptions = {
|
||||
origin: function (origin, callback) {
|
||||
if (whitelist.indexOf(origin) !== -1) {
|
||||
callback(null, true)
|
||||
} else {
|
||||
callback(new Error('Not allowed by CORS'))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
app.get('/products/:id', cors(corsOptions), function (req, res, next) {
|
||||
res.json({msg: 'This is CORS-enabled for a whitelisted domain.'})
|
||||
})
|
||||
|
||||
app.listen(80, function () {
|
||||
console.log('CORS-enabled web server listening on port 80')
|
||||
})
|
||||
```
|
||||
|
||||
If you do not want to block REST tools or server-to-server requests,
|
||||
add a `!origin` check in the origin function like so:
|
||||
|
||||
```javascript
|
||||
var corsOptions = {
|
||||
origin: function (origin, callback) {
|
||||
if (whitelist.indexOf(origin) !== -1 || !origin) {
|
||||
callback(null, true)
|
||||
} else {
|
||||
callback(new Error('Not allowed by CORS'))
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Enabling CORS Pre-Flight
|
||||
|
||||
Certain CORS requests are considered 'complex' and require an initial
|
||||
`OPTIONS` request (called the "pre-flight request"). An example of a
|
||||
'complex' CORS request is one that uses an HTTP verb other than
|
||||
GET/HEAD/POST (such as DELETE) or that uses custom headers. To enable
|
||||
pre-flighting, you must add a new OPTIONS handler for the route you want
|
||||
to support:
|
||||
|
||||
```javascript
|
||||
var express = require('express')
|
||||
var cors = require('cors')
|
||||
var app = express()
|
||||
|
||||
app.options('/products/:id', cors()) // enable pre-flight request for DELETE request
|
||||
app.del('/products/:id', cors(), function (req, res, next) {
|
||||
res.json({msg: 'This is CORS-enabled for all origins!'})
|
||||
})
|
||||
|
||||
app.listen(80, function () {
|
||||
console.log('CORS-enabled web server listening on port 80')
|
||||
})
|
||||
```
|
||||
|
||||
You can also enable pre-flight across-the-board like so:
|
||||
|
||||
```javascript
|
||||
app.options('*', cors()) // include before other routes
|
||||
```
|
||||
|
||||
### Configuring CORS Asynchronously
|
||||
|
||||
```javascript
|
||||
var express = require('express')
|
||||
var cors = require('cors')
|
||||
var app = express()
|
||||
|
||||
var whitelist = ['http://example1.com', 'http://example2.com']
|
||||
var corsOptionsDelegate = function (req, callback) {
|
||||
var corsOptions;
|
||||
if (whitelist.indexOf(req.header('Origin')) !== -1) {
|
||||
corsOptions = { origin: true } // reflect (enable) the requested origin in the CORS response
|
||||
} else {
|
||||
corsOptions = { origin: false } // disable CORS for this request
|
||||
}
|
||||
callback(null, corsOptions) // callback expects two parameters: error and options
|
||||
}
|
||||
|
||||
app.get('/products/:id', cors(corsOptionsDelegate), function (req, res, next) {
|
||||
res.json({msg: 'This is CORS-enabled for a whitelisted domain.'})
|
||||
})
|
||||
|
||||
app.listen(80, function () {
|
||||
console.log('CORS-enabled web server listening on port 80')
|
||||
})
|
||||
```
|
||||
|
||||
## Configuration Options
|
||||
|
||||
* `origin`: Configures the **Access-Control-Allow-Origin** CORS header. Possible values:
|
||||
- `Boolean` - set `origin` to `true` to reflect the [request origin](http://tools.ietf.org/html/draft-abarth-origin-09), as defined by `req.header('Origin')`, or set it to `false` to disable CORS.
|
||||
- `String` - set `origin` to a specific origin. For example if you set it to `"http://example.com"` only requests from "http://example.com" will be allowed.
|
||||
- `RegExp` - set `origin` to a regular expression pattern which will be used to test the request origin. If it's a match, the request origin will be reflected. For example the pattern `/example\.com$/` will reflect any request that is coming from an origin ending with "example.com".
|
||||
- `Array` - set `origin` to an array of valid origins. Each origin can be a `String` or a `RegExp`. For example `["http://example1.com", /\.example2\.com$/]` will accept any request from "http://example1.com" or from a subdomain of "example2.com".
|
||||
- `Function` - set `origin` to a function implementing some custom logic. The function takes the request origin as the first parameter and a callback (which expects the signature `err [object], allow [bool]`) as the second.
|
||||
* `methods`: Configures the **Access-Control-Allow-Methods** CORS header. Expects a comma-delimited string (ex: 'GET,PUT,POST') or an array (ex: `['GET', 'PUT', 'POST']`).
|
||||
* `allowedHeaders`: Configures the **Access-Control-Allow-Headers** CORS header. Expects a comma-delimited string (ex: 'Content-Type,Authorization') or an array (ex: `['Content-Type', 'Authorization']`). If not specified, defaults to reflecting the headers specified in the request's **Access-Control-Request-Headers** header.
|
||||
* `exposedHeaders`: Configures the **Access-Control-Expose-Headers** CORS header. Expects a comma-delimited string (ex: 'Content-Range,X-Content-Range') or an array (ex: `['Content-Range', 'X-Content-Range']`). If not specified, no custom headers are exposed.
|
||||
* `credentials`: Configures the **Access-Control-Allow-Credentials** CORS header. Set to `true` to pass the header, otherwise it is omitted.
|
||||
* `maxAge`: Configures the **Access-Control-Max-Age** CORS header. Set to an integer to pass the header, otherwise it is omitted.
|
||||
* `preflightContinue`: Pass the CORS preflight response to the next handler.
|
||||
* `optionsSuccessStatus`: Provides a status code to use for successful `OPTIONS` requests, since some legacy browsers (IE11, various SmartTVs) choke on `204`.
|
||||
|
||||
The default configuration is the equivalent of:
|
||||
|
||||
```json
|
||||
{
|
||||
"origin": "*",
|
||||
"methods": "GET,HEAD,PUT,PATCH,POST,DELETE",
|
||||
"preflightContinue": false,
|
||||
"optionsSuccessStatus": 204
|
||||
}
|
||||
```
|
||||
|
||||
For details on the effect of each CORS header, read [this](http://www.html5rocks.com/en/tutorials/cors/) article on HTML5 Rocks.
|
||||
|
||||
## Demo
|
||||
|
||||
A demo that illustrates CORS working (and not working) using jQuery is available here: [http://node-cors-client.herokuapp.com/](http://node-cors-client.herokuapp.com/)
|
||||
|
||||
Code for that demo can be found here:
|
||||
|
||||
* Client: [https://github.com/TroyGoode/node-cors-client](https://github.com/TroyGoode/node-cors-client)
|
||||
* Server: [https://github.com/TroyGoode/node-cors-server](https://github.com/TroyGoode/node-cors-server)
|
||||
|
||||
## License
|
||||
|
||||
[MIT License](http://www.opensource.org/licenses/mit-license.php)
|
||||
|
||||
## Author
|
||||
|
||||
[Troy Goode](https://github.com/TroyGoode) ([troygoode@gmail.com](mailto:troygoode@gmail.com))
|
||||
|
||||
[coveralls-image]: https://img.shields.io/coveralls/expressjs/cors/master.svg
|
||||
[coveralls-url]: https://coveralls.io/r/expressjs/cors?branch=master
|
||||
[downloads-image]: https://img.shields.io/npm/dm/cors.svg
|
||||
[downloads-url]: https://npmjs.org/package/cors
|
||||
[npm-image]: https://img.shields.io/npm/v/cors.svg
|
||||
[npm-url]: https://npmjs.org/package/cors
|
||||
[travis-image]: https://img.shields.io/travis/expressjs/cors/master.svg
|
||||
[travis-url]: https://travis-ci.org/expressjs/cors
|
238
node_modules/cors/lib/index.js
generated
vendored
Normal file
238
node_modules/cors/lib/index.js
generated
vendored
Normal file
@ -0,0 +1,238 @@
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var assign = require('object-assign');
|
||||
var vary = require('vary');
|
||||
|
||||
var defaults = {
|
||||
origin: '*',
|
||||
methods: 'GET,HEAD,PUT,PATCH,POST,DELETE',
|
||||
preflightContinue: false,
|
||||
optionsSuccessStatus: 204
|
||||
};
|
||||
|
||||
function isString(s) {
|
||||
return typeof s === 'string' || s instanceof String;
|
||||
}
|
||||
|
||||
function isOriginAllowed(origin, allowedOrigin) {
|
||||
if (Array.isArray(allowedOrigin)) {
|
||||
for (var i = 0; i < allowedOrigin.length; ++i) {
|
||||
if (isOriginAllowed(origin, allowedOrigin[i])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
} else if (isString(allowedOrigin)) {
|
||||
return origin === allowedOrigin;
|
||||
} else if (allowedOrigin instanceof RegExp) {
|
||||
return allowedOrigin.test(origin);
|
||||
} else {
|
||||
return !!allowedOrigin;
|
||||
}
|
||||
}
|
||||
|
||||
function configureOrigin(options, req) {
|
||||
var requestOrigin = req.headers.origin,
|
||||
headers = [],
|
||||
isAllowed;
|
||||
|
||||
if (!options.origin || options.origin === '*') {
|
||||
// allow any origin
|
||||
headers.push([{
|
||||
key: 'Access-Control-Allow-Origin',
|
||||
value: '*'
|
||||
}]);
|
||||
} else if (isString(options.origin)) {
|
||||
// fixed origin
|
||||
headers.push([{
|
||||
key: 'Access-Control-Allow-Origin',
|
||||
value: options.origin
|
||||
}]);
|
||||
headers.push([{
|
||||
key: 'Vary',
|
||||
value: 'Origin'
|
||||
}]);
|
||||
} else {
|
||||
isAllowed = isOriginAllowed(requestOrigin, options.origin);
|
||||
// reflect origin
|
||||
headers.push([{
|
||||
key: 'Access-Control-Allow-Origin',
|
||||
value: isAllowed ? requestOrigin : false
|
||||
}]);
|
||||
headers.push([{
|
||||
key: 'Vary',
|
||||
value: 'Origin'
|
||||
}]);
|
||||
}
|
||||
|
||||
return headers;
|
||||
}
|
||||
|
||||
function configureMethods(options) {
|
||||
var methods = options.methods;
|
||||
if (methods.join) {
|
||||
methods = options.methods.join(','); // .methods is an array, so turn it into a string
|
||||
}
|
||||
return {
|
||||
key: 'Access-Control-Allow-Methods',
|
||||
value: methods
|
||||
};
|
||||
}
|
||||
|
||||
function configureCredentials(options) {
|
||||
if (options.credentials === true) {
|
||||
return {
|
||||
key: 'Access-Control-Allow-Credentials',
|
||||
value: 'true'
|
||||
};
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function configureAllowedHeaders(options, req) {
|
||||
var allowedHeaders = options.allowedHeaders || options.headers;
|
||||
var headers = [];
|
||||
|
||||
if (!allowedHeaders) {
|
||||
allowedHeaders = req.headers['access-control-request-headers']; // .headers wasn't specified, so reflect the request headers
|
||||
headers.push([{
|
||||
key: 'Vary',
|
||||
value: 'Access-Control-Request-Headers'
|
||||
}]);
|
||||
} else if (allowedHeaders.join) {
|
||||
allowedHeaders = allowedHeaders.join(','); // .headers is an array, so turn it into a string
|
||||
}
|
||||
if (allowedHeaders && allowedHeaders.length) {
|
||||
headers.push([{
|
||||
key: 'Access-Control-Allow-Headers',
|
||||
value: allowedHeaders
|
||||
}]);
|
||||
}
|
||||
|
||||
return headers;
|
||||
}
|
||||
|
||||
function configureExposedHeaders(options) {
|
||||
var headers = options.exposedHeaders;
|
||||
if (!headers) {
|
||||
return null;
|
||||
} else if (headers.join) {
|
||||
headers = headers.join(','); // .headers is an array, so turn it into a string
|
||||
}
|
||||
if (headers && headers.length) {
|
||||
return {
|
||||
key: 'Access-Control-Expose-Headers',
|
||||
value: headers
|
||||
};
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function configureMaxAge(options) {
|
||||
var maxAge = (typeof options.maxAge === 'number' || options.maxAge) && options.maxAge.toString()
|
||||
if (maxAge && maxAge.length) {
|
||||
return {
|
||||
key: 'Access-Control-Max-Age',
|
||||
value: maxAge
|
||||
};
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function applyHeaders(headers, res) {
|
||||
for (var i = 0, n = headers.length; i < n; i++) {
|
||||
var header = headers[i];
|
||||
if (header) {
|
||||
if (Array.isArray(header)) {
|
||||
applyHeaders(header, res);
|
||||
} else if (header.key === 'Vary' && header.value) {
|
||||
vary(res, header.value);
|
||||
} else if (header.value) {
|
||||
res.setHeader(header.key, header.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function cors(options, req, res, next) {
|
||||
var headers = [],
|
||||
method = req.method && req.method.toUpperCase && req.method.toUpperCase();
|
||||
|
||||
if (method === 'OPTIONS') {
|
||||
// preflight
|
||||
headers.push(configureOrigin(options, req));
|
||||
headers.push(configureCredentials(options, req));
|
||||
headers.push(configureMethods(options, req));
|
||||
headers.push(configureAllowedHeaders(options, req));
|
||||
headers.push(configureMaxAge(options, req));
|
||||
headers.push(configureExposedHeaders(options, req));
|
||||
applyHeaders(headers, res);
|
||||
|
||||
if (options.preflightContinue) {
|
||||
next();
|
||||
} else {
|
||||
// Safari (and potentially other browsers) need content-length 0,
|
||||
// for 204 or they just hang waiting for a body
|
||||
res.statusCode = options.optionsSuccessStatus;
|
||||
res.setHeader('Content-Length', '0');
|
||||
res.end();
|
||||
}
|
||||
} else {
|
||||
// actual response
|
||||
headers.push(configureOrigin(options, req));
|
||||
headers.push(configureCredentials(options, req));
|
||||
headers.push(configureExposedHeaders(options, req));
|
||||
applyHeaders(headers, res);
|
||||
next();
|
||||
}
|
||||
}
|
||||
|
||||
function middlewareWrapper(o) {
|
||||
// if options are static (either via defaults or custom options passed in), wrap in a function
|
||||
var optionsCallback = null;
|
||||
if (typeof o === 'function') {
|
||||
optionsCallback = o;
|
||||
} else {
|
||||
optionsCallback = function (req, cb) {
|
||||
cb(null, o);
|
||||
};
|
||||
}
|
||||
|
||||
return function corsMiddleware(req, res, next) {
|
||||
optionsCallback(req, function (err, options) {
|
||||
if (err) {
|
||||
next(err);
|
||||
} else {
|
||||
var corsOptions = assign({}, defaults, options);
|
||||
var originCallback = null;
|
||||
if (corsOptions.origin && typeof corsOptions.origin === 'function') {
|
||||
originCallback = corsOptions.origin;
|
||||
} else if (corsOptions.origin) {
|
||||
originCallback = function (origin, cb) {
|
||||
cb(null, corsOptions.origin);
|
||||
};
|
||||
}
|
||||
|
||||
if (originCallback) {
|
||||
originCallback(req.headers.origin, function (err2, origin) {
|
||||
if (err2 || !origin) {
|
||||
next(err2);
|
||||
} else {
|
||||
corsOptions.origin = origin;
|
||||
cors(corsOptions, req, res, next);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
// can pass either an options hash, an options delegate, or nothing
|
||||
module.exports = middlewareWrapper;
|
||||
|
||||
}());
|
78
node_modules/cors/package.json
generated
vendored
Normal file
78
node_modules/cors/package.json
generated
vendored
Normal file
@ -0,0 +1,78 @@
|
||||
{
|
||||
"_from": "cors",
|
||||
"_id": "cors@2.8.5",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==",
|
||||
"_location": "/cors",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "tag",
|
||||
"registry": true,
|
||||
"raw": "cors",
|
||||
"name": "cors",
|
||||
"escapedName": "cors",
|
||||
"rawSpec": "",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "latest"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#USER",
|
||||
"/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz",
|
||||
"_shasum": "eac11da51592dd86b9f06f6e7ac293b3df875d29",
|
||||
"_spec": "cors",
|
||||
"_where": "/Users/josh.burman/Projects/braid",
|
||||
"author": {
|
||||
"name": "Troy Goode",
|
||||
"email": "troygoode@gmail.com",
|
||||
"url": "https://github.com/troygoode/"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/expressjs/cors/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"object-assign": "^4",
|
||||
"vary": "^1"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Node.js CORS middleware",
|
||||
"devDependencies": {
|
||||
"after": "0.8.2",
|
||||
"eslint": "2.13.1",
|
||||
"express": "4.16.3",
|
||||
"mocha": "5.2.0",
|
||||
"nyc": "13.1.0",
|
||||
"supertest": "3.3.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.10"
|
||||
},
|
||||
"files": [
|
||||
"lib/index.js",
|
||||
"CONTRIBUTING.md",
|
||||
"HISTORY.md",
|
||||
"LICENSE",
|
||||
"README.md"
|
||||
],
|
||||
"homepage": "https://github.com/expressjs/cors#readme",
|
||||
"keywords": [
|
||||
"cors",
|
||||
"express",
|
||||
"connect",
|
||||
"middleware"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "./lib/index.js",
|
||||
"name": "cors",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/expressjs/cors.git"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint lib test",
|
||||
"test": "npm run lint && nyc --reporter=html --reporter=text mocha --require test/support/env"
|
||||
},
|
||||
"version": "2.8.5"
|
||||
}
|
1
node_modules/ecdsa-sig-formatter/CODEOWNERS
generated
vendored
Normal file
1
node_modules/ecdsa-sig-formatter/CODEOWNERS
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
* @omsmith
|
201
node_modules/ecdsa-sig-formatter/LICENSE
generated
vendored
Normal file
201
node_modules/ecdsa-sig-formatter/LICENSE
generated
vendored
Normal file
@ -0,0 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "{}"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright 2015 D2L Corporation
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
65
node_modules/ecdsa-sig-formatter/README.md
generated
vendored
Normal file
65
node_modules/ecdsa-sig-formatter/README.md
generated
vendored
Normal file
@ -0,0 +1,65 @@
|
||||
# ecdsa-sig-formatter
|
||||
|
||||
[](https://travis-ci.org/Brightspace/node-ecdsa-sig-formatter) [](https://coveralls.io/r/Brightspace/node-ecdsa-sig-formatter)
|
||||
|
||||
Translate between JOSE and ASN.1/DER encodings for ECDSA signatures
|
||||
|
||||
## Install
|
||||
```sh
|
||||
npm install ecdsa-sig-formatter --save
|
||||
```
|
||||
|
||||
## Usage
|
||||
```js
|
||||
var format = require('ecdsa-sig-formatter');
|
||||
|
||||
var derSignature = '..'; // asn.1/DER encoded ecdsa signature
|
||||
|
||||
var joseSignature = format.derToJose(derSignature);
|
||||
|
||||
```
|
||||
|
||||
### API
|
||||
|
||||
---
|
||||
|
||||
#### `.derToJose(Buffer|String signature, String alg)` -> `String`
|
||||
|
||||
Convert the ASN.1/DER encoded signature to a JOSE-style concatenated signature.
|
||||
Returns a _base64 url_ encoded `String`.
|
||||
|
||||
* If _signature_ is a `String`, it should be _base64_ encoded
|
||||
* _alg_ must be one of _ES256_, _ES384_ or _ES512_
|
||||
|
||||
---
|
||||
|
||||
#### `.joseToDer(Buffer|String signature, String alg)` -> `Buffer`
|
||||
|
||||
Convert the JOSE-style concatenated signature to an ASN.1/DER encoded
|
||||
signature. Returns a `Buffer`
|
||||
|
||||
* If _signature_ is a `String`, it should be _base64 url_ encoded
|
||||
* _alg_ must be one of _ES256_, _ES384_ or _ES512_
|
||||
|
||||
## Contributing
|
||||
|
||||
1. **Fork** the repository. Committing directly against this repository is
|
||||
highly discouraged.
|
||||
|
||||
2. Make your modifications in a branch, updating and writing new unit tests
|
||||
as necessary in the `spec` directory.
|
||||
|
||||
3. Ensure that all tests pass with `npm test`
|
||||
|
||||
4. `rebase` your changes against master. *Do not merge*.
|
||||
|
||||
5. Submit a pull request to this repository. Wait for tests to run and someone
|
||||
to chime in.
|
||||
|
||||
### Code Style
|
||||
|
||||
This repository is configured with [EditorConfig][EditorConfig] and
|
||||
[ESLint][ESLint] rules.
|
||||
|
||||
[EditorConfig]: http://editorconfig.org/
|
||||
[ESLint]: http://eslint.org
|
73
node_modules/ecdsa-sig-formatter/package.json
generated
vendored
Normal file
73
node_modules/ecdsa-sig-formatter/package.json
generated
vendored
Normal file
@ -0,0 +1,73 @@
|
||||
{
|
||||
"_from": "ecdsa-sig-formatter@1.0.11",
|
||||
"_id": "ecdsa-sig-formatter@1.0.11",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==",
|
||||
"_location": "/ecdsa-sig-formatter",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "ecdsa-sig-formatter@1.0.11",
|
||||
"name": "ecdsa-sig-formatter",
|
||||
"escapedName": "ecdsa-sig-formatter",
|
||||
"rawSpec": "1.0.11",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "1.0.11"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/jwa"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz",
|
||||
"_shasum": "ae0f0fa2d85045ef14a817daa3ce9acd0489e5bf",
|
||||
"_spec": "ecdsa-sig-formatter@1.0.11",
|
||||
"_where": "/Users/josh.burman/Projects/braid/node_modules/jwa",
|
||||
"author": {
|
||||
"name": "D2L Corporation"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/Brightspace/node-ecdsa-sig-formatter/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"safe-buffer": "^5.0.1"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Translate ECDSA signatures between ASN.1/DER and JOSE-style concatenation",
|
||||
"devDependencies": {
|
||||
"bench": "^0.3.6",
|
||||
"chai": "^3.5.0",
|
||||
"coveralls": "^2.11.9",
|
||||
"eslint": "^2.12.0",
|
||||
"eslint-config-brightspace": "^0.2.1",
|
||||
"istanbul": "^0.4.3",
|
||||
"jwk-to-pem": "^1.2.5",
|
||||
"mocha": "^2.5.3",
|
||||
"native-crypto": "^1.7.0"
|
||||
},
|
||||
"homepage": "https://github.com/Brightspace/node-ecdsa-sig-formatter#readme",
|
||||
"keywords": [
|
||||
"ecdsa",
|
||||
"der",
|
||||
"asn.1",
|
||||
"jwt",
|
||||
"jwa",
|
||||
"jsonwebtoken",
|
||||
"jose"
|
||||
],
|
||||
"license": "Apache-2.0",
|
||||
"main": "src/ecdsa-sig-formatter.js",
|
||||
"name": "ecdsa-sig-formatter",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+ssh://git@github.com/Brightspace/node-ecdsa-sig-formatter.git"
|
||||
},
|
||||
"scripts": {
|
||||
"check-style": "eslint .",
|
||||
"pretest": "npm run check-style",
|
||||
"report-cov": "cat ./coverage/lcov.info | coveralls",
|
||||
"test": "istanbul cover --root src _mocha -- spec"
|
||||
},
|
||||
"typings": "./src/ecdsa-sig-formatter.d.ts",
|
||||
"version": "1.0.11"
|
||||
}
|
17
node_modules/ecdsa-sig-formatter/src/ecdsa-sig-formatter.d.ts
generated
vendored
Normal file
17
node_modules/ecdsa-sig-formatter/src/ecdsa-sig-formatter.d.ts
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
/// <reference types="node" />
|
||||
|
||||
declare module "ecdsa-sig-formatter" {
|
||||
/**
|
||||
* Convert the ASN.1/DER encoded signature to a JOSE-style concatenated signature. Returns a base64 url encoded String.
|
||||
* If signature is a String, it should be base64 encoded
|
||||
* alg must be one of ES256, ES384 or ES512
|
||||
*/
|
||||
export function derToJose(signature: Buffer | string, alg: string): string;
|
||||
|
||||
/**
|
||||
* Convert the JOSE-style concatenated signature to an ASN.1/DER encoded signature. Returns a Buffer
|
||||
* If signature is a String, it should be base64 url encoded
|
||||
* alg must be one of ES256, ES384 or ES512
|
||||
*/
|
||||
export function joseToDer(signature: Buffer | string, alg: string): Buffer
|
||||
}
|
187
node_modules/ecdsa-sig-formatter/src/ecdsa-sig-formatter.js
generated
vendored
Normal file
187
node_modules/ecdsa-sig-formatter/src/ecdsa-sig-formatter.js
generated
vendored
Normal file
@ -0,0 +1,187 @@
|
||||
'use strict';
|
||||
|
||||
var Buffer = require('safe-buffer').Buffer;
|
||||
|
||||
var getParamBytesForAlg = require('./param-bytes-for-alg');
|
||||
|
||||
var MAX_OCTET = 0x80,
|
||||
CLASS_UNIVERSAL = 0,
|
||||
PRIMITIVE_BIT = 0x20,
|
||||
TAG_SEQ = 0x10,
|
||||
TAG_INT = 0x02,
|
||||
ENCODED_TAG_SEQ = (TAG_SEQ | PRIMITIVE_BIT) | (CLASS_UNIVERSAL << 6),
|
||||
ENCODED_TAG_INT = TAG_INT | (CLASS_UNIVERSAL << 6);
|
||||
|
||||
function base64Url(base64) {
|
||||
return base64
|
||||
.replace(/=/g, '')
|
||||
.replace(/\+/g, '-')
|
||||
.replace(/\//g, '_');
|
||||
}
|
||||
|
||||
function signatureAsBuffer(signature) {
|
||||
if (Buffer.isBuffer(signature)) {
|
||||
return signature;
|
||||
} else if ('string' === typeof signature) {
|
||||
return Buffer.from(signature, 'base64');
|
||||
}
|
||||
|
||||
throw new TypeError('ECDSA signature must be a Base64 string or a Buffer');
|
||||
}
|
||||
|
||||
function derToJose(signature, alg) {
|
||||
signature = signatureAsBuffer(signature);
|
||||
var paramBytes = getParamBytesForAlg(alg);
|
||||
|
||||
// the DER encoded param should at most be the param size, plus a padding
|
||||
// zero, since due to being a signed integer
|
||||
var maxEncodedParamLength = paramBytes + 1;
|
||||
|
||||
var inputLength = signature.length;
|
||||
|
||||
var offset = 0;
|
||||
if (signature[offset++] !== ENCODED_TAG_SEQ) {
|
||||
throw new Error('Could not find expected "seq"');
|
||||
}
|
||||
|
||||
var seqLength = signature[offset++];
|
||||
if (seqLength === (MAX_OCTET | 1)) {
|
||||
seqLength = signature[offset++];
|
||||
}
|
||||
|
||||
if (inputLength - offset < seqLength) {
|
||||
throw new Error('"seq" specified length of "' + seqLength + '", only "' + (inputLength - offset) + '" remaining');
|
||||
}
|
||||
|
||||
if (signature[offset++] !== ENCODED_TAG_INT) {
|
||||
throw new Error('Could not find expected "int" for "r"');
|
||||
}
|
||||
|
||||
var rLength = signature[offset++];
|
||||
|
||||
if (inputLength - offset - 2 < rLength) {
|
||||
throw new Error('"r" specified length of "' + rLength + '", only "' + (inputLength - offset - 2) + '" available');
|
||||
}
|
||||
|
||||
if (maxEncodedParamLength < rLength) {
|
||||
throw new Error('"r" specified length of "' + rLength + '", max of "' + maxEncodedParamLength + '" is acceptable');
|
||||
}
|
||||
|
||||
var rOffset = offset;
|
||||
offset += rLength;
|
||||
|
||||
if (signature[offset++] !== ENCODED_TAG_INT) {
|
||||
throw new Error('Could not find expected "int" for "s"');
|
||||
}
|
||||
|
||||
var sLength = signature[offset++];
|
||||
|
||||
if (inputLength - offset !== sLength) {
|
||||
throw new Error('"s" specified length of "' + sLength + '", expected "' + (inputLength - offset) + '"');
|
||||
}
|
||||
|
||||
if (maxEncodedParamLength < sLength) {
|
||||
throw new Error('"s" specified length of "' + sLength + '", max of "' + maxEncodedParamLength + '" is acceptable');
|
||||
}
|
||||
|
||||
var sOffset = offset;
|
||||
offset += sLength;
|
||||
|
||||
if (offset !== inputLength) {
|
||||
throw new Error('Expected to consume entire buffer, but "' + (inputLength - offset) + '" bytes remain');
|
||||
}
|
||||
|
||||
var rPadding = paramBytes - rLength,
|
||||
sPadding = paramBytes - sLength;
|
||||
|
||||
var dst = Buffer.allocUnsafe(rPadding + rLength + sPadding + sLength);
|
||||
|
||||
for (offset = 0; offset < rPadding; ++offset) {
|
||||
dst[offset] = 0;
|
||||
}
|
||||
signature.copy(dst, offset, rOffset + Math.max(-rPadding, 0), rOffset + rLength);
|
||||
|
||||
offset = paramBytes;
|
||||
|
||||
for (var o = offset; offset < o + sPadding; ++offset) {
|
||||
dst[offset] = 0;
|
||||
}
|
||||
signature.copy(dst, offset, sOffset + Math.max(-sPadding, 0), sOffset + sLength);
|
||||
|
||||
dst = dst.toString('base64');
|
||||
dst = base64Url(dst);
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
function countPadding(buf, start, stop) {
|
||||
var padding = 0;
|
||||
while (start + padding < stop && buf[start + padding] === 0) {
|
||||
++padding;
|
||||
}
|
||||
|
||||
var needsSign = buf[start + padding] >= MAX_OCTET;
|
||||
if (needsSign) {
|
||||
--padding;
|
||||
}
|
||||
|
||||
return padding;
|
||||
}
|
||||
|
||||
function joseToDer(signature, alg) {
|
||||
signature = signatureAsBuffer(signature);
|
||||
var paramBytes = getParamBytesForAlg(alg);
|
||||
|
||||
var signatureBytes = signature.length;
|
||||
if (signatureBytes !== paramBytes * 2) {
|
||||
throw new TypeError('"' + alg + '" signatures must be "' + paramBytes * 2 + '" bytes, saw "' + signatureBytes + '"');
|
||||
}
|
||||
|
||||
var rPadding = countPadding(signature, 0, paramBytes);
|
||||
var sPadding = countPadding(signature, paramBytes, signature.length);
|
||||
var rLength = paramBytes - rPadding;
|
||||
var sLength = paramBytes - sPadding;
|
||||
|
||||
var rsBytes = 1 + 1 + rLength + 1 + 1 + sLength;
|
||||
|
||||
var shortLength = rsBytes < MAX_OCTET;
|
||||
|
||||
var dst = Buffer.allocUnsafe((shortLength ? 2 : 3) + rsBytes);
|
||||
|
||||
var offset = 0;
|
||||
dst[offset++] = ENCODED_TAG_SEQ;
|
||||
if (shortLength) {
|
||||
// Bit 8 has value "0"
|
||||
// bits 7-1 give the length.
|
||||
dst[offset++] = rsBytes;
|
||||
} else {
|
||||
// Bit 8 of first octet has value "1"
|
||||
// bits 7-1 give the number of additional length octets.
|
||||
dst[offset++] = MAX_OCTET | 1;
|
||||
// length, base 256
|
||||
dst[offset++] = rsBytes & 0xff;
|
||||
}
|
||||
dst[offset++] = ENCODED_TAG_INT;
|
||||
dst[offset++] = rLength;
|
||||
if (rPadding < 0) {
|
||||
dst[offset++] = 0;
|
||||
offset += signature.copy(dst, offset, 0, paramBytes);
|
||||
} else {
|
||||
offset += signature.copy(dst, offset, rPadding, paramBytes);
|
||||
}
|
||||
dst[offset++] = ENCODED_TAG_INT;
|
||||
dst[offset++] = sLength;
|
||||
if (sPadding < 0) {
|
||||
dst[offset++] = 0;
|
||||
signature.copy(dst, offset, paramBytes);
|
||||
} else {
|
||||
signature.copy(dst, offset, paramBytes + sPadding);
|
||||
}
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
derToJose: derToJose,
|
||||
joseToDer: joseToDer
|
||||
};
|
23
node_modules/ecdsa-sig-formatter/src/param-bytes-for-alg.js
generated
vendored
Normal file
23
node_modules/ecdsa-sig-formatter/src/param-bytes-for-alg.js
generated
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
'use strict';
|
||||
|
||||
function getParamSize(keySize) {
|
||||
var result = ((keySize / 8) | 0) + (keySize % 8 === 0 ? 0 : 1);
|
||||
return result;
|
||||
}
|
||||
|
||||
var paramBytesForAlg = {
|
||||
ES256: getParamSize(256),
|
||||
ES384: getParamSize(384),
|
||||
ES512: getParamSize(521)
|
||||
};
|
||||
|
||||
function getParamBytesForAlg(alg) {
|
||||
var paramBytes = paramBytesForAlg[alg];
|
||||
if (paramBytes) {
|
||||
return paramBytes;
|
||||
}
|
||||
|
||||
throw new Error('Unknown algorithm "' + alg + '"');
|
||||
}
|
||||
|
||||
module.exports = getParamBytesForAlg;
|
466
node_modules/jsonwebtoken/CHANGELOG.md
generated
vendored
Normal file
466
node_modules/jsonwebtoken/CHANGELOG.md
generated
vendored
Normal file
@ -0,0 +1,466 @@
|
||||
# Change Log
|
||||
|
||||
|
||||
All notable changes to this project will be documented in this file starting from version **v4.0.0**.
|
||||
This project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
## 8.5.0 - 2019-02-20
|
||||
|
||||
### New Functionality
|
||||
|
||||
- feat: add PS JWA support for applicable node versions (#573) ([eefb9d9c6eec54718fa6e41306bda84788df7bec](https://github.com/auth0/node-jsonwebtoken/commit/eefb9d9c6eec54718fa6e41306bda84788df7bec)), closes [#573](https://github.com/auth0/node-jsonwebtoken/issues/573)
|
||||
- Add complete option in jwt.verify (#522) ([8737789dd330cf9e7870f4df97fd52479adbac22](https://github.com/auth0/node-jsonwebtoken/commit/8737789dd330cf9e7870f4df97fd52479adbac22)), closes [#522](https://github.com/auth0/node-jsonwebtoken/issues/522)
|
||||
|
||||
### Test Improvements
|
||||
|
||||
- Add tests for private claims in the payload (#555) ([5147852896755dc1291825e2e40556f964411fb2](https://github.com/auth0/node-jsonwebtoken/commit/5147852896755dc1291825e2e40556f964411fb2)), closes [#555](https://github.com/auth0/node-jsonwebtoken/issues/555)
|
||||
- Force use_strict during testing (#577) ([7b60c127ceade36c33ff33be066e435802001c94](https://github.com/auth0/node-jsonwebtoken/commit/7b60c127ceade36c33ff33be066e435802001c94)), closes [#577](https://github.com/auth0/node-jsonwebtoken/issues/577)
|
||||
- Refactor tests related to jti and jwtid (#544) ([7eebbc75ab89e01af5dacf2aae90fe05a13a1454](https://github.com/auth0/node-jsonwebtoken/commit/7eebbc75ab89e01af5dacf2aae90fe05a13a1454)), closes [#544](https://github.com/auth0/node-jsonwebtoken/issues/544)
|
||||
- ci: remove nsp from tests (#569) ([da8f55c3c7b4dd0bfc07a2df228500fdd050242a](https://github.com/auth0/node-jsonwebtoken/commit/da8f55c3c7b4dd0bfc07a2df228500fdd050242a)), closes [#569](https://github.com/auth0/node-jsonwebtoken/issues/569)
|
||||
|
||||
### Docs
|
||||
|
||||
- Fix 'cert' token which isn't a cert (#554) ([0c24fe68cd2866cea6322016bf993cd897fefc98](https://github.com/auth0/node-jsonwebtoken/commit/0c24fe68cd2866cea6322016bf993cd897fefc98)), closes [#554](https://github.com/auth0/node-jsonwebtoken/issues/554)
|
||||
|
||||
|
||||
## 8.4.0 - 2018-11-14
|
||||
|
||||
### New Functionality
|
||||
|
||||
- Add verify option for nonce validation (#540) ([e7938f06fdf2ed3aa88745b72b8ae4ee66c2d0d0](https://github.com/auth0/node-jsonwebtoken/commit/e7938f06fdf2ed3aa88745b72b8ae4ee66c2d0d0)), closes [#540](https://github.com/auth0/node-jsonwebtoken/issues/540)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- Updating Node version in Engines spec in package.json (#528) ([cfd1079305170a897dee6a5f55039783e6ee2711](https://github.com/auth0/node-jsonwebtoken/commit/cfd1079305170a897dee6a5f55039783e6ee2711)), closes [#528](https://github.com/auth0/node-jsonwebtoken/issues/528) [#509](https://github.com/auth0/node-jsonwebtoken/issues/509)
|
||||
- Fixed error message when empty string passed as expiresIn or notBefore option (#531) ([7f9604ac98d4d0ff8d873c3d2b2ea64bd285cb76](https://github.com/auth0/node-jsonwebtoken/commit/7f9604ac98d4d0ff8d873c3d2b2ea64bd285cb76)), closes [#531](https://github.com/auth0/node-jsonwebtoken/issues/531)
|
||||
|
||||
### Docs
|
||||
|
||||
- Update README.md (#527) ([b76f2a80f5229ee5cde321dd2ff14aa5df16d283](https://github.com/auth0/node-jsonwebtoken/commit/b76f2a80f5229ee5cde321dd2ff14aa5df16d283)), closes [#527](https://github.com/auth0/node-jsonwebtoken/issues/527)
|
||||
- Update README.md (#538) ([1956c4006472fd285b8a85074257cbdbe9131cbf](https://github.com/auth0/node-jsonwebtoken/commit/1956c4006472fd285b8a85074257cbdbe9131cbf)), closes [#538](https://github.com/auth0/node-jsonwebtoken/issues/538)
|
||||
- Edited the README.md to make certain parts of the document for the api easier to read, emphasizing the examples. (#548) ([dc89a641293d42f72ecfc623ce2eabc33954cb9d](https://github.com/auth0/node-jsonwebtoken/commit/dc89a641293d42f72ecfc623ce2eabc33954cb9d)), closes [#548](https://github.com/auth0/node-jsonwebtoken/issues/548)
|
||||
- Document NotBeforeError (#529) ([29cd654b956529e939ae8f8c30b9da7063aad501](https://github.com/auth0/node-jsonwebtoken/commit/29cd654b956529e939ae8f8c30b9da7063aad501)), closes [#529](https://github.com/auth0/node-jsonwebtoken/issues/529)
|
||||
|
||||
### Test Improvements
|
||||
|
||||
- Use lolex for faking date in tests (#491) ([677ead6d64482f2067b11437dda07309abe73cfa](https://github.com/auth0/node-jsonwebtoken/commit/677ead6d64482f2067b11437dda07309abe73cfa)), closes [#491](https://github.com/auth0/node-jsonwebtoken/issues/491)
|
||||
- Update dependencies used for running tests (#518) ([5498bdc4865ffb2ba2fd44d889fad7e83873bb33](https://github.com/auth0/node-jsonwebtoken/commit/5498bdc4865ffb2ba2fd44d889fad7e83873bb33)), closes [#518](https://github.com/auth0/node-jsonwebtoken/issues/518)
|
||||
- Minor test refactoring for recently added tests (#504) ([e2860a9d2a412627d79741a95bc7159971b923b9](https://github.com/auth0/node-jsonwebtoken/commit/e2860a9d2a412627d79741a95bc7159971b923b9)), closes [#504](https://github.com/auth0/node-jsonwebtoken/issues/504)
|
||||
- Create and implement async/sync test helpers (#523) ([683d8a9b31ad6327948f84268bd2c8e4350779d1](https://github.com/auth0/node-jsonwebtoken/commit/683d8a9b31ad6327948f84268bd2c8e4350779d1)), closes [#523](https://github.com/auth0/node-jsonwebtoken/issues/523)
|
||||
- Refactor tests related to audience and aud (#503) ([53d405e0223cce7c83cb51ecf290ca6bec1e9679](https://github.com/auth0/node-jsonwebtoken/commit/53d405e0223cce7c83cb51ecf290ca6bec1e9679)), closes [#503](https://github.com/auth0/node-jsonwebtoken/issues/503)
|
||||
- Refactor tests related to expiresIn and exp (#501) ([72f0d9e5b11a99082250665d1200c58182903fa6](https://github.com/auth0/node-jsonwebtoken/commit/72f0d9e5b11a99082250665d1200c58182903fa6)), closes [#501](https://github.com/auth0/node-jsonwebtoken/issues/501)
|
||||
- Refactor tests related to iat and maxAge (#507) ([877bd57ab2aca9b7d230805b21f921baed3da169](https://github.com/auth0/node-jsonwebtoken/commit/877bd57ab2aca9b7d230805b21f921baed3da169)), closes [#507](https://github.com/auth0/node-jsonwebtoken/issues/507)
|
||||
- Refactor tests related to iss and issuer (#543) ([0906a3fa80f52f959ac1b6343d3024ce5c7e9dea](https://github.com/auth0/node-jsonwebtoken/commit/0906a3fa80f52f959ac1b6343d3024ce5c7e9dea)), closes [#543](https://github.com/auth0/node-jsonwebtoken/issues/543)
|
||||
- Refactor tests related to kid and keyid (#545) ([88645427a0adb420bd3e149199a2a6bf1e17277e](https://github.com/auth0/node-jsonwebtoken/commit/88645427a0adb420bd3e149199a2a6bf1e17277e)), closes [#545](https://github.com/auth0/node-jsonwebtoken/issues/545)
|
||||
- Refactor tests related to notBefore and nbf (#497) ([39adf87a6faef3df984140f88e6724ddd709fd89](https://github.com/auth0/node-jsonwebtoken/commit/39adf87a6faef3df984140f88e6724ddd709fd89)), closes [#497](https://github.com/auth0/node-jsonwebtoken/issues/497)
|
||||
- Refactor tests related to subject and sub (#505) ([5a7fa23c0b4ac6c25304dab8767ef840b43a0eca](https://github.com/auth0/node-jsonwebtoken/commit/5a7fa23c0b4ac6c25304dab8767ef840b43a0eca)), closes [#505](https://github.com/auth0/node-jsonwebtoken/issues/505)
|
||||
- Implement async/sync tests for exp claim (#536) ([9ae3f207ac64b7450ea0a3434418f5ca58d8125e](https://github.com/auth0/node-jsonwebtoken/commit/9ae3f207ac64b7450ea0a3434418f5ca58d8125e)), closes [#536](https://github.com/auth0/node-jsonwebtoken/issues/536)
|
||||
- Implement async/sync tests for nbf claim (#537) ([88bc965061ed65299a395f42a100fb8f8c3c683e](https://github.com/auth0/node-jsonwebtoken/commit/88bc965061ed65299a395f42a100fb8f8c3c683e)), closes [#537](https://github.com/auth0/node-jsonwebtoken/issues/537)
|
||||
- Implement async/sync tests for sub claim (#534) ([342b07bb105a35739eb91265ba5b9dd33c300fc6](https://github.com/auth0/node-jsonwebtoken/commit/342b07bb105a35739eb91265ba5b9dd33c300fc6)), closes [#534](https://github.com/auth0/node-jsonwebtoken/issues/534)
|
||||
- Implement async/sync tests for the aud claim (#535) ([1c8ff5a68e6da73af2809c9d87faaf78602c99bb](https://github.com/auth0/node-jsonwebtoken/commit/1c8ff5a68e6da73af2809c9d87faaf78602c99bb)), closes [#535](https://github.com/auth0/node-jsonwebtoken/issues/535)
|
||||
|
||||
### CI
|
||||
|
||||
- Added Istanbul to check test-coverage (#468) ([9676a8306428a045e34c3987bd0680fb952b44e3](https://github.com/auth0/node-jsonwebtoken/commit/9676a8306428a045e34c3987bd0680fb952b44e3)), closes [#468](https://github.com/auth0/node-jsonwebtoken/issues/468)
|
||||
- Complete ESLint conversion and cleanup (#490) ([cb1d2e1e40547f7ecf29fa6635041df6cbba7f40](https://github.com/auth0/node-jsonwebtoken/commit/cb1d2e1e40547f7ecf29fa6635041df6cbba7f40)), closes [#490](https://github.com/auth0/node-jsonwebtoken/issues/490)
|
||||
- Make code-coverage mandatory when running tests (#495) ([fb0084a78535bfea8d0087c0870e7e3614a2cbe5](https://github.com/auth0/node-jsonwebtoken/commit/fb0084a78535bfea8d0087c0870e7e3614a2cbe5)), closes [#495](https://github.com/auth0/node-jsonwebtoken/issues/495)
|
||||
|
||||
|
||||
## 8.3.0 - 2018-06-11
|
||||
|
||||
- docs: add some clarifications (#473) ([cd33cc81f06068b9df6c224d300dc6f70d8904ab](https://github.com/auth0/node-jsonwebtoken/commit/cd33cc81f06068b9df6c224d300dc6f70d8904ab)), closes [#473](https://github.com/auth0/node-jsonwebtoken/issues/473)
|
||||
- ci: fix ci execution, remove not needed script (#472) ([c8ff7b2c3ffcd954a64a0273c20a7d1b22339aa5](https://github.com/auth0/node-jsonwebtoken/commit/c8ff7b2c3ffcd954a64a0273c20a7d1b22339aa5)), closes [#472](https://github.com/auth0/node-jsonwebtoken/issues/472)
|
||||
- new feature: Secret callback revisited (#480) ([d01cc7bcbdeb606d997a580f967b3169fcc622ba](https://github.com/auth0/node-jsonwebtoken/commit/d01cc7bcbdeb606d997a580f967b3169fcc622ba)), closes [#480](https://github.com/auth0/node-jsonwebtoken/issues/480)
|
||||
- docs:Update README.md (#461) ([f0e0954505f274da95a8d9603598e455b4d2c894](https://github.com/auth0/node-jsonwebtoken/commit/f0e0954505f274da95a8d9603598e455b4d2c894)), closes [#461](https://github.com/auth0/node-jsonwebtoken/issues/461)
|
||||
|
||||
|
||||
## 8.2.2 - 2018-05-30
|
||||
|
||||
- security: deps: jws@3.1.5 (#477) ([ebde9b7cc75cb7ab5176de7ebc4a1d6a8f05bd51](https://github.com/auth0/node-jsonwebtoken/commit/ebde9b7cc75cb7ab5176de7ebc4a1d6a8f05bd51)), closes [#465](https://github.com/auth0/node-jsonwebtoken/issues/465)
|
||||
- docs: add some clarifications (#473) ([cd33cc81f06068b9df6c224d300dc6f70d8904ab](https://github.com/auth0/node-jsonwebtoken/commit/cd33cc81f06068b9df6c224d300dc6f70d8904ab)), closes [#473](https://github.com/auth0/node-jsonwebtoken/issues/473)
|
||||
- ci: fix ci execution, remove not needed script (#472) ([c8ff7b2c3ffcd954a64a0273c20a7d1b22339aa5](https://github.com/auth0/node-jsonwebtoken/commit/c8ff7b2c3ffcd954a64a0273c20a7d1b22339aa5)), closes [#472](https://github.com/auth0/node-jsonwebtoken/issues/472)
|
||||
- docs: Update README.md (#461) ([f0e0954505f274da95a8d9603598e455b4d2c894](https://github.com/auth0/node-jsonwebtoken/commit/f0e0954505f274da95a8d9603598e455b4d2c894)), closes [#461](https://github.com/auth0/node-jsonwebtoken/issues/461)
|
||||
|
||||
|
||||
## 8.2.1 - 2018-04-05
|
||||
|
||||
- bug fix: Check payload is not null when decoded. (#444) ([1232ae9352ce5fd1ca6c593291ce6ad0834a1ff5](https://github.com/auth0/node-jsonwebtoken/commit/1232ae9352ce5fd1ca6c593291ce6ad0834a1ff5))
|
||||
- docs: Clarify that buffer/string payloads must be JSON (#442) ([e8ac1be7565a3fd986d40cb5e31a9f6c4d9aed1b](https://github.com/auth0/node-jsonwebtoken/commit/e8ac1be7565a3fd986d40cb5e31a9f6c4d9aed1b))
|
||||
|
||||
|
||||
## 8.2.0 - 2018-03-02
|
||||
|
||||
- Add a new mutatePayload option (#446) ([d6d7c5e5103f05a92d3633ac190d3025a0455be0](https://github.com/auth0/node-jsonwebtoken/commit/d6d7c5e5103f05a92d3633ac190d3025a0455be0))
|
||||
|
||||
|
||||
## 8.1.1 - 2018-01-22
|
||||
|
||||
- ci: add newer node versions to build matrix (#428) ([83f3eee44e122da06f812d7da4ace1fa26c24d9d](https://github.com/auth0/node-jsonwebtoken/commit/83f3eee44e122da06f812d7da4ace1fa26c24d9d))
|
||||
- deps: Bump ms version to add support for negative numbers (#438) ([25e0e624545eaef76f3c324a134bf103bc394724](https://github.com/auth0/node-jsonwebtoken/commit/25e0e624545eaef76f3c324a134bf103bc394724))
|
||||
- docs: Minor typo (#424) ([dddcb73ac05de11b81feeb629f6cf78dd03d2047](https://github.com/auth0/node-jsonwebtoken/commit/dddcb73ac05de11b81feeb629f6cf78dd03d2047))
|
||||
- bug fix: Not Before (nbf) calculated based on iat/timestamp (#437) ([2764a64908d97c043d62eba0bf6c600674f9a6d6](https://github.com/auth0/node-jsonwebtoken/commit/2764a64908d97c043d62eba0bf6c600674f9a6d6)), closes [#435](https://github.com/auth0/node-jsonwebtoken/issues/435)
|
||||
|
||||
|
||||
## 8.1.0 - 2017-10-09
|
||||
|
||||
- #402: Don't fail if captureStackTrace is not a function (#410) ([77ee965d9081faaf21650f266399f203f69533c5](https://github.com/auth0/node-jsonwebtoken/commit/77ee965d9081faaf21650f266399f203f69533c5))
|
||||
- #403: Clarify error wording for "Expected object" error. (#409) ([bb27eb346f0ff675a320b2de16b391a7cfeadc58](https://github.com/auth0/node-jsonwebtoken/commit/bb27eb346f0ff675a320b2de16b391a7cfeadc58))
|
||||
- Enhance audience check to verify against regular expressions (#398) ([81501a17da230af7b74a3f7535ab5cd3a19c8315](https://github.com/auth0/node-jsonwebtoken/commit/81501a17da230af7b74a3f7535ab5cd3a19c8315))
|
||||
|
||||
|
||||
## 8.0.1 - 2017-09-12
|
||||
|
||||
- Remove `lodash.isarray` dependency (#394) ([7508e8957cb1c778f72fa9a363a7b135b3c9c36d](https://github.com/auth0/node-jsonwebtoken/commit/7508e8957cb1c778f72fa9a363a7b135b3c9c36d))
|
||||
|
||||
## 8.0.0 - 2017-09-06
|
||||
|
||||
**Breaking changes: See [Migration notes from v7](https://github.com/auth0/node-jsonwebtoken/wiki/Migration-Notes:-v7-to-v8)**
|
||||
|
||||
- docs: readme, migration notes ([12cd8f7f47224f904f6b8f39d1dee73775de4f6f](https://github.com/auth0/node-jsonwebtoken/commit/12cd8f7f47224f904f6b8f39d1dee73775de4f6f))
|
||||
- verify: remove process.nextTick (#302) ([3305cf04e3f674b9fb7e27c9b14ddd159650ff82](https://github.com/auth0/node-jsonwebtoken/commit/3305cf04e3f674b9fb7e27c9b14ddd159650ff82))
|
||||
- Reduce size of NPM package (#347) ([0be5409ac6592eeaae373dce91ec992fa101bd8a](https://github.com/auth0/node-jsonwebtoken/commit/0be5409ac6592eeaae373dce91ec992fa101bd8a))
|
||||
- Remove joi to shrink module size (#348) ([2e7e68dbd59e845cdd940afae0a296f48438445f](https://github.com/auth0/node-jsonwebtoken/commit/2e7e68dbd59e845cdd940afae0a296f48438445f))
|
||||
- maxAge: Add validation to timespan result ([66a4f8b996c8357727ce62a84605a005b2f5eb18](https://github.com/auth0/node-jsonwebtoken/commit/66a4f8b996c8357727ce62a84605a005b2f5eb18))
|
||||
|
||||
## 7.4.3 - 2017-08-17
|
||||
|
||||
- Fix breaking change on 7.4.2 for empty secret + "none" algorithm (sync code style) ([PR 386](https://github.com/auth0/node-jsonwebtoken/pull/386))
|
||||
|
||||
## 7.4.2 - 2017-08-04
|
||||
|
||||
- bugfix: sign: add check to be sure secret has a value ([c584d1cbc34b788977b36f17cd57ab2212f1230e](https://github.com/auth0/node-jsonwebtoken/commit/c584d1cbc34b788977b36f17cd57ab2212f1230e))
|
||||
- docs: about refreshing tokens ([016fc10b847bfbb76b82171cb530f32d7da2001b](https://github.com/auth0/node-jsonwebtoken/commit/016fc10b847bfbb76b82171cb530f32d7da2001b))
|
||||
- docs: verifying with base64 encoded secrets ([c25e9906801f89605080cc71b3ee23a5e45a5811](https://github.com/auth0/node-jsonwebtoken/commit/c25e9906801f89605080cc71b3ee23a5e45a5811))
|
||||
- tests: Add tests for ES256 ([89900ea00735f76b04f437c9f542285b420fa9cb](https://github.com/auth0/node-jsonwebtoken/commit/89900ea00735f76b04f437c9f542285b420fa9cb))
|
||||
- docs: document keyid as option (#361) ([00086c2c006d7fc1a47bae02fa87d194d79aa558](https://github.com/auth0/node-jsonwebtoken/commit/00086c2c006d7fc1a47bae02fa87d194d79aa558))
|
||||
- docs: readme: Using private key with passpharase (#353) ([27a7f1d4f35b662426ff0270526d48658da4c8b7](https://github.com/auth0/node-jsonwebtoken/commit/27a7f1d4f35b662426ff0270526d48658da4c8b7))
|
||||
|
||||
## 7.4.1 - 2017-05-17
|
||||
|
||||
- bump ms to v2 due a ReDoS vulnerability (#352) ([adcfd6ae4088c838769d169f8cd9154265aa13e0](https://github.com/auth0/node-jsonwebtoken/commit/adcfd6ae4088c838769d169f8cd9154265aa13e0))
|
||||
|
||||
## 7.4.0 - 2017-04-24
|
||||
|
||||
- Add docs about numeric date fields ([659f73119900a4d837650d9b3f5af4e64a2f843b](https://github.com/auth0/node-jsonwebtoken/commit/659f73119900a4d837650d9b3f5af4e64a2f843b))
|
||||
- Make Options object optional for callback-ish sign ([e202c4fd00c35a24e9ab606eab89186ade13d0cc](https://github.com/auth0/node-jsonwebtoken/commit/e202c4fd00c35a24e9ab606eab89186ade13d0cc))
|
||||
|
||||
## 7.3.0 - 2017-02-13
|
||||
|
||||
- Add more information to `maxAge` option in README ([1b0592e99cc8def293eed177e2575fa7f1cf7aa5](https://github.com/auth0/node-jsonwebtoken/commit/1b0592e99cc8def293eed177e2575fa7f1cf7aa5))
|
||||
- Add `clockTimestamp` option to `verify()` you can set the current time in seconds with it (#274) ([8fdc1504f4325e7003894ffea078da9cba5208d9](https://github.com/auth0/node-jsonwebtoken/commit/8fdc1504f4325e7003894ffea078da9cba5208d9))
|
||||
- Fix handling non string tokens on `verify()` input (#305) ([1b6ec8d466504f58c5a6e2dae3360c828bad92fb](https://github.com/auth0/node-jsonwebtoken/commit/1b6ec8d466504f58c5a6e2dae3360c828bad92fb)), closes [#305](https://github.com/auth0/node-jsonwebtoken/issues/305)
|
||||
- Fixed a simple typo in docs (#287) ([a54240384e24e18c00e75884295306db311d0cb7](https://github.com/auth0/node-jsonwebtoken/commit/a54240384e24e18c00e75884295306db311d0cb7)), closes [#287](https://github.com/auth0/node-jsonwebtoken/issues/287)
|
||||
- Raise jws.decode error to avoid confusion with "invalid token" error (#294) ([7f68fe06c88d5c5653785bd66bc68c5b20e1bd8e](https://github.com/auth0/node-jsonwebtoken/commit/7f68fe06c88d5c5653785bd66bc68c5b20e1bd8e))
|
||||
- rauchg/ms.js changed to zeit/ms (#303) ([35d84152a6b716d757cb5b1dd3c79fe3a1bc0628](https://github.com/auth0/node-jsonwebtoken/commit/35d84152a6b716d757cb5b1dd3c79fe3a1bc0628))
|
||||
|
||||
## 7.2.1 - 2016-12-07
|
||||
|
||||
- add nsp check to find vulnerabilities on npm test ([4219c34b5346811c07f520f10516cc495bcc70dd](https://github.com/auth0/node-jsonwebtoken/commit/4219c34b5346811c07f520f10516cc495bcc70dd))
|
||||
- revert to joi@^6 to keep ES5 compatibility ([51d4796c07344bf817687f7ccfeef78f00bf5b4f](https://github.com/auth0/node-jsonwebtoken/commit/51d4796c07344bf817687f7ccfeef78f00bf5b4f))
|
||||
|
||||
## 7.2.0 - 2016-12-06
|
||||
|
||||
- improve the documentation for expiration ([771e0b5f9bed90771fb79140eb38e51a3ecac8f0](https://github.com/auth0/node-jsonwebtoken/commit/771e0b5f9bed90771fb79140eb38e51a3ecac8f0))
|
||||
- Restructured a sentence ([ccc7610187a862f7a50177eadc9152eef26cd065](https://github.com/auth0/node-jsonwebtoken/commit/ccc7610187a862f7a50177eadc9152eef26cd065))
|
||||
- Allow `keyid` on `sign`. ([b412be91b89acb3a742bb609d3b54e47e1dfc441](https://github.com/auth0/node-jsonwebtoken/commit/b412be91b89acb3a742bb609d3b54e47e1dfc441))
|
||||
- upgrade joi ([715e3d928023d414d45c6dc3f096a7c8448139ae](https://github.com/auth0/node-jsonwebtoken/commit/715e3d928023d414d45c6dc3f096a7c8448139ae))
|
||||
- upgrade to latest nodes and Travis infrastructure ([3febcc1dd23ecdec1abbf89313959941d15eb47a](https://github.com/auth0/node-jsonwebtoken/commit/3febcc1dd23ecdec1abbf89313959941d15eb47a))
|
||||
|
||||
|
||||
## 7.1.10 - 2016-12-06
|
||||
|
||||
- Bump node-jws version number ([07813dd7194630c9f452684279178af76464a759](https://github.com/auth0/node-jsonwebtoken/commit/07813dd7194630c9f452684279178af76464a759))
|
||||
- improve the documentation for expiration ([771e0b5f9bed90771fb79140eb38e51a3ecac8f0](https://github.com/auth0/node-jsonwebtoken/commit/771e0b5f9bed90771fb79140eb38e51a3ecac8f0))
|
||||
|
||||
## 7.1.9 - 2016-08-11
|
||||
|
||||
- Revert "Merge branch 'venatir-master'" ([d06359ef3b4e619680e043ee7c16adda16598f52](https://github.com/auth0/node-jsonwebtoken/commit/d06359ef3b4e619680e043ee7c16adda16598f52))
|
||||
|
||||
|
||||
|
||||
## 7.1.8 - 2016-08-10
|
||||
|
||||
- Fixed tests, however typ: 'JWT' should not be in the options at all, so please review other tests ([01903bcdc61b4ed429acbbd1fe0ffe0db364473b](https://github.com/auth0/node-jsonwebtoken/commit/01903bcdc61b4ed429acbbd1fe0ffe0db364473b))
|
||||
- Removing unnecessary extra decoding. jwtString is already verified as valid and signature checked ([55d5834f7b637011e1d8b927ff78a92a5fd521cf](https://github.com/auth0/node-jsonwebtoken/commit/55d5834f7b637011e1d8b927ff78a92a5fd521cf))
|
||||
- update changelog ([5117aacd0118a10331889a64e61d8186112d8a23](https://github.com/auth0/node-jsonwebtoken/commit/5117aacd0118a10331889a64e61d8186112d8a23))
|
||||
|
||||
|
||||
## 7.1.7 - 2016-07-29
|
||||
|
||||
- Use lodash.once instead of unlicensed/unmaintained cb ([3ac95ad93ef3068a64e03d8d14deff231b1ed529](https://github.com/auth0/node-jsonwebtoken/commit/3ac95ad93ef3068a64e03d8d14deff231b1ed529))
|
||||
|
||||
## 7.1.6 - 2016-07-15
|
||||
|
||||
- fix issue with buffer payload. closes #216 ([6b50ff324b4dfd2cb0e49b666f14a6672d015b22](https://github.com/auth0/node-jsonwebtoken/commit/6b50ff324b4dfd2cb0e49b666f14a6672d015b22)), closes [#216](https://github.com/auth0/node-jsonwebtoken/issues/216)
|
||||
|
||||
|
||||
## 7.1.5 - 2016-07-15
|
||||
|
||||
- update jws in package.json ([b6260951eefc68aae5f4ede359210761f901ff7a](https://github.com/auth0/node-jsonwebtoken/commit/b6260951eefc68aae5f4ede359210761f901ff7a))
|
||||
|
||||
|
||||
## 7.1.4 - 2016-07-14
|
||||
|
||||
- add redundant test ([bece8816096f324511c3efcb8db0e64b75d757a1](https://github.com/auth0/node-jsonwebtoken/commit/bece8816096f324511c3efcb8db0e64b75d757a1))
|
||||
- fix an issue of double callback on error ([758ca5eeca2f1b06c32c9fce70642bf488b2e52b](https://github.com/auth0/node-jsonwebtoken/commit/758ca5eeca2f1b06c32c9fce70642bf488b2e52b))
|
||||
|
||||
## 7.1.2 - 2016-07-12
|
||||
|
||||
- do not stringify the payload when signing async - closes #224 ([084f537d3dfbcef2bea411cc0a1515899cc8aa21](https://github.com/auth0/node-jsonwebtoken/commit/084f537d3dfbcef2bea411cc0a1515899cc8aa21)), closes [#224](https://github.com/auth0/node-jsonwebtoken/issues/224)
|
||||
|
||||
## 7.1.1 - 2016-07-12
|
||||
|
||||
- do not mutate options in jwt.verify, closes #227 ([63263a28a268624dab0927b9ad86fffa44a10f84](https://github.com/auth0/node-jsonwebtoken/commit/63263a28a268624dab0927b9ad86fffa44a10f84)), closes [#227](https://github.com/auth0/node-jsonwebtoken/issues/227)
|
||||
- refactor into multiple files ([e11d505207fa33501298300c9accbfb809d8748d](https://github.com/auth0/node-jsonwebtoken/commit/e11d505207fa33501298300c9accbfb809d8748d))
|
||||
|
||||
## 7.1.0 - 2016-07-12
|
||||
|
||||
- Exp calculated based on iat. fix #217 ([757a16e0e35ad19f9e456820f55d5d9f3fc76aee](https://github.com/auth0/node-jsonwebtoken/commit/757a16e0e35ad19f9e456820f55d5d9f3fc76aee)), closes [#217](https://github.com/auth0/node-jsonwebtoken/issues/217)
|
||||
|
||||
## 7.0.0 - 2016-05-19
|
||||
|
||||
- change jwt.sign to return errors on callback instead of throwing errors ([1e46c5a42aa3dab8478efa4081d8f8f5c5485d56](https://github.com/auth0/node-jsonwebtoken/commit/1e46c5a42aa3dab8478efa4081d8f8f5c5485d56))
|
||||
|
||||
## 6.2.0 - 2016-04-29
|
||||
|
||||
- add support for `options.clockTolerance` to `jwt.verify` ([65ddea934f226bf06bc9d6a55be9587515cfc38d](https://github.com/auth0/node-jsonwebtoken/commit/65ddea934f226bf06bc9d6a55be9587515cfc38d))
|
||||
|
||||
## 6.1.2 - 2016-04-29
|
||||
|
||||
- fix sign method for node.js 0.12. closes #193 ([9c38374142d3929be3c9314b5e9bc5d963c5955f](https://github.com/auth0/node-jsonwebtoken/commit/9c38374142d3929be3c9314b5e9bc5d963c5955f)), closes [#193](https://github.com/auth0/node-jsonwebtoken/issues/193)
|
||||
- improve async test ([7b0981380ddc40a5f1208df520631785b5ffb85a](https://github.com/auth0/node-jsonwebtoken/commit/7b0981380ddc40a5f1208df520631785b5ffb85a))
|
||||
|
||||
## 6.1.0 - 2016-04-27
|
||||
|
||||
- verify unsigned tokens ([ec880791c10ed5ef7c8df7bf28ebb95c810479ed](https://github.com/auth0/node-jsonwebtoken/commit/ec880791c10ed5ef7c8df7bf28ebb95c810479ed))
|
||||
|
||||
## 6.0.1 - 2016-04-27
|
||||
|
||||
This was an immediate change after publishing 6.0.0.
|
||||
|
||||
- throw error on invalid options when the payload is not an object ([304f1b33075f79ed66f784e27dc4f5307aa39e27](https://github.com/auth0/node-jsonwebtoken/commit/304f1b33075f79ed66f784e27dc4f5307aa39e27))
|
||||
|
||||
## 6.0.0 - 2016-04-27
|
||||
|
||||
- Change .sign to standard async callback ([50873c7d45d2733244d5da8afef3d1872e657a60](https://github.com/auth0/node-jsonwebtoken/commit/50873c7d45d2733244d5da8afef3d1872e657a60))
|
||||
- Improved the options for the `sign` method ([53c3987b3cc34e95eb396b26fc9b051276e2f6f9](https://github.com/auth0/node-jsonwebtoken/commit/53c3987b3cc34e95eb396b26fc9b051276e2f6f9))
|
||||
|
||||
- throw error on invalid options like `expiresIn` when the payload is not an object ([304f1b33075f79ed66f784e27dc4f5307aa39e27](https://github.com/auth0/node-jsonwebtoken/commit/304f1b33075f79ed66f784e27dc4f5307aa39e27))
|
||||
- `expiresInMinutes` and `expiresInSeconds` are deprecated and no longer supported.
|
||||
- `notBeforeInMinutes` and `notBeforeInSeconds` are deprecated and no longer supported.
|
||||
- `options` are strongly validated.
|
||||
- `options.expiresIn`, `options.notBefore`, `options.audience`, `options.issuer`, `options.subject` and `options.jwtid` are mutually exclusive with `payload.exp`, `payload.nbf`, `payload.aud`, `payload.iss`
|
||||
- `options.algorithm` is properly validated.
|
||||
- `options.headers` is renamed to `options.header`.
|
||||
|
||||
- update CHANGELOG to reflect most of the changes. closes #136 ([b87a1a8d2e2533fbfab518765a54f00077918eb7](https://github.com/auth0/node-jsonwebtoken/commit/b87a1a8d2e2533fbfab518765a54f00077918eb7)), closes [#136](https://github.com/auth0/node-jsonwebtoken/issues/136)
|
||||
- update readme ([53a88ecf4494e30e1d62a1cf3cc354650349f486](https://github.com/auth0/node-jsonwebtoken/commit/53a88ecf4494e30e1d62a1cf3cc354650349f486))
|
||||
|
||||
## 5.7.0 - 2016-02-16
|
||||
|
||||
|
||||
- add support for validating multiples issuers. closes #163 ([39d9309ae05648dbd72e5fd1993df064ad0e8fa5](https://github.com/auth0/node-jsonwebtoken/commit/39d9309ae05648dbd72e5fd1993df064ad0e8fa5)), closes [#163](https://github.com/auth0/node-jsonwebtoken/issues/163)
|
||||
|
||||
|
||||
## 5.6.1 - 2016-02-16
|
||||
|
||||
|
||||
- 5.6.1 ([06d8209d499dbc9a8dd978ab6cbb9c6818fde203](https://github.com/auth0/node-jsonwebtoken/commit/06d8209d499dbc9a8dd978ab6cbb9c6818fde203))
|
||||
- fix wrong error when setting expiration on non-object payload. closes #153 ([7f7d76edfd918d6afc7c7cead888caa42ccaceb4](https://github.com/auth0/node-jsonwebtoken/commit/7f7d76edfd918d6afc7c7cead888caa42ccaceb4)), closes [#153](https://github.com/auth0/node-jsonwebtoken/issues/153)
|
||||
|
||||
|
||||
|
||||
## 5.6.0 - 2016-02-16
|
||||
|
||||
|
||||
- added missing validations of sub and jti ([a1affe960d0fc52e9042bcbdedb65734f8855580](https://github.com/auth0/node-jsonwebtoken/commit/a1affe960d0fc52e9042bcbdedb65734f8855580))
|
||||
- Fix tests in jwt.rs.tests.js which causes 4 to fail ([8aedf2b1f575b0d9575c1fc9f2ac7bc868f75ff1](https://github.com/auth0/node-jsonwebtoken/commit/8aedf2b1f575b0d9575c1fc9f2ac7bc868f75ff1))
|
||||
- Update README.md ([349b7cd00229789b138928ca060d3ef015aedaf9](https://github.com/auth0/node-jsonwebtoken/commit/349b7cd00229789b138928ca060d3ef015aedaf9))
|
||||
|
||||
|
||||
|
||||
## 5.5.4 - 2016-01-04
|
||||
|
||||
|
||||
- minor ([46552e7c45025c76e3f647680d7539a66bfac612](https://github.com/auth0/node-jsonwebtoken/commit/46552e7c45025c76e3f647680d7539a66bfac612))
|
||||
|
||||
|
||||
|
||||
## 5.5.3 - 2016-01-04
|
||||
|
||||
|
||||
- add a console.warn on invalid options for string payloads ([71200f14deba0533d3261266348338fac2d14661](https://github.com/auth0/node-jsonwebtoken/commit/71200f14deba0533d3261266348338fac2d14661))
|
||||
- minor ([65b1f580382dc58dd3da6f47a52713776fd7cdf2](https://github.com/auth0/node-jsonwebtoken/commit/65b1f580382dc58dd3da6f47a52713776fd7cdf2))
|
||||
|
||||
|
||||
|
||||
## 5.5.2 - 2016-01-04
|
||||
|
||||
|
||||
- fix signing method with sealed objects, do not modify the params object. closes #147 ([be9c09af83b09c9e72da8b2c6166fa51d92aeab6](https://github.com/auth0/node-jsonwebtoken/commit/be9c09af83b09c9e72da8b2c6166fa51d92aeab6)), closes [#147](https://github.com/auth0/node-jsonwebtoken/issues/147)
|
||||
|
||||
|
||||
|
||||
## 5.5.1 - 2016-01-04
|
||||
|
||||
|
||||
- fix nbf verification. fix #152 ([786d37b299c67771b5e71a2ca476666ab0f97d98](https://github.com/auth0/node-jsonwebtoken/commit/786d37b299c67771b5e71a2ca476666ab0f97d98)), closes [#152](https://github.com/auth0/node-jsonwebtoken/issues/152)
|
||||
|
||||
|
||||
|
||||
## 5.5.0 - 2015-12-28
|
||||
|
||||
|
||||
- improvements to nbf and jti claims ([46372e928f6d2e7398f9b88022ca617d2a3b0699](https://github.com/auth0/node-jsonwebtoken/commit/46372e928f6d2e7398f9b88022ca617d2a3b0699))
|
||||
- Remove duplicate payload line (fix bug in IE strict mode) ([8163d698e0c5ad8c44817a5dcd42a15d7e9c6bc8](https://github.com/auth0/node-jsonwebtoken/commit/8163d698e0c5ad8c44817a5dcd42a15d7e9c6bc8))
|
||||
- Remove duplicate require('ms') line ([7c00bcbcbf8f7503a1070b394a165eccd41de66f](https://github.com/auth0/node-jsonwebtoken/commit/7c00bcbcbf8f7503a1070b394a165eccd41de66f))
|
||||
- Update README to reflect addition of async sign ([d661d4b6f68eb417834c99b36769444723041ccf](https://github.com/auth0/node-jsonwebtoken/commit/d661d4b6f68eb417834c99b36769444723041ccf))
|
||||
|
||||
|
||||
|
||||
## 5.4.0 - 2015-10-02
|
||||
|
||||
|
||||
- deprecate expireInMinutes and expireInSeconds - in favor of expiresIn ([39ecc6f8f310f8462e082f1d53de0b4222b29b6f](https://github.com/auth0/node-jsonwebtoken/commit/39ecc6f8f310f8462e082f1d53de0b4222b29b6f))
|
||||
|
||||
|
||||
## 5.3.0 - 2015-10-02
|
||||
|
||||
|
||||
- 5.3.0 ([5d559ced3fbf10c1adae2e5792deda06ea89bcd3](https://github.com/auth0/node-jsonwebtoken/commit/5d559ced3fbf10c1adae2e5792deda06ea89bcd3))
|
||||
- minor ([6e81ff87a3799b0e56db09cbae42a97e784716c4](https://github.com/auth0/node-jsonwebtoken/commit/6e81ff87a3799b0e56db09cbae42a97e784716c4))
|
||||
|
||||
|
||||
|
||||
## 5.1.0 - 2015-10-02
|
||||
|
||||
|
||||
- added async signing ([9414fbcb15a1f9cf4fe147d070e9424c547dabba](https://github.com/auth0/node-jsonwebtoken/commit/9414fbcb15a1f9cf4fe147d070e9424c547dabba))
|
||||
- Update README.md ([40b2aaaa843442dfb8ee7b574f0a788177e7c904](https://github.com/auth0/node-jsonwebtoken/commit/40b2aaaa843442dfb8ee7b574f0a788177e7c904))
|
||||
|
||||
|
||||
|
||||
## 5.0.5 - 2015-08-19
|
||||
|
||||
|
||||
- add ms dep to package.json ([f13b3fb7f29dff787e7c91ebe2eb5adeeb05f251](https://github.com/auth0/node-jsonwebtoken/commit/f13b3fb7f29dff787e7c91ebe2eb5adeeb05f251))
|
||||
- add note to explain, related to #96 #101 #6 ([dd8969e0e6ed0bcb9cae905d2b1a96476bd85da3](https://github.com/auth0/node-jsonwebtoken/commit/dd8969e0e6ed0bcb9cae905d2b1a96476bd85da3))
|
||||
- add tests for options.headers ([7787dd74e705787c39a871ca29c75a2e0a3948ac](https://github.com/auth0/node-jsonwebtoken/commit/7787dd74e705787c39a871ca29c75a2e0a3948ac))
|
||||
- add tests for verify expires ([d7c5793d98c300603440ab460c11665f661ad3a0](https://github.com/auth0/node-jsonwebtoken/commit/d7c5793d98c300603440ab460c11665f661ad3a0))
|
||||
- add verify option maxAge (with tests) ([49d54e54f7e70b1c53a2e4ee67e116c907d75319](https://github.com/auth0/node-jsonwebtoken/commit/49d54e54f7e70b1c53a2e4ee67e116c907d75319))
|
||||
- fix spelling error in error message ([8078b11b224fa05ac9003ca5aa2c85e9f0128cfb](https://github.com/auth0/node-jsonwebtoken/commit/8078b11b224fa05ac9003ca5aa2c85e9f0128cfb))
|
||||
- Fix typo options.header is not a documented option + ([5feaa5b962ccbddeff054817a410f7b0c1e6ce7f](https://github.com/auth0/node-jsonwebtoken/commit/5feaa5b962ccbddeff054817a410f7b0c1e6ce7f))
|
||||
- update JWT spec link. closes #112 ([f5fa50f797456a12240589161835c7ea30807195](https://github.com/auth0/node-jsonwebtoken/commit/f5fa50f797456a12240589161835c7ea30807195)), closes [#112](https://github.com/auth0/node-jsonwebtoken/issues/112)
|
||||
|
||||
|
||||
## 5.0.3 - 2015-07-15
|
||||
|
||||
- Added nbf support ([f26ba4e2fa197a20497632b63ffcd13ae93aacc4](https://github.com/auth0/node-jsonwebtoken/commit/f26ba4e2fa197a20497632b63ffcd13ae93aacc4))
|
||||
- Added support for subject and jwt id ([ab76ec5bc554e2d1e25376ddb7cea711d86af651](https://github.com/auth0/node-jsonwebtoken/commit/ab76ec5bc554e2d1e25376ddb7cea711d86af651))
|
||||
- Fix `this` referring to the global object instead of `module.exports` in `verify()` ([93f554312e37129027fcf4916f48cb8d1b53588c](https://github.com/auth0/node-jsonwebtoken/commit/93f554312e37129027fcf4916f48cb8d1b53588c))
|
||||
- Fix typo, line 139 README, complete option for .decode. ([59c110aeb8c7c1847ef2ffd77702d13627c89e10](https://github.com/auth0/node-jsonwebtoken/commit/59c110aeb8c7c1847ef2ffd77702d13627c89e10))
|
||||
- minor ([61ff1172272b582902313e958058ff22413494af](https://github.com/auth0/node-jsonwebtoken/commit/61ff1172272b582902313e958058ff22413494af))
|
||||
|
||||
|
||||
|
||||
## 5.0.2 - 2015-06-15
|
||||
|
||||
|
||||
- fix typo in docs . closes #86 ([3d3413221f36acef4dfd1cbed87f1f3565cd6f84](https://github.com/auth0/node-jsonwebtoken/commit/3d3413221f36acef4dfd1cbed87f1f3565cd6f84)), closes [#86](https://github.com/auth0/node-jsonwebtoken/issues/86)
|
||||
|
||||
|
||||
|
||||
## 5.0.1 - 2015-05-15
|
||||
|
||||
|
||||
- Add option to return header and payload when decoding. ([7254e011b59f892d1947e6c11819281adac7069d](https://github.com/auth0/node-jsonwebtoken/commit/7254e011b59f892d1947e6c11819281adac7069d))
|
||||
- Avoid uncaught "SyntaxError: Unexpected token ͧ" error. ([0dc59cd6ee15d83a606acffa7909ee76176ae186](https://github.com/auth0/node-jsonwebtoken/commit/0dc59cd6ee15d83a606acffa7909ee76176ae186))
|
||||
- Document complete option in README. ([ec32b20241a74d9681ea26e1a7024b4642468c00](https://github.com/auth0/node-jsonwebtoken/commit/ec32b20241a74d9681ea26e1a7024b4642468c00))
|
||||
- Fix example in README, silence verbose logging. ([ba3174d10033c41e9c211a38f1cc67f74fbd7f69](https://github.com/auth0/node-jsonwebtoken/commit/ba3174d10033c41e9c211a38f1cc67f74fbd7f69))
|
||||
- Fix link to auth0.com in README ([1b3c5ff72c9bc25e9271646e679f3080f2a042a0](https://github.com/auth0/node-jsonwebtoken/commit/1b3c5ff72c9bc25e9271646e679f3080f2a042a0))
|
||||
- Immediate return if not decoded. ([851bda2b10168f3269c3da6e74d310742f31a193](https://github.com/auth0/node-jsonwebtoken/commit/851bda2b10168f3269c3da6e74d310742f31a193))
|
||||
- Prevent throw on undefined/null secret ([0fdf78d4dbf609455f3277d6169a987aef0384d4](https://github.com/auth0/node-jsonwebtoken/commit/0fdf78d4dbf609455f3277d6169a987aef0384d4))
|
||||
- Removed path from test ([d6240e24186732d368bffe21143becf44c38f0d6](https://github.com/auth0/node-jsonwebtoken/commit/d6240e24186732d368bffe21143becf44c38f0d6))
|
||||
- Simplified checking for missing key ([f1cffd033bffc44f20558eda4a797c3fa2f4ee05](https://github.com/auth0/node-jsonwebtoken/commit/f1cffd033bffc44f20558eda4a797c3fa2f4ee05))
|
||||
- Typo ([ffe68dbe0219bab535c1018448eb4c0b22f1f902](https://github.com/auth0/node-jsonwebtoken/commit/ffe68dbe0219bab535c1018448eb4c0b22f1f902))
|
||||
- Update CHANGELOG.md ([927cce0dad1bc9aad75aeef53e276cf4cfc0d776](https://github.com/auth0/node-jsonwebtoken/commit/927cce0dad1bc9aad75aeef53e276cf4cfc0d776))
|
||||
- Update CHANGELOG.md ([6879e0fdde222995c70a3a69a4af94993d9c667e](https://github.com/auth0/node-jsonwebtoken/commit/6879e0fdde222995c70a3a69a4af94993d9c667e))
|
||||
- Update CHANGELOG.md ([c5596c10e8705727fa13e0394184a606083078bc](https://github.com/auth0/node-jsonwebtoken/commit/c5596c10e8705727fa13e0394184a606083078bc))
|
||||
- Update CHANGELOG.md ([07541f0315f26d179e1cde92732b6124d6869b6f](https://github.com/auth0/node-jsonwebtoken/commit/07541f0315f26d179e1cde92732b6124d6869b6f))
|
||||
- Update CHANGELOG.md ([e6465d48ddd1dc2c3297229b28c78fd5490a2ba9](https://github.com/auth0/node-jsonwebtoken/commit/e6465d48ddd1dc2c3297229b28c78fd5490a2ba9))
|
||||
|
||||
## [5.0.0] - 2015-04-11
|
||||
|
||||
### Changed
|
||||
|
||||
- [sign] Only set defautl `iat` if the user does not specify that argument.
|
||||
|
||||
https://github.com/auth0/node-jsonwebtoken/commit/e900282a8d2dff1d4dec815f7e6aa7782e867d91
|
||||
https://github.com/auth0/node-jsonwebtoken/commit/35036b188b4ee6b42df553bbb93bc8a6b19eae9d
|
||||
https://github.com/auth0/node-jsonwebtoken/commit/954bd7a312934f03036b6bb6f00edd41f29e54d9
|
||||
https://github.com/auth0/node-jsonwebtoken/commit/24a370080e0b75f11d4717cd2b11b2949d95fc2e
|
||||
https://github.com/auth0/node-jsonwebtoken/commit/a77df6d49d4ec688dfd0a1cc723586bffe753516
|
||||
|
||||
### Security
|
||||
|
||||
- [verify] Update to jws@^3.0.0 and renaming `header.alg` mismatch exception to `invalid algorithm` and adding more mismatch tests.
|
||||
|
||||
As `jws@3.0.0` changed the verify method signature to be `jws.verify(signature, algorithm, secretOrKey)`, the token header must be decoded first in order to make sure that the `alg` field matches one of the allowed `options.algorithms`. After that, the now validated `header.alg` is passed to `jws.verify`
|
||||
|
||||
As the order of steps has changed, the error that was thrown when the JWT was invalid is no longer the `jws` one:
|
||||
```
|
||||
{ [Error: Invalid token: no header in signature 'a.b.c'] code: 'MISSING_HEADER', signature: 'a.b.c' }
|
||||
```
|
||||
|
||||
That old error (removed from jws) has been replaced by a `JsonWebTokenError` with message `invalid token`.
|
||||
|
||||
> Important: versions >= 4.2.2 this library are safe to use but we decided to deprecate everything `< 5.0.0` to prevent security warnings from library `node-jws` when doing `npm install`.
|
||||
|
||||
https://github.com/auth0/node-jsonwebtoken/commit/634b8ed0ff5267dc25da5c808634208af109824e
|
||||
https://github.com/auth0/node-jsonwebtoken/commit/9f24ffd5791febb449d4d03ff58d7807da9b9b7e
|
||||
https://github.com/auth0/node-jsonwebtoken/commit/19e6cc6a1f2fd90356f89b074223b9665f2aa8a2
|
||||
https://github.com/auth0/node-jsonwebtoken/commit/1e4623420159c6410616f02a44ed240f176287a9
|
||||
https://github.com/auth0/node-jsonwebtoken/commit/954bd7a312934f03036b6bb6f00edd41f29e54d9
|
||||
https://github.com/auth0/node-jsonwebtoken/commit/24a370080e0b75f11d4717cd2b11b2949d95fc2e
|
||||
https://github.com/auth0/node-jsonwebtoken/commit/a77df6d49d4ec688dfd0a1cc723586bffe753516
|
||||
|
||||
## [4.2.2] - 2015-03-26
|
||||
### Fixed
|
||||
|
||||
- [asymmetric-keys] Fix verify for RSAPublicKey formated keys (`jfromaniello - awlayton`)
|
||||
https://github.com/auth0/node-jsonwebtoken/commit/402794663b9521bf602fcc6f2e811e7d3912f9dc
|
||||
https://github.com/auth0/node-jsonwebtoken/commit/8df6aabbc7e1114c8fb3917931078254eb52c222
|
||||
|
||||
## [4.2.1] - 2015-03-17
|
||||
### Fixed
|
||||
|
||||
- [asymmetric-keys] Fixed issue when public key starts with BEING PUBLIC KEY (https://github.com/auth0/node-jsonwebtoken/issues/70) (`jfromaniello`)
|
||||
https://github.com/auth0/node-jsonwebtoken/commit/7017e74db9b194448ff488b3e16468ada60c4ee5
|
||||
|
||||
## [4.2.0] - 2015-03-16
|
||||
### Security
|
||||
|
||||
- [asymmetric-keys] Making sure a token signed with an asymmetric key will be verified using a asymmetric key.
|
||||
When the verification part was expecting a token digitally signed with an asymmetric key (RS/ES family) of algorithms an attacker could send a token signed with a symmetric algorithm (HS* family).
|
||||
|
||||
The issue was caused because the same signature was used to verify both type of tokens (`verify` method parameter: `secretOrPublicKey`).
|
||||
|
||||
This change adds a new parameter to the verify called `algorithms`. This can be used to specify a list of supported algorithms, but the default value depends on the secret used: if the secretOrPublicKey contains the string `BEGIN CERTIFICATE` the default is `[ 'RS256','RS384','RS512','ES256','ES384','ES512' ]` otherwise is `[ 'HS256','HS384','HS512' ]`. (`jfromaniello`)
|
||||
https://github.com/auth0/node-jsonwebtoken/commit/c2bf7b2cd7e8daf66298c2d168a008690bc4bdd3
|
||||
https://github.com/auth0/node-jsonwebtoken/commit/1bb584bc382295eeb7ee8c4452a673a77a68b687
|
||||
|
||||
## [4.1.0] - 2015-03-10
|
||||
### Changed
|
||||
- Assume the payload is JSON even when there is no `typ` property. [5290db1](https://github.com/auth0/node-jsonwebtoken/commit/5290db1bd74f74cd38c90b19e2355ef223a4d931)
|
||||
|
||||
## [4.0.0] - 2015-03-06
|
||||
### Changed
|
||||
- The default encoding is now utf8 instead of binary. [92d33bd](https://github.com/auth0/node-jsonwebtoken/commit/92d33bd99a3416e9e5a8897d9ad8ff7d70a00bfd)
|
||||
- Add `encoding` as a new option to `sign`. [1fc385e](https://github.com/auth0/node-jsonwebtoken/commit/1fc385ee10bd0018cd1441552dce6c2e5a16375f)
|
||||
- Add `ignoreExpiration` to `verify`. [8d4da27](https://github.com/auth0/node-jsonwebtoken/commit/8d4da279e1b351ac71ace276285c9255186d549f)
|
||||
- Add `expiresInSeconds` to `sign`. [dd156cc](https://github.com/auth0/node-jsonwebtoken/commit/dd156cc30f17028744e60aec0502897e34609329)
|
||||
|
||||
### Fixed
|
||||
- Fix wrong error message when the audience doesn't match. [44e3c8d](https://github.com/auth0/node-jsonwebtoken/commit/44e3c8d757e6b4e2a57a69a035f26b4abec3e327)
|
||||
- Fix wrong error message when the issuer doesn't match. [44e3c8d](https://github.com/auth0/node-jsonwebtoken/commit/44e3c8d757e6b4e2a57a69a035f26b4abec3e327)
|
||||
- Fix wrong `iat` and `exp` values when signing with `noTimestamp`. [331b7bc](https://github.com/auth0/node-jsonwebtoken/commit/331b7bc9cc335561f8806f2c4558e105cb53e0a6)
|
21
node_modules/jsonwebtoken/LICENSE
generated
vendored
Normal file
21
node_modules/jsonwebtoken/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Auth0, Inc. <support@auth0.com> (http://auth0.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.
|
375
node_modules/jsonwebtoken/README.md
generated
vendored
Normal file
375
node_modules/jsonwebtoken/README.md
generated
vendored
Normal file
@ -0,0 +1,375 @@
|
||||
# jsonwebtoken
|
||||
|
||||
| **Build** | **Dependency** |
|
||||
|-----------|---------------|
|
||||
| [](http://travis-ci.org/auth0/node-jsonwebtoken) | [](https://david-dm.org/auth0/node-jsonwebtoken) |
|
||||
|
||||
|
||||
An implementation of [JSON Web Tokens](https://tools.ietf.org/html/rfc7519).
|
||||
|
||||
This was developed against `draft-ietf-oauth-json-web-token-08`. It makes use of [node-jws](https://github.com/brianloveswords/node-jws)
|
||||
|
||||
# Install
|
||||
|
||||
```bash
|
||||
$ npm install jsonwebtoken
|
||||
```
|
||||
|
||||
# Migration notes
|
||||
|
||||
* [From v7 to v8](https://github.com/auth0/node-jsonwebtoken/wiki/Migration-Notes:-v7-to-v8)
|
||||
|
||||
# Usage
|
||||
|
||||
### jwt.sign(payload, secretOrPrivateKey, [options, callback])
|
||||
|
||||
(Asynchronous) If a callback is supplied, the callback is called with the `err` or the JWT.
|
||||
|
||||
(Synchronous) Returns the JsonWebToken as string
|
||||
|
||||
`payload` could be an object literal, buffer or string representing valid JSON.
|
||||
> **Please _note_ that** `exp` or any other claim is only set if the payload is an object literal. Buffer or string payloads are not checked for JSON validity.
|
||||
|
||||
> If `payload` is not a buffer or a string, it will be coerced into a string using `JSON.stringify`.
|
||||
|
||||
`secretOrPrivateKey` is a string, buffer, or object containing either the secret for HMAC algorithms or the PEM
|
||||
encoded private key for RSA and ECDSA. In case of a private key with passphrase an object `{ key, passphrase }` can be used (based on [crypto documentation](https://nodejs.org/api/crypto.html#crypto_sign_sign_private_key_output_format)), in this case be sure you pass the `algorithm` option.
|
||||
|
||||
`options`:
|
||||
|
||||
* `algorithm` (default: `HS256`)
|
||||
* `expiresIn`: expressed in seconds or a string describing a time span [zeit/ms](https://github.com/zeit/ms).
|
||||
> Eg: `60`, `"2 days"`, `"10h"`, `"7d"`. A numeric value is interpreted as a seconds count. If you use a string be sure you provide the time units (days, hours, etc), otherwise milliseconds unit is used by default (`"120"` is equal to `"120ms"`).
|
||||
* `notBefore`: expressed in seconds or a string describing a time span [zeit/ms](https://github.com/zeit/ms).
|
||||
> Eg: `60`, `"2 days"`, `"10h"`, `"7d"`. A numeric value is interpreted as a seconds count. If you use a string be sure you provide the time units (days, hours, etc), otherwise milliseconds unit is used by default (`"120"` is equal to `"120ms"`).
|
||||
* `audience`
|
||||
* `issuer`
|
||||
* `jwtid`
|
||||
* `subject`
|
||||
* `noTimestamp`
|
||||
* `header`
|
||||
* `keyid`
|
||||
* `mutatePayload`: if true, the sign function will modify the payload object directly. This is useful if you need a raw reference to the payload after claims have been applied to it but before it has been encoded into a token.
|
||||
|
||||
|
||||
|
||||
> There are no default values for `expiresIn`, `notBefore`, `audience`, `subject`, `issuer`. These claims can also be provided in the payload directly with `exp`, `nbf`, `aud`, `sub` and `iss` respectively, but you **_can't_** include in both places.
|
||||
|
||||
Remember that `exp`, `nbf` and `iat` are **NumericDate**, see related [Token Expiration (exp claim)](#token-expiration-exp-claim)
|
||||
|
||||
|
||||
The header can be customized via the `options.header` object.
|
||||
|
||||
Generated jwts will include an `iat` (issued at) claim by default unless `noTimestamp` is specified. If `iat` is inserted in the payload, it will be used instead of the real timestamp for calculating other things like `exp` given a timespan in `options.expiresIn`.
|
||||
|
||||
Synchronous Sign with default (HMAC SHA256)
|
||||
|
||||
```js
|
||||
var jwt = require('jsonwebtoken');
|
||||
var token = jwt.sign({ foo: 'bar' }, 'shhhhh');
|
||||
```
|
||||
|
||||
Synchronous Sign with RSA SHA256
|
||||
```js
|
||||
// sign with RSA SHA256
|
||||
var privateKey = fs.readFileSync('private.key');
|
||||
var token = jwt.sign({ foo: 'bar' }, privateKey, { algorithm: 'RS256'});
|
||||
```
|
||||
|
||||
Sign asynchronously
|
||||
```js
|
||||
jwt.sign({ foo: 'bar' }, privateKey, { algorithm: 'RS256' }, function(err, token) {
|
||||
console.log(token);
|
||||
});
|
||||
```
|
||||
|
||||
Backdate a jwt 30 seconds
|
||||
```js
|
||||
var older_token = jwt.sign({ foo: 'bar', iat: Math.floor(Date.now() / 1000) - 30 }, 'shhhhh');
|
||||
```
|
||||
|
||||
#### Token Expiration (exp claim)
|
||||
|
||||
The standard for JWT defines an `exp` claim for expiration. The expiration is represented as a **NumericDate**:
|
||||
|
||||
> A JSON numeric value representing the number of seconds from 1970-01-01T00:00:00Z UTC until the specified UTC date/time, ignoring leap seconds. This is equivalent to the IEEE Std 1003.1, 2013 Edition [POSIX.1] definition "Seconds Since the Epoch", in which each day is accounted for by exactly 86400 seconds, other than that non-integer values can be represented. See RFC 3339 [RFC3339] for details regarding date/times in general and UTC in particular.
|
||||
|
||||
This means that the `exp` field should contain the number of seconds since the epoch.
|
||||
|
||||
Signing a token with 1 hour of expiration:
|
||||
|
||||
```javascript
|
||||
jwt.sign({
|
||||
exp: Math.floor(Date.now() / 1000) + (60 * 60),
|
||||
data: 'foobar'
|
||||
}, 'secret');
|
||||
```
|
||||
|
||||
Another way to generate a token like this with this library is:
|
||||
|
||||
```javascript
|
||||
jwt.sign({
|
||||
data: 'foobar'
|
||||
}, 'secret', { expiresIn: 60 * 60 });
|
||||
|
||||
//or even better:
|
||||
|
||||
jwt.sign({
|
||||
data: 'foobar'
|
||||
}, 'secret', { expiresIn: '1h' });
|
||||
```
|
||||
|
||||
### jwt.verify(token, secretOrPublicKey, [options, callback])
|
||||
|
||||
(Asynchronous) If a callback is supplied, function acts asynchronously. The callback is called with the decoded payload if the signature is valid and optional expiration, audience, or issuer are valid. If not, it will be called with the error.
|
||||
|
||||
(Synchronous) If a callback is not supplied, function acts synchronously. Returns the payload decoded if the signature is valid and optional expiration, audience, or issuer are valid. If not, it will throw the error.
|
||||
|
||||
`token` is the JsonWebToken string
|
||||
|
||||
`secretOrPublicKey` is a string or buffer containing either the secret for HMAC algorithms, or the PEM
|
||||
encoded public key for RSA and ECDSA.
|
||||
If `jwt.verify` is called asynchronous, `secretOrPublicKey` can be a function that should fetch the secret or public key. See below for a detailed example
|
||||
|
||||
As mentioned in [this comment](https://github.com/auth0/node-jsonwebtoken/issues/208#issuecomment-231861138), there are other libraries that expect base64 encoded secrets (random bytes encoded using base64), if that is your case you can pass `Buffer.from(secret, 'base64')`, by doing this the secret will be decoded using base64 and the token verification will use the original random bytes.
|
||||
|
||||
`options`
|
||||
|
||||
* `algorithms`: List of strings with the names of the allowed algorithms. For instance, `["HS256", "HS384"]`.
|
||||
* `audience`: if you want to check audience (`aud`), provide a value here. The audience can be checked against a string, a regular expression or a list of strings and/or regular expressions.
|
||||
> Eg: `"urn:foo"`, `/urn:f[o]{2}/`, `[/urn:f[o]{2}/, "urn:bar"]`
|
||||
* `complete`: return an object with the decoded `{ payload, header, signature }` instead of only the usual content of the payload.
|
||||
* `issuer` (optional): string or array of strings of valid values for the `iss` field.
|
||||
* `ignoreExpiration`: if `true` do not validate the expiration of the token.
|
||||
* `ignoreNotBefore`...
|
||||
* `subject`: if you want to check subject (`sub`), provide a value here
|
||||
* `clockTolerance`: number of seconds to tolerate when checking the `nbf` and `exp` claims, to deal with small clock differences among different servers
|
||||
* `maxAge`: the maximum allowed age for tokens to still be valid. It is expressed in seconds or a string describing a time span [zeit/ms](https://github.com/zeit/ms).
|
||||
> Eg: `1000`, `"2 days"`, `"10h"`, `"7d"`. A numeric value is interpreted as a seconds count. If you use a string be sure you provide the time units (days, hours, etc), otherwise milliseconds unit is used by default (`"120"` is equal to `"120ms"`).
|
||||
* `clockTimestamp`: the time in seconds that should be used as the current time for all necessary comparisons.
|
||||
* `nonce`: if you want to check `nonce` claim, provide a string value here. It is used on Open ID for the ID Tokens. ([Open ID implementation notes](https://openid.net/specs/openid-connect-core-1_0.html#NonceNotes))
|
||||
|
||||
|
||||
```js
|
||||
// verify a token symmetric - synchronous
|
||||
var decoded = jwt.verify(token, 'shhhhh');
|
||||
console.log(decoded.foo) // bar
|
||||
|
||||
// verify a token symmetric
|
||||
jwt.verify(token, 'shhhhh', function(err, decoded) {
|
||||
console.log(decoded.foo) // bar
|
||||
});
|
||||
|
||||
// invalid token - synchronous
|
||||
try {
|
||||
var decoded = jwt.verify(token, 'wrong-secret');
|
||||
} catch(err) {
|
||||
// err
|
||||
}
|
||||
|
||||
// invalid token
|
||||
jwt.verify(token, 'wrong-secret', function(err, decoded) {
|
||||
// err
|
||||
// decoded undefined
|
||||
});
|
||||
|
||||
// verify a token asymmetric
|
||||
var cert = fs.readFileSync('public.pem'); // get public key
|
||||
jwt.verify(token, cert, function(err, decoded) {
|
||||
console.log(decoded.foo) // bar
|
||||
});
|
||||
|
||||
// verify audience
|
||||
var cert = fs.readFileSync('public.pem'); // get public key
|
||||
jwt.verify(token, cert, { audience: 'urn:foo' }, function(err, decoded) {
|
||||
// if audience mismatch, err == invalid audience
|
||||
});
|
||||
|
||||
// verify issuer
|
||||
var cert = fs.readFileSync('public.pem'); // get public key
|
||||
jwt.verify(token, cert, { audience: 'urn:foo', issuer: 'urn:issuer' }, function(err, decoded) {
|
||||
// if issuer mismatch, err == invalid issuer
|
||||
});
|
||||
|
||||
// verify jwt id
|
||||
var cert = fs.readFileSync('public.pem'); // get public key
|
||||
jwt.verify(token, cert, { audience: 'urn:foo', issuer: 'urn:issuer', jwtid: 'jwtid' }, function(err, decoded) {
|
||||
// if jwt id mismatch, err == invalid jwt id
|
||||
});
|
||||
|
||||
// verify subject
|
||||
var cert = fs.readFileSync('public.pem'); // get public key
|
||||
jwt.verify(token, cert, { audience: 'urn:foo', issuer: 'urn:issuer', jwtid: 'jwtid', subject: 'subject' }, function(err, decoded) {
|
||||
// if subject mismatch, err == invalid subject
|
||||
});
|
||||
|
||||
// alg mismatch
|
||||
var cert = fs.readFileSync('public.pem'); // get public key
|
||||
jwt.verify(token, cert, { algorithms: ['RS256'] }, function (err, payload) {
|
||||
// if token alg != RS256, err == invalid signature
|
||||
});
|
||||
|
||||
// Verify using getKey callback
|
||||
// Example uses https://github.com/auth0/node-jwks-rsa as a way to fetch the keys.
|
||||
var jwksClient = require('jwks-rsa');
|
||||
var client = jwksClient({
|
||||
jwksUri: 'https://sandrino.auth0.com/.well-known/jwks.json'
|
||||
});
|
||||
function getKey(header, callback){
|
||||
client.getSigningKey(header.kid, function(err, key) {
|
||||
var signingKey = key.publicKey || key.rsaPublicKey;
|
||||
callback(null, signingKey);
|
||||
});
|
||||
}
|
||||
|
||||
jwt.verify(token, getKey, options, function(err, decoded) {
|
||||
console.log(decoded.foo) // bar
|
||||
});
|
||||
|
||||
```
|
||||
|
||||
### jwt.decode(token [, options])
|
||||
|
||||
(Synchronous) Returns the decoded payload without verifying if the signature is valid.
|
||||
|
||||
> __Warning:__ This will __not__ verify whether the signature is valid. You should __not__ use this for untrusted messages. You most likely want to use `jwt.verify` instead.
|
||||
|
||||
`token` is the JsonWebToken string
|
||||
|
||||
`options`:
|
||||
|
||||
* `json`: force JSON.parse on the payload even if the header doesn't contain `"typ":"JWT"`.
|
||||
* `complete`: return an object with the decoded payload and header.
|
||||
|
||||
Example
|
||||
|
||||
```js
|
||||
// get the decoded payload ignoring signature, no secretOrPrivateKey needed
|
||||
var decoded = jwt.decode(token);
|
||||
|
||||
// get the decoded payload and header
|
||||
var decoded = jwt.decode(token, {complete: true});
|
||||
console.log(decoded.header);
|
||||
console.log(decoded.payload)
|
||||
```
|
||||
|
||||
## Errors & Codes
|
||||
Possible thrown errors during verification.
|
||||
Error is the first argument of the verification callback.
|
||||
|
||||
### TokenExpiredError
|
||||
|
||||
Thrown error if the token is expired.
|
||||
|
||||
Error object:
|
||||
|
||||
* name: 'TokenExpiredError'
|
||||
* message: 'jwt expired'
|
||||
* expiredAt: [ExpDate]
|
||||
|
||||
```js
|
||||
jwt.verify(token, 'shhhhh', function(err, decoded) {
|
||||
if (err) {
|
||||
/*
|
||||
err = {
|
||||
name: 'TokenExpiredError',
|
||||
message: 'jwt expired',
|
||||
expiredAt: 1408621000
|
||||
}
|
||||
*/
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
### JsonWebTokenError
|
||||
Error object:
|
||||
|
||||
* name: 'JsonWebTokenError'
|
||||
* message:
|
||||
* 'jwt malformed'
|
||||
* 'jwt signature is required'
|
||||
* 'invalid signature'
|
||||
* 'jwt audience invalid. expected: [OPTIONS AUDIENCE]'
|
||||
* 'jwt issuer invalid. expected: [OPTIONS ISSUER]'
|
||||
* 'jwt id invalid. expected: [OPTIONS JWT ID]'
|
||||
* 'jwt subject invalid. expected: [OPTIONS SUBJECT]'
|
||||
|
||||
```js
|
||||
jwt.verify(token, 'shhhhh', function(err, decoded) {
|
||||
if (err) {
|
||||
/*
|
||||
err = {
|
||||
name: 'JsonWebTokenError',
|
||||
message: 'jwt malformed'
|
||||
}
|
||||
*/
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
### NotBeforeError
|
||||
Thrown if current time is before the nbf claim.
|
||||
|
||||
Error object:
|
||||
|
||||
* name: 'NotBeforeError'
|
||||
* message: 'jwt not active'
|
||||
* date: 2018-10-04T16:10:44.000Z
|
||||
|
||||
```js
|
||||
jwt.verify(token, 'shhhhh', function(err, decoded) {
|
||||
if (err) {
|
||||
/*
|
||||
err = {
|
||||
name: 'NotBeforeError',
|
||||
message: 'jwt not active',
|
||||
date: 2018-10-04T16:10:44.000Z
|
||||
}
|
||||
*/
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
## Algorithms supported
|
||||
|
||||
Array of supported algorithms. The following algorithms are currently supported.
|
||||
|
||||
alg Parameter Value | Digital Signature or MAC Algorithm
|
||||
----------------|----------------------------
|
||||
HS256 | HMAC using SHA-256 hash algorithm
|
||||
HS384 | HMAC using SHA-384 hash algorithm
|
||||
HS512 | HMAC using SHA-512 hash algorithm
|
||||
RS256 | RSASSA-PKCS1-v1_5 using SHA-256 hash algorithm
|
||||
RS384 | RSASSA-PKCS1-v1_5 using SHA-384 hash algorithm
|
||||
RS512 | RSASSA-PKCS1-v1_5 using SHA-512 hash algorithm
|
||||
PS256 | RSASSA-PSS using SHA-256 hash algorithm (only node ^6.12.0 || >=8.0.0)
|
||||
PS384 | RSASSA-PSS using SHA-384 hash algorithm (only node ^6.12.0 || >=8.0.0)
|
||||
PS512 | RSASSA-PSS using SHA-512 hash algorithm (only node ^6.12.0 || >=8.0.0)
|
||||
ES256 | ECDSA using P-256 curve and SHA-256 hash algorithm
|
||||
ES384 | ECDSA using P-384 curve and SHA-384 hash algorithm
|
||||
ES512 | ECDSA using P-521 curve and SHA-512 hash algorithm
|
||||
none | No digital signature or MAC value included
|
||||
|
||||
## Refreshing JWTs
|
||||
|
||||
First of all, we recommend you to think carefully if auto-refreshing a JWT will not introduce any vulnerability in your system.
|
||||
|
||||
We are not comfortable including this as part of the library, however, you can take a look at [this example](https://gist.github.com/ziluvatar/a3feb505c4c0ec37059054537b38fc48) to show how this could be accomplished.
|
||||
Apart from that example there are [an issue](https://github.com/auth0/node-jsonwebtoken/issues/122) and [a pull request](https://github.com/auth0/node-jsonwebtoken/pull/172) to get more knowledge about this topic.
|
||||
|
||||
# TODO
|
||||
|
||||
* X.509 certificate chain is not checked
|
||||
|
||||
## Issue Reporting
|
||||
|
||||
If you have found a bug or if you have a feature request, please report them at this repository issues section. Please do not report security vulnerabilities on the public GitHub issue tracker. The [Responsible Disclosure Program](https://auth0.com/whitehat) details the procedure for disclosing security issues.
|
||||
|
||||
## Author
|
||||
|
||||
[Auth0](https://auth0.com)
|
||||
|
||||
## License
|
||||
|
||||
This project is licensed under the MIT license. See the [LICENSE](LICENSE) file for more info.
|
30
node_modules/jsonwebtoken/decode.js
generated
vendored
Normal file
30
node_modules/jsonwebtoken/decode.js
generated
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
var jws = require('jws');
|
||||
|
||||
module.exports = function (jwt, options) {
|
||||
options = options || {};
|
||||
var decoded = jws.decode(jwt, options);
|
||||
if (!decoded) { return null; }
|
||||
var payload = decoded.payload;
|
||||
|
||||
//try parse the payload
|
||||
if(typeof payload === 'string') {
|
||||
try {
|
||||
var obj = JSON.parse(payload);
|
||||
if(obj !== null && typeof obj === 'object') {
|
||||
payload = obj;
|
||||
}
|
||||
} catch (e) { }
|
||||
}
|
||||
|
||||
//return header if `complete` option is enabled. header includes claims
|
||||
//such as `kid` and `alg` used to select the key within a JWKS needed to
|
||||
//verify the signature
|
||||
if (options.complete === true) {
|
||||
return {
|
||||
header: decoded.header,
|
||||
payload: payload,
|
||||
signature: decoded.signature
|
||||
};
|
||||
}
|
||||
return payload;
|
||||
};
|
8
node_modules/jsonwebtoken/index.js
generated
vendored
Normal file
8
node_modules/jsonwebtoken/index.js
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
module.exports = {
|
||||
decode: require('./decode'),
|
||||
verify: require('./verify'),
|
||||
sign: require('./sign'),
|
||||
JsonWebTokenError: require('./lib/JsonWebTokenError'),
|
||||
NotBeforeError: require('./lib/NotBeforeError'),
|
||||
TokenExpiredError: require('./lib/TokenExpiredError'),
|
||||
};
|
14
node_modules/jsonwebtoken/lib/JsonWebTokenError.js
generated
vendored
Normal file
14
node_modules/jsonwebtoken/lib/JsonWebTokenError.js
generated
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
var JsonWebTokenError = function (message, error) {
|
||||
Error.call(this, message);
|
||||
if(Error.captureStackTrace) {
|
||||
Error.captureStackTrace(this, this.constructor);
|
||||
}
|
||||
this.name = 'JsonWebTokenError';
|
||||
this.message = message;
|
||||
if (error) this.inner = error;
|
||||
};
|
||||
|
||||
JsonWebTokenError.prototype = Object.create(Error.prototype);
|
||||
JsonWebTokenError.prototype.constructor = JsonWebTokenError;
|
||||
|
||||
module.exports = JsonWebTokenError;
|
13
node_modules/jsonwebtoken/lib/NotBeforeError.js
generated
vendored
Normal file
13
node_modules/jsonwebtoken/lib/NotBeforeError.js
generated
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
var JsonWebTokenError = require('./JsonWebTokenError');
|
||||
|
||||
var NotBeforeError = function (message, date) {
|
||||
JsonWebTokenError.call(this, message);
|
||||
this.name = 'NotBeforeError';
|
||||
this.date = date;
|
||||
};
|
||||
|
||||
NotBeforeError.prototype = Object.create(JsonWebTokenError.prototype);
|
||||
|
||||
NotBeforeError.prototype.constructor = NotBeforeError;
|
||||
|
||||
module.exports = NotBeforeError;
|
13
node_modules/jsonwebtoken/lib/TokenExpiredError.js
generated
vendored
Normal file
13
node_modules/jsonwebtoken/lib/TokenExpiredError.js
generated
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
var JsonWebTokenError = require('./JsonWebTokenError');
|
||||
|
||||
var TokenExpiredError = function (message, expiredAt) {
|
||||
JsonWebTokenError.call(this, message);
|
||||
this.name = 'TokenExpiredError';
|
||||
this.expiredAt = expiredAt;
|
||||
};
|
||||
|
||||
TokenExpiredError.prototype = Object.create(JsonWebTokenError.prototype);
|
||||
|
||||
TokenExpiredError.prototype.constructor = TokenExpiredError;
|
||||
|
||||
module.exports = TokenExpiredError;
|
3
node_modules/jsonwebtoken/lib/psSupported.js
generated
vendored
Normal file
3
node_modules/jsonwebtoken/lib/psSupported.js
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
var semver = require('semver');
|
||||
|
||||
module.exports = semver.satisfies(process.version, '^6.12.0 || >=8.0.0');
|
18
node_modules/jsonwebtoken/lib/timespan.js
generated
vendored
Normal file
18
node_modules/jsonwebtoken/lib/timespan.js
generated
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
var ms = require('ms');
|
||||
|
||||
module.exports = function (time, iat) {
|
||||
var timestamp = iat || Math.floor(Date.now() / 1000);
|
||||
|
||||
if (typeof time === 'string') {
|
||||
var milliseconds = ms(time);
|
||||
if (typeof milliseconds === 'undefined') {
|
||||
return;
|
||||
}
|
||||
return Math.floor(timestamp + milliseconds / 1000);
|
||||
} else if (typeof time === 'number') {
|
||||
return timestamp + time;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
};
|
162
node_modules/jsonwebtoken/node_modules/ms/index.js
generated
vendored
Normal file
162
node_modules/jsonwebtoken/node_modules/ms/index.js
generated
vendored
Normal file
@ -0,0 +1,162 @@
|
||||
/**
|
||||
* Helpers.
|
||||
*/
|
||||
|
||||
var s = 1000;
|
||||
var m = s * 60;
|
||||
var h = m * 60;
|
||||
var d = h * 24;
|
||||
var w = d * 7;
|
||||
var y = d * 365.25;
|
||||
|
||||
/**
|
||||
* Parse or format the given `val`.
|
||||
*
|
||||
* Options:
|
||||
*
|
||||
* - `long` verbose formatting [false]
|
||||
*
|
||||
* @param {String|Number} val
|
||||
* @param {Object} [options]
|
||||
* @throws {Error} throw an error if val is not a non-empty string or a number
|
||||
* @return {String|Number}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
module.exports = function(val, options) {
|
||||
options = options || {};
|
||||
var type = typeof val;
|
||||
if (type === 'string' && val.length > 0) {
|
||||
return parse(val);
|
||||
} else if (type === 'number' && isNaN(val) === false) {
|
||||
return options.long ? fmtLong(val) : fmtShort(val);
|
||||
}
|
||||
throw new Error(
|
||||
'val is not a non-empty string or a valid number. val=' +
|
||||
JSON.stringify(val)
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Parse the given `str` and return milliseconds.
|
||||
*
|
||||
* @param {String} str
|
||||
* @return {Number}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function parse(str) {
|
||||
str = String(str);
|
||||
if (str.length > 100) {
|
||||
return;
|
||||
}
|
||||
var match = /^((?:\d+)?\-?\d?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
|
||||
str
|
||||
);
|
||||
if (!match) {
|
||||
return;
|
||||
}
|
||||
var n = parseFloat(match[1]);
|
||||
var type = (match[2] || 'ms').toLowerCase();
|
||||
switch (type) {
|
||||
case 'years':
|
||||
case 'year':
|
||||
case 'yrs':
|
||||
case 'yr':
|
||||
case 'y':
|
||||
return n * y;
|
||||
case 'weeks':
|
||||
case 'week':
|
||||
case 'w':
|
||||
return n * w;
|
||||
case 'days':
|
||||
case 'day':
|
||||
case 'd':
|
||||
return n * d;
|
||||
case 'hours':
|
||||
case 'hour':
|
||||
case 'hrs':
|
||||
case 'hr':
|
||||
case 'h':
|
||||
return n * h;
|
||||
case 'minutes':
|
||||
case 'minute':
|
||||
case 'mins':
|
||||
case 'min':
|
||||
case 'm':
|
||||
return n * m;
|
||||
case 'seconds':
|
||||
case 'second':
|
||||
case 'secs':
|
||||
case 'sec':
|
||||
case 's':
|
||||
return n * s;
|
||||
case 'milliseconds':
|
||||
case 'millisecond':
|
||||
case 'msecs':
|
||||
case 'msec':
|
||||
case 'ms':
|
||||
return n;
|
||||
default:
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Short format for `ms`.
|
||||
*
|
||||
* @param {Number} ms
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function fmtShort(ms) {
|
||||
var msAbs = Math.abs(ms);
|
||||
if (msAbs >= d) {
|
||||
return Math.round(ms / d) + 'd';
|
||||
}
|
||||
if (msAbs >= h) {
|
||||
return Math.round(ms / h) + 'h';
|
||||
}
|
||||
if (msAbs >= m) {
|
||||
return Math.round(ms / m) + 'm';
|
||||
}
|
||||
if (msAbs >= s) {
|
||||
return Math.round(ms / s) + 's';
|
||||
}
|
||||
return ms + 'ms';
|
||||
}
|
||||
|
||||
/**
|
||||
* Long format for `ms`.
|
||||
*
|
||||
* @param {Number} ms
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function fmtLong(ms) {
|
||||
var msAbs = Math.abs(ms);
|
||||
if (msAbs >= d) {
|
||||
return plural(ms, msAbs, d, 'day');
|
||||
}
|
||||
if (msAbs >= h) {
|
||||
return plural(ms, msAbs, h, 'hour');
|
||||
}
|
||||
if (msAbs >= m) {
|
||||
return plural(ms, msAbs, m, 'minute');
|
||||
}
|
||||
if (msAbs >= s) {
|
||||
return plural(ms, msAbs, s, 'second');
|
||||
}
|
||||
return ms + ' ms';
|
||||
}
|
||||
|
||||
/**
|
||||
* Pluralization helper.
|
||||
*/
|
||||
|
||||
function plural(ms, msAbs, n, name) {
|
||||
var isPlural = msAbs >= n * 1.5;
|
||||
return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
|
||||
}
|
21
node_modules/jsonwebtoken/node_modules/ms/license.md
generated
vendored
Normal file
21
node_modules/jsonwebtoken/node_modules/ms/license.md
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 Zeit, Inc.
|
||||
|
||||
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.
|
69
node_modules/jsonwebtoken/node_modules/ms/package.json
generated
vendored
Normal file
69
node_modules/jsonwebtoken/node_modules/ms/package.json
generated
vendored
Normal file
@ -0,0 +1,69 @@
|
||||
{
|
||||
"_from": "ms@^2.1.1",
|
||||
"_id": "ms@2.1.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==",
|
||||
"_location": "/jsonwebtoken/ms",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "ms@^2.1.1",
|
||||
"name": "ms",
|
||||
"escapedName": "ms",
|
||||
"rawSpec": "^2.1.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^2.1.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/jsonwebtoken"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz",
|
||||
"_shasum": "30a5864eb3ebb0a66f2ebe6d727af06a09d86e0a",
|
||||
"_spec": "ms@^2.1.1",
|
||||
"_where": "/Users/josh.burman/Projects/braid/node_modules/jsonwebtoken",
|
||||
"bugs": {
|
||||
"url": "https://github.com/zeit/ms/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Tiny millisecond conversion utility",
|
||||
"devDependencies": {
|
||||
"eslint": "4.12.1",
|
||||
"expect.js": "0.3.1",
|
||||
"husky": "0.14.3",
|
||||
"lint-staged": "5.0.0",
|
||||
"mocha": "4.0.1"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": "eslint:recommended",
|
||||
"env": {
|
||||
"node": true,
|
||||
"es6": true
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/zeit/ms#readme",
|
||||
"license": "MIT",
|
||||
"lint-staged": {
|
||||
"*.js": [
|
||||
"npm run lint",
|
||||
"prettier --single-quote --write",
|
||||
"git add"
|
||||
]
|
||||
},
|
||||
"main": "./index",
|
||||
"name": "ms",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/zeit/ms.git"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint lib/* bin/*",
|
||||
"precommit": "lint-staged",
|
||||
"test": "mocha tests.js"
|
||||
},
|
||||
"version": "2.1.1"
|
||||
}
|
60
node_modules/jsonwebtoken/node_modules/ms/readme.md
generated
vendored
Normal file
60
node_modules/jsonwebtoken/node_modules/ms/readme.md
generated
vendored
Normal file
@ -0,0 +1,60 @@
|
||||
# ms
|
||||
|
||||
[](https://travis-ci.org/zeit/ms)
|
||||
[](https://zeit.chat/)
|
||||
|
||||
Use this package to easily convert various time formats to milliseconds.
|
||||
|
||||
## Examples
|
||||
|
||||
```js
|
||||
ms('2 days') // 172800000
|
||||
ms('1d') // 86400000
|
||||
ms('10h') // 36000000
|
||||
ms('2.5 hrs') // 9000000
|
||||
ms('2h') // 7200000
|
||||
ms('1m') // 60000
|
||||
ms('5s') // 5000
|
||||
ms('1y') // 31557600000
|
||||
ms('100') // 100
|
||||
ms('-3 days') // -259200000
|
||||
ms('-1h') // -3600000
|
||||
ms('-200') // -200
|
||||
```
|
||||
|
||||
### Convert from Milliseconds
|
||||
|
||||
```js
|
||||
ms(60000) // "1m"
|
||||
ms(2 * 60000) // "2m"
|
||||
ms(-3 * 60000) // "-3m"
|
||||
ms(ms('10 hours')) // "10h"
|
||||
```
|
||||
|
||||
### Time Format Written-Out
|
||||
|
||||
```js
|
||||
ms(60000, { long: true }) // "1 minute"
|
||||
ms(2 * 60000, { long: true }) // "2 minutes"
|
||||
ms(-3 * 60000, { long: true }) // "-3 minutes"
|
||||
ms(ms('10 hours'), { long: true }) // "10 hours"
|
||||
```
|
||||
|
||||
## Features
|
||||
|
||||
- Works both in [Node.js](https://nodejs.org) and in the browser
|
||||
- If a number is supplied to `ms`, a string with a unit is returned
|
||||
- If a string that contains the number is supplied, it returns it as a number (e.g.: it returns `100` for `'100'`)
|
||||
- If you pass a string with a number and a valid unit, the number of equivalent milliseconds is returned
|
||||
|
||||
## Related Packages
|
||||
|
||||
- [ms.macro](https://github.com/knpwrs/ms.macro) - Run `ms` as a macro at build-time.
|
||||
|
||||
## Caught a Bug?
|
||||
|
||||
1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device
|
||||
2. Link the package to the global module directory: `npm link`
|
||||
3. Within the module you want to test your local development instance of ms, just link it to the dependencies: `npm link ms`. Instead of the default one from npm, Node.js will now use your clone of ms!
|
||||
|
||||
As always, you can run the tests using: `npm test`
|
100
node_modules/jsonwebtoken/package.json
generated
vendored
Normal file
100
node_modules/jsonwebtoken/package.json
generated
vendored
Normal file
@ -0,0 +1,100 @@
|
||||
{
|
||||
"_from": "jsonwebtoken",
|
||||
"_id": "jsonwebtoken@8.5.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-IqEycp0znWHNA11TpYi77bVgyBO/pGESDh7Ajhas+u0ttkGkKYIIAjniL4Bw5+oVejVF+SYkaI7XKfwCCyeTuA==",
|
||||
"_location": "/jsonwebtoken",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "tag",
|
||||
"registry": true,
|
||||
"raw": "jsonwebtoken",
|
||||
"name": "jsonwebtoken",
|
||||
"escapedName": "jsonwebtoken",
|
||||
"rawSpec": "",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "latest"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#USER",
|
||||
"/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-8.5.0.tgz",
|
||||
"_shasum": "ebd0ca2a69797816e1c5af65b6c759787252947e",
|
||||
"_spec": "jsonwebtoken",
|
||||
"_where": "/Users/josh.burman/Projects/braid",
|
||||
"author": {
|
||||
"name": "auth0"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/auth0/node-jsonwebtoken/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"jws": "^3.2.1",
|
||||
"lodash.includes": "^4.3.0",
|
||||
"lodash.isboolean": "^3.0.3",
|
||||
"lodash.isinteger": "^4.0.4",
|
||||
"lodash.isnumber": "^3.0.3",
|
||||
"lodash.isplainobject": "^4.0.6",
|
||||
"lodash.isstring": "^4.0.1",
|
||||
"lodash.once": "^4.0.0",
|
||||
"ms": "^2.1.1",
|
||||
"semver": "^5.6.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "JSON Web Token implementation (symmetric and asymmetric)",
|
||||
"devDependencies": {
|
||||
"atob": "^2.1.2",
|
||||
"chai": "^4.1.2",
|
||||
"conventional-changelog": "~1.1.0",
|
||||
"cost-of-modules": "^1.0.1",
|
||||
"eslint": "^4.19.1",
|
||||
"mocha": "^5.2.0",
|
||||
"nsp": "^2.6.2",
|
||||
"nyc": "^11.9.0",
|
||||
"sinon": "^6.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4",
|
||||
"npm": ">=1.4.28"
|
||||
},
|
||||
"files": [
|
||||
"lib",
|
||||
"decode.js",
|
||||
"sign.js",
|
||||
"verify.js"
|
||||
],
|
||||
"homepage": "https://github.com/auth0/node-jsonwebtoken#readme",
|
||||
"keywords": [
|
||||
"jwt"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "jsonwebtoken",
|
||||
"nyc": {
|
||||
"check-coverage": true,
|
||||
"lines": 95,
|
||||
"statements": 95,
|
||||
"functions": 100,
|
||||
"branches": 95,
|
||||
"exclude": [
|
||||
"./test/**"
|
||||
],
|
||||
"reporter": [
|
||||
"json",
|
||||
"lcov",
|
||||
"text-summary"
|
||||
]
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/auth0/node-jsonwebtoken.git"
|
||||
},
|
||||
"scripts": {
|
||||
"coverage": "nyc mocha --use_strict",
|
||||
"lint": "eslint .",
|
||||
"test": "npm run lint && npm run coverage && cost-of-modules"
|
||||
},
|
||||
"version": "8.5.0"
|
||||
}
|
206
node_modules/jsonwebtoken/sign.js
generated
vendored
Normal file
206
node_modules/jsonwebtoken/sign.js
generated
vendored
Normal file
@ -0,0 +1,206 @@
|
||||
var timespan = require('./lib/timespan');
|
||||
var PS_SUPPORTED = require('./lib/psSupported');
|
||||
var jws = require('jws');
|
||||
var includes = require('lodash.includes');
|
||||
var isBoolean = require('lodash.isboolean');
|
||||
var isInteger = require('lodash.isinteger');
|
||||
var isNumber = require('lodash.isnumber');
|
||||
var isPlainObject = require('lodash.isplainobject');
|
||||
var isString = require('lodash.isstring');
|
||||
var once = require('lodash.once');
|
||||
|
||||
var SUPPORTED_ALGS = ['RS256', 'RS384', 'RS512', 'ES256', 'ES384', 'ES512', 'HS256', 'HS384', 'HS512', 'none']
|
||||
if (PS_SUPPORTED) {
|
||||
SUPPORTED_ALGS.splice(3, 0, 'PS256', 'PS384', 'PS512');
|
||||
}
|
||||
|
||||
var sign_options_schema = {
|
||||
expiresIn: { isValid: function(value) { return isInteger(value) || (isString(value) && value); }, message: '"expiresIn" should be a number of seconds or string representing a timespan' },
|
||||
notBefore: { isValid: function(value) { return isInteger(value) || (isString(value) && value); }, message: '"notBefore" should be a number of seconds or string representing a timespan' },
|
||||
audience: { isValid: function(value) { return isString(value) || Array.isArray(value); }, message: '"audience" must be a string or array' },
|
||||
algorithm: { isValid: includes.bind(null, SUPPORTED_ALGS), message: '"algorithm" must be a valid string enum value' },
|
||||
header: { isValid: isPlainObject, message: '"header" must be an object' },
|
||||
encoding: { isValid: isString, message: '"encoding" must be a string' },
|
||||
issuer: { isValid: isString, message: '"issuer" must be a string' },
|
||||
subject: { isValid: isString, message: '"subject" must be a string' },
|
||||
jwtid: { isValid: isString, message: '"jwtid" must be a string' },
|
||||
noTimestamp: { isValid: isBoolean, message: '"noTimestamp" must be a boolean' },
|
||||
keyid: { isValid: isString, message: '"keyid" must be a string' },
|
||||
mutatePayload: { isValid: isBoolean, message: '"mutatePayload" must be a boolean' }
|
||||
};
|
||||
|
||||
var registered_claims_schema = {
|
||||
iat: { isValid: isNumber, message: '"iat" should be a number of seconds' },
|
||||
exp: { isValid: isNumber, message: '"exp" should be a number of seconds' },
|
||||
nbf: { isValid: isNumber, message: '"nbf" should be a number of seconds' }
|
||||
};
|
||||
|
||||
function validate(schema, allowUnknown, object, parameterName) {
|
||||
if (!isPlainObject(object)) {
|
||||
throw new Error('Expected "' + parameterName + '" to be a plain object.');
|
||||
}
|
||||
Object.keys(object)
|
||||
.forEach(function(key) {
|
||||
var validator = schema[key];
|
||||
if (!validator) {
|
||||
if (!allowUnknown) {
|
||||
throw new Error('"' + key + '" is not allowed in "' + parameterName + '"');
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (!validator.isValid(object[key])) {
|
||||
throw new Error(validator.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function validateOptions(options) {
|
||||
return validate(sign_options_schema, false, options, 'options');
|
||||
}
|
||||
|
||||
function validatePayload(payload) {
|
||||
return validate(registered_claims_schema, true, payload, 'payload');
|
||||
}
|
||||
|
||||
var options_to_payload = {
|
||||
'audience': 'aud',
|
||||
'issuer': 'iss',
|
||||
'subject': 'sub',
|
||||
'jwtid': 'jti'
|
||||
};
|
||||
|
||||
var options_for_objects = [
|
||||
'expiresIn',
|
||||
'notBefore',
|
||||
'noTimestamp',
|
||||
'audience',
|
||||
'issuer',
|
||||
'subject',
|
||||
'jwtid',
|
||||
];
|
||||
|
||||
module.exports = function (payload, secretOrPrivateKey, options, callback) {
|
||||
if (typeof options === 'function') {
|
||||
callback = options;
|
||||
options = {};
|
||||
} else {
|
||||
options = options || {};
|
||||
}
|
||||
|
||||
var isObjectPayload = typeof payload === 'object' &&
|
||||
!Buffer.isBuffer(payload);
|
||||
|
||||
var header = Object.assign({
|
||||
alg: options.algorithm || 'HS256',
|
||||
typ: isObjectPayload ? 'JWT' : undefined,
|
||||
kid: options.keyid
|
||||
}, options.header);
|
||||
|
||||
function failure(err) {
|
||||
if (callback) {
|
||||
return callback(err);
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
|
||||
if (!secretOrPrivateKey && options.algorithm !== 'none') {
|
||||
return failure(new Error('secretOrPrivateKey must have a value'));
|
||||
}
|
||||
|
||||
if (typeof payload === 'undefined') {
|
||||
return failure(new Error('payload is required'));
|
||||
} else if (isObjectPayload) {
|
||||
try {
|
||||
validatePayload(payload);
|
||||
}
|
||||
catch (error) {
|
||||
return failure(error);
|
||||
}
|
||||
if (!options.mutatePayload) {
|
||||
payload = Object.assign({},payload);
|
||||
}
|
||||
} else {
|
||||
var invalid_options = options_for_objects.filter(function (opt) {
|
||||
return typeof options[opt] !== 'undefined';
|
||||
});
|
||||
|
||||
if (invalid_options.length > 0) {
|
||||
return failure(new Error('invalid ' + invalid_options.join(',') + ' option for ' + (typeof payload ) + ' payload'));
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof payload.exp !== 'undefined' && typeof options.expiresIn !== 'undefined') {
|
||||
return failure(new Error('Bad "options.expiresIn" option the payload already has an "exp" property.'));
|
||||
}
|
||||
|
||||
if (typeof payload.nbf !== 'undefined' && typeof options.notBefore !== 'undefined') {
|
||||
return failure(new Error('Bad "options.notBefore" option the payload already has an "nbf" property.'));
|
||||
}
|
||||
|
||||
try {
|
||||
validateOptions(options);
|
||||
}
|
||||
catch (error) {
|
||||
return failure(error);
|
||||
}
|
||||
|
||||
var timestamp = payload.iat || Math.floor(Date.now() / 1000);
|
||||
|
||||
if (options.noTimestamp) {
|
||||
delete payload.iat;
|
||||
} else if (isObjectPayload) {
|
||||
payload.iat = timestamp;
|
||||
}
|
||||
|
||||
if (typeof options.notBefore !== 'undefined') {
|
||||
try {
|
||||
payload.nbf = timespan(options.notBefore, timestamp);
|
||||
}
|
||||
catch (err) {
|
||||
return failure(err);
|
||||
}
|
||||
if (typeof payload.nbf === 'undefined') {
|
||||
return failure(new Error('"notBefore" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'));
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof options.expiresIn !== 'undefined' && typeof payload === 'object') {
|
||||
try {
|
||||
payload.exp = timespan(options.expiresIn, timestamp);
|
||||
}
|
||||
catch (err) {
|
||||
return failure(err);
|
||||
}
|
||||
if (typeof payload.exp === 'undefined') {
|
||||
return failure(new Error('"expiresIn" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'));
|
||||
}
|
||||
}
|
||||
|
||||
Object.keys(options_to_payload).forEach(function (key) {
|
||||
var claim = options_to_payload[key];
|
||||
if (typeof options[key] !== 'undefined') {
|
||||
if (typeof payload[claim] !== 'undefined') {
|
||||
return failure(new Error('Bad "options.' + key + '" option. The payload already has an "' + claim + '" property.'));
|
||||
}
|
||||
payload[claim] = options[key];
|
||||
}
|
||||
});
|
||||
|
||||
var encoding = options.encoding || 'utf8';
|
||||
|
||||
if (typeof callback === 'function') {
|
||||
callback = callback && once(callback);
|
||||
|
||||
jws.createSign({
|
||||
header: header,
|
||||
privateKey: secretOrPrivateKey,
|
||||
payload: payload,
|
||||
encoding: encoding
|
||||
}).once('error', callback)
|
||||
.once('done', function (signature) {
|
||||
callback(null, signature);
|
||||
});
|
||||
} else {
|
||||
return jws.sign({header: header, payload: payload, secret: secretOrPrivateKey, encoding: encoding});
|
||||
}
|
||||
};
|
225
node_modules/jsonwebtoken/verify.js
generated
vendored
Normal file
225
node_modules/jsonwebtoken/verify.js
generated
vendored
Normal file
@ -0,0 +1,225 @@
|
||||
var JsonWebTokenError = require('./lib/JsonWebTokenError');
|
||||
var NotBeforeError = require('./lib/NotBeforeError');
|
||||
var TokenExpiredError = require('./lib/TokenExpiredError');
|
||||
var decode = require('./decode');
|
||||
var timespan = require('./lib/timespan');
|
||||
var PS_SUPPORTED = require('./lib/psSupported');
|
||||
var jws = require('jws');
|
||||
|
||||
var PUB_KEY_ALGS = ['RS256', 'RS384', 'RS512', 'ES256', 'ES384', 'ES512'];
|
||||
var RSA_KEY_ALGS = ['RS256', 'RS384', 'RS512'];
|
||||
var HS_ALGS = ['HS256', 'HS384', 'HS512'];
|
||||
|
||||
if (PS_SUPPORTED) {
|
||||
PUB_KEY_ALGS.splice(3, 0, 'PS256', 'PS384', 'PS512');
|
||||
RSA_KEY_ALGS.splice(3, 0, 'PS256', 'PS384', 'PS512');
|
||||
}
|
||||
|
||||
module.exports = function (jwtString, secretOrPublicKey, options, callback) {
|
||||
if ((typeof options === 'function') && !callback) {
|
||||
callback = options;
|
||||
options = {};
|
||||
}
|
||||
|
||||
if (!options) {
|
||||
options = {};
|
||||
}
|
||||
|
||||
//clone this object since we are going to mutate it.
|
||||
options = Object.assign({}, options);
|
||||
|
||||
var done;
|
||||
|
||||
if (callback) {
|
||||
done = callback;
|
||||
} else {
|
||||
done = function(err, data) {
|
||||
if (err) throw err;
|
||||
return data;
|
||||
};
|
||||
}
|
||||
|
||||
if (options.clockTimestamp && typeof options.clockTimestamp !== 'number') {
|
||||
return done(new JsonWebTokenError('clockTimestamp must be a number'));
|
||||
}
|
||||
|
||||
if (options.nonce !== undefined && (typeof options.nonce !== 'string' || options.nonce.trim() === '')) {
|
||||
return done(new JsonWebTokenError('nonce must be a non-empty string'));
|
||||
}
|
||||
|
||||
var clockTimestamp = options.clockTimestamp || Math.floor(Date.now() / 1000);
|
||||
|
||||
if (!jwtString){
|
||||
return done(new JsonWebTokenError('jwt must be provided'));
|
||||
}
|
||||
|
||||
if (typeof jwtString !== 'string') {
|
||||
return done(new JsonWebTokenError('jwt must be a string'));
|
||||
}
|
||||
|
||||
var parts = jwtString.split('.');
|
||||
|
||||
if (parts.length !== 3){
|
||||
return done(new JsonWebTokenError('jwt malformed'));
|
||||
}
|
||||
|
||||
var decodedToken;
|
||||
|
||||
try {
|
||||
decodedToken = decode(jwtString, { complete: true });
|
||||
} catch(err) {
|
||||
return done(err);
|
||||
}
|
||||
|
||||
if (!decodedToken) {
|
||||
return done(new JsonWebTokenError('invalid token'));
|
||||
}
|
||||
|
||||
var header = decodedToken.header;
|
||||
var getSecret;
|
||||
|
||||
if(typeof secretOrPublicKey === 'function') {
|
||||
if(!callback) {
|
||||
return done(new JsonWebTokenError('verify must be called asynchronous if secret or public key is provided as a callback'));
|
||||
}
|
||||
|
||||
getSecret = secretOrPublicKey;
|
||||
}
|
||||
else {
|
||||
getSecret = function(header, secretCallback) {
|
||||
return secretCallback(null, secretOrPublicKey);
|
||||
};
|
||||
}
|
||||
|
||||
return getSecret(header, function(err, secretOrPublicKey) {
|
||||
if(err) {
|
||||
return done(new JsonWebTokenError('error in secret or public key callback: ' + err.message));
|
||||
}
|
||||
|
||||
var hasSignature = parts[2].trim() !== '';
|
||||
|
||||
if (!hasSignature && secretOrPublicKey){
|
||||
return done(new JsonWebTokenError('jwt signature is required'));
|
||||
}
|
||||
|
||||
if (hasSignature && !secretOrPublicKey) {
|
||||
return done(new JsonWebTokenError('secret or public key must be provided'));
|
||||
}
|
||||
|
||||
if (!hasSignature && !options.algorithms) {
|
||||
options.algorithms = ['none'];
|
||||
}
|
||||
|
||||
if (!options.algorithms) {
|
||||
options.algorithms = ~secretOrPublicKey.toString().indexOf('BEGIN CERTIFICATE') ||
|
||||
~secretOrPublicKey.toString().indexOf('BEGIN PUBLIC KEY') ? PUB_KEY_ALGS :
|
||||
~secretOrPublicKey.toString().indexOf('BEGIN RSA PUBLIC KEY') ? RSA_KEY_ALGS : HS_ALGS;
|
||||
|
||||
}
|
||||
|
||||
if (!~options.algorithms.indexOf(decodedToken.header.alg)) {
|
||||
return done(new JsonWebTokenError('invalid algorithm'));
|
||||
}
|
||||
|
||||
var valid;
|
||||
|
||||
try {
|
||||
valid = jws.verify(jwtString, decodedToken.header.alg, secretOrPublicKey);
|
||||
} catch (e) {
|
||||
return done(e);
|
||||
}
|
||||
|
||||
if (!valid) {
|
||||
return done(new JsonWebTokenError('invalid signature'));
|
||||
}
|
||||
|
||||
var payload = decodedToken.payload;
|
||||
|
||||
if (typeof payload.nbf !== 'undefined' && !options.ignoreNotBefore) {
|
||||
if (typeof payload.nbf !== 'number') {
|
||||
return done(new JsonWebTokenError('invalid nbf value'));
|
||||
}
|
||||
if (payload.nbf > clockTimestamp + (options.clockTolerance || 0)) {
|
||||
return done(new NotBeforeError('jwt not active', new Date(payload.nbf * 1000)));
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof payload.exp !== 'undefined' && !options.ignoreExpiration) {
|
||||
if (typeof payload.exp !== 'number') {
|
||||
return done(new JsonWebTokenError('invalid exp value'));
|
||||
}
|
||||
if (clockTimestamp >= payload.exp + (options.clockTolerance || 0)) {
|
||||
return done(new TokenExpiredError('jwt expired', new Date(payload.exp * 1000)));
|
||||
}
|
||||
}
|
||||
|
||||
if (options.audience) {
|
||||
var audiences = Array.isArray(options.audience) ? options.audience : [options.audience];
|
||||
var target = Array.isArray(payload.aud) ? payload.aud : [payload.aud];
|
||||
|
||||
var match = target.some(function (targetAudience) {
|
||||
return audiences.some(function (audience) {
|
||||
return audience instanceof RegExp ? audience.test(targetAudience) : audience === targetAudience;
|
||||
});
|
||||
});
|
||||
|
||||
if (!match) {
|
||||
return done(new JsonWebTokenError('jwt audience invalid. expected: ' + audiences.join(' or ')));
|
||||
}
|
||||
}
|
||||
|
||||
if (options.issuer) {
|
||||
var invalid_issuer =
|
||||
(typeof options.issuer === 'string' && payload.iss !== options.issuer) ||
|
||||
(Array.isArray(options.issuer) && options.issuer.indexOf(payload.iss) === -1);
|
||||
|
||||
if (invalid_issuer) {
|
||||
return done(new JsonWebTokenError('jwt issuer invalid. expected: ' + options.issuer));
|
||||
}
|
||||
}
|
||||
|
||||
if (options.subject) {
|
||||
if (payload.sub !== options.subject) {
|
||||
return done(new JsonWebTokenError('jwt subject invalid. expected: ' + options.subject));
|
||||
}
|
||||
}
|
||||
|
||||
if (options.jwtid) {
|
||||
if (payload.jti !== options.jwtid) {
|
||||
return done(new JsonWebTokenError('jwt jwtid invalid. expected: ' + options.jwtid));
|
||||
}
|
||||
}
|
||||
|
||||
if (options.nonce) {
|
||||
if (payload.nonce !== options.nonce) {
|
||||
return done(new JsonWebTokenError('jwt nonce invalid. expected: ' + options.nonce));
|
||||
}
|
||||
}
|
||||
|
||||
if (options.maxAge) {
|
||||
if (typeof payload.iat !== 'number') {
|
||||
return done(new JsonWebTokenError('iat required when maxAge is specified'));
|
||||
}
|
||||
|
||||
var maxAgeTimestamp = timespan(options.maxAge, payload.iat);
|
||||
if (typeof maxAgeTimestamp === 'undefined') {
|
||||
return done(new JsonWebTokenError('"maxAge" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'));
|
||||
}
|
||||
if (clockTimestamp >= maxAgeTimestamp + (options.clockTolerance || 0)) {
|
||||
return done(new TokenExpiredError('maxAge exceeded', new Date(maxAgeTimestamp * 1000)));
|
||||
}
|
||||
}
|
||||
|
||||
if (options.complete === true) {
|
||||
var signature = decodedToken.signature;
|
||||
|
||||
return done(null, {
|
||||
header: header,
|
||||
payload: payload,
|
||||
signature: signature
|
||||
});
|
||||
}
|
||||
|
||||
return done(null, payload);
|
||||
});
|
||||
};
|
17
node_modules/jwa/LICENSE
generated
vendored
Normal file
17
node_modules/jwa/LICENSE
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
Copyright (c) 2013 Brian J. Brennan
|
||||
|
||||
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.
|
150
node_modules/jwa/README.md
generated
vendored
Normal file
150
node_modules/jwa/README.md
generated
vendored
Normal file
@ -0,0 +1,150 @@
|
||||
# node-jwa [](https://travis-ci.org/brianloveswords/node-jwa)
|
||||
|
||||
A
|
||||
[JSON Web Algorithms](http://tools.ietf.org/id/draft-ietf-jose-json-web-algorithms-08.html)
|
||||
implementation focusing (exclusively, at this point) on the algorithms necessary for
|
||||
[JSON Web Signatures](http://self-issued.info/docs/draft-ietf-jose-json-web-signature.html).
|
||||
|
||||
This library supports all of the required, recommended and optional cryptographic algorithms for JWS:
|
||||
|
||||
alg Parameter Value | Digital Signature or MAC Algorithm
|
||||
----------------|----------------------------
|
||||
HS256 | HMAC using SHA-256 hash algorithm
|
||||
HS384 | HMAC using SHA-384 hash algorithm
|
||||
HS512 | HMAC using SHA-512 hash algorithm
|
||||
RS256 | RSASSA using SHA-256 hash algorithm
|
||||
RS384 | RSASSA using SHA-384 hash algorithm
|
||||
RS512 | RSASSA using SHA-512 hash algorithm
|
||||
PS256 | RSASSA-PSS using SHA-256 hash algorithm
|
||||
PS384 | RSASSA-PSS using SHA-384 hash algorithm
|
||||
PS512 | RSASSA-PSS using SHA-512 hash algorithm
|
||||
ES256 | ECDSA using P-256 curve and SHA-256 hash algorithm
|
||||
ES384 | ECDSA using P-384 curve and SHA-384 hash algorithm
|
||||
ES512 | ECDSA using P-521 curve and SHA-512 hash algorithm
|
||||
none | No digital signature or MAC value included
|
||||
|
||||
Please note that PS* only works on Node 6.12+ (excluding 7.x).
|
||||
|
||||
# Requirements
|
||||
|
||||
In order to run the tests, a recent version of OpenSSL is
|
||||
required. **The version that comes with OS X (OpenSSL 0.9.8r 8 Feb
|
||||
2011) is not recent enough**, as it does not fully support ECDSA
|
||||
keys. You'll need to use a version > 1.0.0; I tested with OpenSSL 1.0.1c 10 May 2012.
|
||||
|
||||
# Testing
|
||||
|
||||
To run the tests, do
|
||||
|
||||
```bash
|
||||
$ npm test
|
||||
```
|
||||
|
||||
This will generate a bunch of keypairs to use in testing. If you want to
|
||||
generate new keypairs, do `make clean` before running `npm test` again.
|
||||
|
||||
## Methodology
|
||||
|
||||
I spawn `openssl dgst -sign` to test OpenSSL sign → JS verify and
|
||||
`openssl dgst -verify` to test JS sign → OpenSSL verify for each of the
|
||||
RSA and ECDSA algorithms.
|
||||
|
||||
# Usage
|
||||
|
||||
## jwa(algorithm)
|
||||
|
||||
Creates a new `jwa` object with `sign` and `verify` methods for the
|
||||
algorithm. Valid values for algorithm can be found in the table above
|
||||
(`'HS256'`, `'HS384'`, etc) and are case-insensitive. Passing an invalid
|
||||
algorithm value will throw a `TypeError`.
|
||||
|
||||
|
||||
## jwa#sign(input, secretOrPrivateKey)
|
||||
|
||||
Sign some input with either a secret for HMAC algorithms, or a private
|
||||
key for RSA and ECDSA algorithms.
|
||||
|
||||
If input is not already a string or buffer, `JSON.stringify` will be
|
||||
called on it to attempt to coerce it.
|
||||
|
||||
For the HMAC algorithm, `secretOrPrivateKey` should be a string or a
|
||||
buffer. For ECDSA and RSA, the value should be a string representing a
|
||||
PEM encoded **private** key.
|
||||
|
||||
Output [base64url](http://en.wikipedia.org/wiki/Base64#URL_applications)
|
||||
formatted. This is for convenience as JWS expects the signature in this
|
||||
format. If your application needs the output in a different format,
|
||||
[please open an issue](https://github.com/brianloveswords/node-jwa/issues). In
|
||||
the meantime, you can use
|
||||
[brianloveswords/base64url](https://github.com/brianloveswords/base64url)
|
||||
to decode the signature.
|
||||
|
||||
As of nodejs *v0.11.8*, SPKAC support was introduce. If your nodeJs
|
||||
version satisfies, then you can pass an object `{ key: '..', passphrase: '...' }`
|
||||
|
||||
|
||||
## jwa#verify(input, signature, secretOrPublicKey)
|
||||
|
||||
Verify a signature. Returns `true` or `false`.
|
||||
|
||||
`signature` should be a base64url encoded string.
|
||||
|
||||
For the HMAC algorithm, `secretOrPublicKey` should be a string or a
|
||||
buffer. For ECDSA and RSA, the value should be a string represented a
|
||||
PEM encoded **public** key.
|
||||
|
||||
|
||||
# Example
|
||||
|
||||
HMAC
|
||||
```js
|
||||
const jwa = require('jwa');
|
||||
|
||||
const hmac = jwa('HS256');
|
||||
const input = 'super important stuff';
|
||||
const secret = 'shhhhhh';
|
||||
|
||||
const signature = hmac.sign(input, secret);
|
||||
hmac.verify(input, signature, secret) // === true
|
||||
hmac.verify(input, signature, 'trickery!') // === false
|
||||
```
|
||||
|
||||
With keys
|
||||
```js
|
||||
const fs = require('fs');
|
||||
const jwa = require('jwa');
|
||||
const privateKey = fs.readFileSync(__dirname + '/ecdsa-p521-private.pem');
|
||||
const publicKey = fs.readFileSync(__dirname + '/ecdsa-p521-public.pem');
|
||||
|
||||
const ecdsa = jwa('ES512');
|
||||
const input = 'very important stuff';
|
||||
|
||||
const signature = ecdsa.sign(input, privateKey);
|
||||
ecdsa.verify(input, signature, publicKey) // === true
|
||||
```
|
||||
## License
|
||||
|
||||
MIT
|
||||
|
||||
```
|
||||
Copyright (c) 2013 Brian J. Brennan
|
||||
|
||||
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.
|
||||
```
|
244
node_modules/jwa/index.js
generated
vendored
Normal file
244
node_modules/jwa/index.js
generated
vendored
Normal file
@ -0,0 +1,244 @@
|
||||
var bufferEqual = require('buffer-equal-constant-time');
|
||||
var Buffer = require('safe-buffer').Buffer;
|
||||
var crypto = require('crypto');
|
||||
var formatEcdsa = require('ecdsa-sig-formatter');
|
||||
var util = require('util');
|
||||
|
||||
var MSG_INVALID_ALGORITHM = '"%s" is not a valid algorithm.\n Supported algorithms are:\n "HS256", "HS384", "HS512", "RS256", "RS384", "RS512", "PS256", "PS384", "PS512", "ES256", "ES384", "ES512" and "none".'
|
||||
var MSG_INVALID_SECRET = 'secret must be a string or buffer';
|
||||
var MSG_INVALID_VERIFIER_KEY = 'key must be a string or a buffer';
|
||||
var MSG_INVALID_SIGNER_KEY = 'key must be a string, a buffer or an object';
|
||||
|
||||
var supportsKeyObjects = typeof crypto.createPublicKey === 'function';
|
||||
if (supportsKeyObjects) {
|
||||
MSG_INVALID_VERIFIER_KEY += ' or a KeyObject';
|
||||
MSG_INVALID_SECRET += 'or a KeyObject';
|
||||
}
|
||||
|
||||
function checkIsPublicKey(key) {
|
||||
if (Buffer.isBuffer(key)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (typeof key === 'string') {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!supportsKeyObjects) {
|
||||
throw typeError(MSG_INVALID_VERIFIER_KEY);
|
||||
}
|
||||
|
||||
if (typeof key !== 'object') {
|
||||
throw typeError(MSG_INVALID_VERIFIER_KEY);
|
||||
}
|
||||
|
||||
if (typeof key.type !== 'string') {
|
||||
throw typeError(MSG_INVALID_VERIFIER_KEY);
|
||||
}
|
||||
|
||||
if (typeof key.asymmetricKeyType !== 'string') {
|
||||
throw typeError(MSG_INVALID_VERIFIER_KEY);
|
||||
}
|
||||
|
||||
if (typeof key.export !== 'function') {
|
||||
throw typeError(MSG_INVALID_VERIFIER_KEY);
|
||||
}
|
||||
};
|
||||
|
||||
function checkIsPrivateKey(key) {
|
||||
if (Buffer.isBuffer(key)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (typeof key === 'string') {
|
||||
return;
|
||||
}
|
||||
|
||||
if (typeof key === 'object') {
|
||||
return;
|
||||
}
|
||||
|
||||
throw typeError(MSG_INVALID_SIGNER_KEY);
|
||||
};
|
||||
|
||||
function checkIsSecretKey(key) {
|
||||
if (Buffer.isBuffer(key)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (typeof key === 'string') {
|
||||
return key;
|
||||
}
|
||||
|
||||
if (!supportsKeyObjects) {
|
||||
throw typeError(MSG_INVALID_SECRET);
|
||||
}
|
||||
|
||||
if (typeof key !== 'object') {
|
||||
throw typeError(MSG_INVALID_SECRET);
|
||||
}
|
||||
|
||||
if (key.type !== 'secret') {
|
||||
throw typeError(MSG_INVALID_SECRET);
|
||||
}
|
||||
|
||||
if (typeof key.export !== 'function') {
|
||||
throw typeError(MSG_INVALID_SECRET);
|
||||
}
|
||||
}
|
||||
|
||||
function fromBase64(base64) {
|
||||
return base64
|
||||
.replace(/=/g, '')
|
||||
.replace(/\+/g, '-')
|
||||
.replace(/\//g, '_');
|
||||
}
|
||||
|
||||
function toBase64(base64url) {
|
||||
base64url = base64url.toString();
|
||||
|
||||
var padding = 4 - base64url.length % 4;
|
||||
if (padding !== 4) {
|
||||
for (var i = 0; i < padding; ++i) {
|
||||
base64url += '=';
|
||||
}
|
||||
}
|
||||
|
||||
return base64url
|
||||
.replace(/\-/g, '+')
|
||||
.replace(/_/g, '/');
|
||||
}
|
||||
|
||||
function typeError(template) {
|
||||
var args = [].slice.call(arguments, 1);
|
||||
var errMsg = util.format.bind(util, template).apply(null, args);
|
||||
return new TypeError(errMsg);
|
||||
}
|
||||
|
||||
function bufferOrString(obj) {
|
||||
return Buffer.isBuffer(obj) || typeof obj === 'string';
|
||||
}
|
||||
|
||||
function normalizeInput(thing) {
|
||||
if (!bufferOrString(thing))
|
||||
thing = JSON.stringify(thing);
|
||||
return thing;
|
||||
}
|
||||
|
||||
function createHmacSigner(bits) {
|
||||
return function sign(thing, secret) {
|
||||
checkIsSecretKey(secret);
|
||||
thing = normalizeInput(thing);
|
||||
var hmac = crypto.createHmac('sha' + bits, secret);
|
||||
var sig = (hmac.update(thing), hmac.digest('base64'))
|
||||
return fromBase64(sig);
|
||||
}
|
||||
}
|
||||
|
||||
function createHmacVerifier(bits) {
|
||||
return function verify(thing, signature, secret) {
|
||||
var computedSig = createHmacSigner(bits)(thing, secret);
|
||||
return bufferEqual(Buffer.from(signature), Buffer.from(computedSig));
|
||||
}
|
||||
}
|
||||
|
||||
function createKeySigner(bits) {
|
||||
return function sign(thing, privateKey) {
|
||||
checkIsPrivateKey(privateKey);
|
||||
thing = normalizeInput(thing);
|
||||
// Even though we are specifying "RSA" here, this works with ECDSA
|
||||
// keys as well.
|
||||
var signer = crypto.createSign('RSA-SHA' + bits);
|
||||
var sig = (signer.update(thing), signer.sign(privateKey, 'base64'));
|
||||
return fromBase64(sig);
|
||||
}
|
||||
}
|
||||
|
||||
function createKeyVerifier(bits) {
|
||||
return function verify(thing, signature, publicKey) {
|
||||
checkIsPublicKey(publicKey);
|
||||
thing = normalizeInput(thing);
|
||||
signature = toBase64(signature);
|
||||
var verifier = crypto.createVerify('RSA-SHA' + bits);
|
||||
verifier.update(thing);
|
||||
return verifier.verify(publicKey, signature, 'base64');
|
||||
}
|
||||
}
|
||||
|
||||
function createPSSKeySigner(bits) {
|
||||
return function sign(thing, privateKey) {
|
||||
checkIsPrivateKey(privateKey);
|
||||
thing = normalizeInput(thing);
|
||||
var signer = crypto.createSign('RSA-SHA' + bits);
|
||||
var sig = (signer.update(thing), signer.sign({key: privateKey, padding: crypto.constants.RSA_PKCS1_PSS_PADDING}, 'base64'));
|
||||
return fromBase64(sig);
|
||||
}
|
||||
}
|
||||
|
||||
function createPSSKeyVerifier(bits) {
|
||||
return function verify(thing, signature, publicKey) {
|
||||
checkIsPublicKey(publicKey);
|
||||
thing = normalizeInput(thing);
|
||||
signature = toBase64(signature);
|
||||
var verifier = crypto.createVerify('RSA-SHA' + bits);
|
||||
verifier.update(thing);
|
||||
return verifier.verify({key: publicKey, padding: crypto.constants.RSA_PKCS1_PSS_PADDING}, signature, 'base64');
|
||||
}
|
||||
}
|
||||
|
||||
function createECDSASigner(bits) {
|
||||
var inner = createKeySigner(bits);
|
||||
return function sign() {
|
||||
var signature = inner.apply(null, arguments);
|
||||
signature = formatEcdsa.derToJose(signature, 'ES' + bits);
|
||||
return signature;
|
||||
};
|
||||
}
|
||||
|
||||
function createECDSAVerifer(bits) {
|
||||
var inner = createKeyVerifier(bits);
|
||||
return function verify(thing, signature, publicKey) {
|
||||
signature = formatEcdsa.joseToDer(signature, 'ES' + bits).toString('base64');
|
||||
var result = inner(thing, signature, publicKey);
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
function createNoneSigner() {
|
||||
return function sign() {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
function createNoneVerifier() {
|
||||
return function verify(thing, signature) {
|
||||
return signature === '';
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = function jwa(algorithm) {
|
||||
var signerFactories = {
|
||||
hs: createHmacSigner,
|
||||
rs: createKeySigner,
|
||||
ps: createPSSKeySigner,
|
||||
es: createECDSASigner,
|
||||
none: createNoneSigner,
|
||||
}
|
||||
var verifierFactories = {
|
||||
hs: createHmacVerifier,
|
||||
rs: createKeyVerifier,
|
||||
ps: createPSSKeyVerifier,
|
||||
es: createECDSAVerifer,
|
||||
none: createNoneVerifier,
|
||||
}
|
||||
var match = algorithm.match(/^(RS|PS|ES|HS)(256|384|512)$|^(none)$/i);
|
||||
if (!match)
|
||||
throw typeError(MSG_INVALID_ALGORITHM, algorithm);
|
||||
var algo = (match[1] || match[3]).toLowerCase();
|
||||
var bits = match[2];
|
||||
|
||||
return {
|
||||
sign: signerFactories[algo](bits),
|
||||
verify: verifierFactories[algo](bits),
|
||||
}
|
||||
};
|
69
node_modules/jwa/package.json
generated
vendored
Normal file
69
node_modules/jwa/package.json
generated
vendored
Normal file
@ -0,0 +1,69 @@
|
||||
{
|
||||
"_from": "jwa@^1.2.0",
|
||||
"_id": "jwa@1.4.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-mt6IHaq0ZZWDBspg0Pheu3r9sVNMEZn+GJe1zcdYyhFcDSclp3J8xEdO4PjZolZ2i8xlaVU1LetHM0nJejYsEw==",
|
||||
"_location": "/jwa",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "jwa@^1.2.0",
|
||||
"name": "jwa",
|
||||
"escapedName": "jwa",
|
||||
"rawSpec": "^1.2.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.2.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/jws"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.0.tgz",
|
||||
"_shasum": "8f61dc799acf0309f2d4b22a91ce73d6d2bb206c",
|
||||
"_spec": "jwa@^1.2.0",
|
||||
"_where": "/Users/josh.burman/Projects/braid/node_modules/jws",
|
||||
"author": {
|
||||
"name": "Brian J. Brennan",
|
||||
"email": "brianloveswords@gmail.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/brianloveswords/node-jwa/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"buffer-equal-constant-time": "1.0.1",
|
||||
"ecdsa-sig-formatter": "1.0.11",
|
||||
"safe-buffer": "^5.0.1"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "JWA implementation (supports all JWS algorithms)",
|
||||
"devDependencies": {
|
||||
"base64url": "^2.0.0",
|
||||
"jwk-to-pem": "^2.0.1",
|
||||
"semver": "4.3.6",
|
||||
"tap": "6.2.0"
|
||||
},
|
||||
"directories": {
|
||||
"test": "test"
|
||||
},
|
||||
"homepage": "https://github.com/brianloveswords/node-jwa#readme",
|
||||
"keywords": [
|
||||
"jwa",
|
||||
"jws",
|
||||
"jwt",
|
||||
"rsa",
|
||||
"ecdsa",
|
||||
"hmac"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "jwa",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/brianloveswords/node-jwa.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "make test"
|
||||
},
|
||||
"version": "1.4.0"
|
||||
}
|
34
node_modules/jws/CHANGELOG.md
generated
vendored
Normal file
34
node_modules/jws/CHANGELOG.md
generated
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
# Change Log
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
## [3.0.0]
|
||||
### Changed
|
||||
- **BREAKING**: `jwt.verify` now requires an `algorithm` parameter, and
|
||||
`jws.createVerify` requires an `algorithm` option. The `"alg"` field
|
||||
signature headers is ignored. This mitigates a critical security flaw
|
||||
in the library which would allow an attacker to generate signatures with
|
||||
arbitrary contents that would be accepted by `jwt.verify`. See
|
||||
https://auth0.com/blog/2015/03/31/critical-vulnerabilities-in-json-web-token-libraries/
|
||||
for details.
|
||||
|
||||
## [2.0.0] - 2015-01-30
|
||||
### Changed
|
||||
- **BREAKING**: Default payload encoding changed from `binary` to
|
||||
`utf8`. `utf8` is a is a more sensible default than `binary` because
|
||||
many payloads, as far as I can tell, will contain user-facing
|
||||
strings that could be in any language. (<code>[6b6de48]</code>)
|
||||
|
||||
- Code reorganization, thanks [@fearphage]! (<code>[7880050]</code>)
|
||||
|
||||
### Added
|
||||
- Option in all relevant methods for `encoding`. For those few users
|
||||
that might be depending on a `binary` encoding of the messages, this
|
||||
is for them. (<code>[6b6de48]</code>)
|
||||
|
||||
[unreleased]: https://github.com/brianloveswords/node-jws/compare/v2.0.0...HEAD
|
||||
[2.0.0]: https://github.com/brianloveswords/node-jws/compare/v1.0.1...v2.0.0
|
||||
|
||||
[7880050]: https://github.com/brianloveswords/node-jws/commit/7880050
|
||||
[6b6de48]: https://github.com/brianloveswords/node-jws/commit/6b6de48
|
||||
|
||||
[@fearphage]: https://github.com/fearphage
|
17
node_modules/jws/LICENSE
generated
vendored
Normal file
17
node_modules/jws/LICENSE
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
Copyright (c) 2013 Brian J. Brennan
|
||||
|
||||
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.
|
22
node_modules/jws/index.js
generated
vendored
Normal file
22
node_modules/jws/index.js
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
/*global exports*/
|
||||
var SignStream = require('./lib/sign-stream');
|
||||
var VerifyStream = require('./lib/verify-stream');
|
||||
|
||||
var ALGORITHMS = [
|
||||
'HS256', 'HS384', 'HS512',
|
||||
'RS256', 'RS384', 'RS512',
|
||||
'PS256', 'PS384', 'PS512',
|
||||
'ES256', 'ES384', 'ES512'
|
||||
];
|
||||
|
||||
exports.ALGORITHMS = ALGORITHMS;
|
||||
exports.sign = SignStream.sign;
|
||||
exports.verify = VerifyStream.verify;
|
||||
exports.decode = VerifyStream.decode;
|
||||
exports.isValid = VerifyStream.isValid;
|
||||
exports.createSign = function createSign(opts) {
|
||||
return new SignStream(opts);
|
||||
};
|
||||
exports.createVerify = function createVerify(opts) {
|
||||
return new VerifyStream(opts);
|
||||
};
|
55
node_modules/jws/lib/data-stream.js
generated
vendored
Normal file
55
node_modules/jws/lib/data-stream.js
generated
vendored
Normal file
@ -0,0 +1,55 @@
|
||||
/*global module, process*/
|
||||
var Buffer = require('safe-buffer').Buffer;
|
||||
var Stream = require('stream');
|
||||
var util = require('util');
|
||||
|
||||
function DataStream(data) {
|
||||
this.buffer = null;
|
||||
this.writable = true;
|
||||
this.readable = true;
|
||||
|
||||
// No input
|
||||
if (!data) {
|
||||
this.buffer = Buffer.alloc(0);
|
||||
return this;
|
||||
}
|
||||
|
||||
// Stream
|
||||
if (typeof data.pipe === 'function') {
|
||||
this.buffer = Buffer.alloc(0);
|
||||
data.pipe(this);
|
||||
return this;
|
||||
}
|
||||
|
||||
// Buffer or String
|
||||
// or Object (assumedly a passworded key)
|
||||
if (data.length || typeof data === 'object') {
|
||||
this.buffer = data;
|
||||
this.writable = false;
|
||||
process.nextTick(function () {
|
||||
this.emit('end', data);
|
||||
this.readable = false;
|
||||
this.emit('close');
|
||||
}.bind(this));
|
||||
return this;
|
||||
}
|
||||
|
||||
throw new TypeError('Unexpected data type ('+ typeof data + ')');
|
||||
}
|
||||
util.inherits(DataStream, Stream);
|
||||
|
||||
DataStream.prototype.write = function write(data) {
|
||||
this.buffer = Buffer.concat([this.buffer, Buffer.from(data)]);
|
||||
this.emit('data', data);
|
||||
};
|
||||
|
||||
DataStream.prototype.end = function end(data) {
|
||||
if (data)
|
||||
this.write(data);
|
||||
this.emit('end', data);
|
||||
this.emit('close');
|
||||
this.writable = false;
|
||||
this.readable = false;
|
||||
};
|
||||
|
||||
module.exports = DataStream;
|
78
node_modules/jws/lib/sign-stream.js
generated
vendored
Normal file
78
node_modules/jws/lib/sign-stream.js
generated
vendored
Normal file
@ -0,0 +1,78 @@
|
||||
/*global module*/
|
||||
var Buffer = require('safe-buffer').Buffer;
|
||||
var DataStream = require('./data-stream');
|
||||
var jwa = require('jwa');
|
||||
var Stream = require('stream');
|
||||
var toString = require('./tostring');
|
||||
var util = require('util');
|
||||
|
||||
function base64url(string, encoding) {
|
||||
return Buffer
|
||||
.from(string, encoding)
|
||||
.toString('base64')
|
||||
.replace(/=/g, '')
|
||||
.replace(/\+/g, '-')
|
||||
.replace(/\//g, '_');
|
||||
}
|
||||
|
||||
function jwsSecuredInput(header, payload, encoding) {
|
||||
encoding = encoding || 'utf8';
|
||||
var encodedHeader = base64url(toString(header), 'binary');
|
||||
var encodedPayload = base64url(toString(payload), encoding);
|
||||
return util.format('%s.%s', encodedHeader, encodedPayload);
|
||||
}
|
||||
|
||||
function jwsSign(opts) {
|
||||
var header = opts.header;
|
||||
var payload = opts.payload;
|
||||
var secretOrKey = opts.secret || opts.privateKey;
|
||||
var encoding = opts.encoding;
|
||||
var algo = jwa(header.alg);
|
||||
var securedInput = jwsSecuredInput(header, payload, encoding);
|
||||
var signature = algo.sign(securedInput, secretOrKey);
|
||||
return util.format('%s.%s', securedInput, signature);
|
||||
}
|
||||
|
||||
function SignStream(opts) {
|
||||
var secret = opts.secret||opts.privateKey||opts.key;
|
||||
var secretStream = new DataStream(secret);
|
||||
this.readable = true;
|
||||
this.header = opts.header;
|
||||
this.encoding = opts.encoding;
|
||||
this.secret = this.privateKey = this.key = secretStream;
|
||||
this.payload = new DataStream(opts.payload);
|
||||
this.secret.once('close', function () {
|
||||
if (!this.payload.writable && this.readable)
|
||||
this.sign();
|
||||
}.bind(this));
|
||||
|
||||
this.payload.once('close', function () {
|
||||
if (!this.secret.writable && this.readable)
|
||||
this.sign();
|
||||
}.bind(this));
|
||||
}
|
||||
util.inherits(SignStream, Stream);
|
||||
|
||||
SignStream.prototype.sign = function sign() {
|
||||
try {
|
||||
var signature = jwsSign({
|
||||
header: this.header,
|
||||
payload: this.payload.buffer,
|
||||
secret: this.secret.buffer,
|
||||
encoding: this.encoding
|
||||
});
|
||||
this.emit('done', signature);
|
||||
this.emit('data', signature);
|
||||
this.emit('end');
|
||||
this.readable = false;
|
||||
return signature;
|
||||
} catch (e) {
|
||||
this.readable = false;
|
||||
this.emit('error', e);
|
||||
this.emit('close');
|
||||
}
|
||||
};
|
||||
|
||||
SignStream.sign = jwsSign;
|
||||
|
||||
module.exports = SignStream;
|
10
node_modules/jws/lib/tostring.js
generated
vendored
Normal file
10
node_modules/jws/lib/tostring.js
generated
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
/*global module*/
|
||||
var Buffer = require('buffer').Buffer;
|
||||
|
||||
module.exports = function toString(obj) {
|
||||
if (typeof obj === 'string')
|
||||
return obj;
|
||||
if (typeof obj === 'number' || Buffer.isBuffer(obj))
|
||||
return obj.toString();
|
||||
return JSON.stringify(obj);
|
||||
};
|
120
node_modules/jws/lib/verify-stream.js
generated
vendored
Normal file
120
node_modules/jws/lib/verify-stream.js
generated
vendored
Normal file
@ -0,0 +1,120 @@
|
||||
/*global module*/
|
||||
var Buffer = require('safe-buffer').Buffer;
|
||||
var DataStream = require('./data-stream');
|
||||
var jwa = require('jwa');
|
||||
var Stream = require('stream');
|
||||
var toString = require('./tostring');
|
||||
var util = require('util');
|
||||
var JWS_REGEX = /^[a-zA-Z0-9\-_]+?\.[a-zA-Z0-9\-_]+?\.([a-zA-Z0-9\-_]+)?$/;
|
||||
|
||||
function isObject(thing) {
|
||||
return Object.prototype.toString.call(thing) === '[object Object]';
|
||||
}
|
||||
|
||||
function safeJsonParse(thing) {
|
||||
if (isObject(thing))
|
||||
return thing;
|
||||
try { return JSON.parse(thing); }
|
||||
catch (e) { return undefined; }
|
||||
}
|
||||
|
||||
function headerFromJWS(jwsSig) {
|
||||
var encodedHeader = jwsSig.split('.', 1)[0];
|
||||
return safeJsonParse(Buffer.from(encodedHeader, 'base64').toString('binary'));
|
||||
}
|
||||
|
||||
function securedInputFromJWS(jwsSig) {
|
||||
return jwsSig.split('.', 2).join('.');
|
||||
}
|
||||
|
||||
function signatureFromJWS(jwsSig) {
|
||||
return jwsSig.split('.')[2];
|
||||
}
|
||||
|
||||
function payloadFromJWS(jwsSig, encoding) {
|
||||
encoding = encoding || 'utf8';
|
||||
var payload = jwsSig.split('.')[1];
|
||||
return Buffer.from(payload, 'base64').toString(encoding);
|
||||
}
|
||||
|
||||
function isValidJws(string) {
|
||||
return JWS_REGEX.test(string) && !!headerFromJWS(string);
|
||||
}
|
||||
|
||||
function jwsVerify(jwsSig, algorithm, secretOrKey) {
|
||||
if (!algorithm) {
|
||||
var err = new Error("Missing algorithm parameter for jws.verify");
|
||||
err.code = "MISSING_ALGORITHM";
|
||||
throw err;
|
||||
}
|
||||
jwsSig = toString(jwsSig);
|
||||
var signature = signatureFromJWS(jwsSig);
|
||||
var securedInput = securedInputFromJWS(jwsSig);
|
||||
var algo = jwa(algorithm);
|
||||
return algo.verify(securedInput, signature, secretOrKey);
|
||||
}
|
||||
|
||||
function jwsDecode(jwsSig, opts) {
|
||||
opts = opts || {};
|
||||
jwsSig = toString(jwsSig);
|
||||
|
||||
if (!isValidJws(jwsSig))
|
||||
return null;
|
||||
|
||||
var header = headerFromJWS(jwsSig);
|
||||
|
||||
if (!header)
|
||||
return null;
|
||||
|
||||
var payload = payloadFromJWS(jwsSig);
|
||||
if (header.typ === 'JWT' || opts.json)
|
||||
payload = JSON.parse(payload, opts.encoding);
|
||||
|
||||
return {
|
||||
header: header,
|
||||
payload: payload,
|
||||
signature: signatureFromJWS(jwsSig)
|
||||
};
|
||||
}
|
||||
|
||||
function VerifyStream(opts) {
|
||||
opts = opts || {};
|
||||
var secretOrKey = opts.secret||opts.publicKey||opts.key;
|
||||
var secretStream = new DataStream(secretOrKey);
|
||||
this.readable = true;
|
||||
this.algorithm = opts.algorithm;
|
||||
this.encoding = opts.encoding;
|
||||
this.secret = this.publicKey = this.key = secretStream;
|
||||
this.signature = new DataStream(opts.signature);
|
||||
this.secret.once('close', function () {
|
||||
if (!this.signature.writable && this.readable)
|
||||
this.verify();
|
||||
}.bind(this));
|
||||
|
||||
this.signature.once('close', function () {
|
||||
if (!this.secret.writable && this.readable)
|
||||
this.verify();
|
||||
}.bind(this));
|
||||
}
|
||||
util.inherits(VerifyStream, Stream);
|
||||
VerifyStream.prototype.verify = function verify() {
|
||||
try {
|
||||
var valid = jwsVerify(this.signature.buffer, this.algorithm, this.key.buffer);
|
||||
var obj = jwsDecode(this.signature.buffer, this.encoding);
|
||||
this.emit('done', valid, obj);
|
||||
this.emit('data', valid);
|
||||
this.emit('end');
|
||||
this.readable = false;
|
||||
return valid;
|
||||
} catch (e) {
|
||||
this.readable = false;
|
||||
this.emit('error', e);
|
||||
this.emit('close');
|
||||
}
|
||||
};
|
||||
|
||||
VerifyStream.decode = jwsDecode;
|
||||
VerifyStream.isValid = isValidJws;
|
||||
VerifyStream.verify = jwsVerify;
|
||||
|
||||
module.exports = VerifyStream;
|
64
node_modules/jws/package.json
generated
vendored
Normal file
64
node_modules/jws/package.json
generated
vendored
Normal file
@ -0,0 +1,64 @@
|
||||
{
|
||||
"_from": "jws@^3.2.1",
|
||||
"_id": "jws@3.2.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-bGA2omSrFUkd72dhh05bIAN832znP4wOU3lfuXtRBuGTbsmNmDXMQg28f0Vsxaxgk4myF5YkKQpz6qeRpMgX9g==",
|
||||
"_location": "/jws",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "jws@^3.2.1",
|
||||
"name": "jws",
|
||||
"escapedName": "jws",
|
||||
"rawSpec": "^3.2.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^3.2.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/jsonwebtoken"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/jws/-/jws-3.2.1.tgz",
|
||||
"_shasum": "d79d4216a62c9afa0a3d5e8b5356d75abdeb2be5",
|
||||
"_spec": "jws@^3.2.1",
|
||||
"_where": "/Users/josh.burman/Projects/braid/node_modules/jsonwebtoken",
|
||||
"author": {
|
||||
"name": "Brian J Brennan"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/brianloveswords/node-jws/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"jwa": "^1.2.0",
|
||||
"safe-buffer": "^5.0.1"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Implementation of JSON Web Signatures",
|
||||
"devDependencies": {
|
||||
"semver": "^5.1.0",
|
||||
"tape": "~2.14.0"
|
||||
},
|
||||
"directories": {
|
||||
"test": "test"
|
||||
},
|
||||
"gitHead": "c0f6b27bcea5a2ad2e304d91c2e842e4076a6b03",
|
||||
"homepage": "https://github.com/brianloveswords/node-jws#readme",
|
||||
"keywords": [
|
||||
"jws",
|
||||
"json",
|
||||
"web",
|
||||
"signatures"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "jws",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/brianloveswords/node-jws.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "make test"
|
||||
},
|
||||
"version": "3.2.1"
|
||||
}
|
255
node_modules/jws/readme.md
generated
vendored
Normal file
255
node_modules/jws/readme.md
generated
vendored
Normal file
@ -0,0 +1,255 @@
|
||||
# node-jws [](http://travis-ci.org/brianloveswords/node-jws)
|
||||
|
||||
An implementation of [JSON Web Signatures](http://self-issued.info/docs/draft-ietf-jose-json-web-signature.html).
|
||||
|
||||
This was developed against `draft-ietf-jose-json-web-signature-08` and
|
||||
implements the entire spec **except** X.509 Certificate Chain
|
||||
signing/verifying (patches welcome).
|
||||
|
||||
There are both synchronous (`jws.sign`, `jws.verify`) and streaming
|
||||
(`jws.createSign`, `jws.createVerify`) APIs.
|
||||
|
||||
# Install
|
||||
|
||||
```bash
|
||||
$ npm install jws
|
||||
```
|
||||
|
||||
# Usage
|
||||
|
||||
## jws.ALGORITHMS
|
||||
|
||||
Array of supported algorithms. The following algorithms are currently supported.
|
||||
|
||||
alg Parameter Value | Digital Signature or MAC Algorithm
|
||||
----------------|----------------------------
|
||||
HS256 | HMAC using SHA-256 hash algorithm
|
||||
HS384 | HMAC using SHA-384 hash algorithm
|
||||
HS512 | HMAC using SHA-512 hash algorithm
|
||||
RS256 | RSASSA using SHA-256 hash algorithm
|
||||
RS384 | RSASSA using SHA-384 hash algorithm
|
||||
RS512 | RSASSA using SHA-512 hash algorithm
|
||||
PS256 | RSASSA-PSS using SHA-256 hash algorithm
|
||||
PS384 | RSASSA-PSS using SHA-384 hash algorithm
|
||||
PS512 | RSASSA-PSS using SHA-512 hash algorithm
|
||||
ES256 | ECDSA using P-256 curve and SHA-256 hash algorithm
|
||||
ES384 | ECDSA using P-384 curve and SHA-384 hash algorithm
|
||||
ES512 | ECDSA using P-521 curve and SHA-512 hash algorithm
|
||||
none | No digital signature or MAC value included
|
||||
|
||||
## jws.sign(options)
|
||||
|
||||
(Synchronous) Return a JSON Web Signature for a header and a payload.
|
||||
|
||||
Options:
|
||||
|
||||
* `header`
|
||||
* `payload`
|
||||
* `secret` or `privateKey`
|
||||
* `encoding` (Optional, defaults to 'utf8')
|
||||
|
||||
`header` must be an object with an `alg` property. `header.alg` must be
|
||||
one a value found in `jws.ALGORITHMS`. See above for a table of
|
||||
supported algorithms.
|
||||
|
||||
If `payload` is not a buffer or a string, it will be coerced into a string
|
||||
using `JSON.stringify`.
|
||||
|
||||
Example
|
||||
|
||||
```js
|
||||
const signature = jws.sign({
|
||||
header: { alg: 'HS256' },
|
||||
payload: 'h. jon benjamin',
|
||||
secret: 'has a van',
|
||||
});
|
||||
```
|
||||
|
||||
## jws.verify(signature, algorithm, secretOrKey)
|
||||
|
||||
(Synchronous) Returns `true` or `false` for whether a signature matches a
|
||||
secret or key.
|
||||
|
||||
`signature` is a JWS Signature. `header.alg` must be a value found in `jws.ALGORITHMS`.
|
||||
See above for a table of supported algorithms. `secretOrKey` is a string or
|
||||
buffer containing either the secret for HMAC algorithms, or the PEM
|
||||
encoded public key for RSA and ECDSA.
|
||||
|
||||
Note that the `"alg"` value from the signature header is ignored.
|
||||
|
||||
|
||||
## jws.decode(signature)
|
||||
|
||||
(Synchronous) Returns the decoded header, decoded payload, and signature
|
||||
parts of the JWS Signature.
|
||||
|
||||
Returns an object with three properties, e.g.
|
||||
```js
|
||||
{ header: { alg: 'HS256' },
|
||||
payload: 'h. jon benjamin',
|
||||
signature: 'YOWPewyGHKu4Y_0M_vtlEnNlqmFOclqp4Hy6hVHfFT4'
|
||||
}
|
||||
```
|
||||
|
||||
## jws.createSign(options)
|
||||
|
||||
Returns a new SignStream object.
|
||||
|
||||
Options:
|
||||
|
||||
* `header` (required)
|
||||
* `payload`
|
||||
* `key` || `privateKey` || `secret`
|
||||
* `encoding` (Optional, defaults to 'utf8')
|
||||
|
||||
Other than `header`, all options expect a string or a buffer when the
|
||||
value is known ahead of time, or a stream for convenience.
|
||||
`key`/`privateKey`/`secret` may also be an object when using an encrypted
|
||||
private key, see the [crypto documentation][encrypted-key-docs].
|
||||
|
||||
Example:
|
||||
|
||||
```js
|
||||
|
||||
// This...
|
||||
jws.createSign({
|
||||
header: { alg: 'RS256' },
|
||||
privateKey: privateKeyStream,
|
||||
payload: payloadStream,
|
||||
}).on('done', function(signature) {
|
||||
// ...
|
||||
});
|
||||
|
||||
// is equivalent to this:
|
||||
const signer = jws.createSign({
|
||||
header: { alg: 'RS256' },
|
||||
});
|
||||
privateKeyStream.pipe(signer.privateKey);
|
||||
payloadStream.pipe(signer.payload);
|
||||
signer.on('done', function(signature) {
|
||||
// ...
|
||||
});
|
||||
```
|
||||
|
||||
## jws.createVerify(options)
|
||||
|
||||
Returns a new VerifyStream object.
|
||||
|
||||
Options:
|
||||
|
||||
* `signature`
|
||||
* `algorithm`
|
||||
* `key` || `publicKey` || `secret`
|
||||
* `encoding` (Optional, defaults to 'utf8')
|
||||
|
||||
All options expect a string or a buffer when the value is known ahead of
|
||||
time, or a stream for convenience.
|
||||
|
||||
Example:
|
||||
|
||||
```js
|
||||
|
||||
// This...
|
||||
jws.createVerify({
|
||||
publicKey: pubKeyStream,
|
||||
signature: sigStream,
|
||||
}).on('done', function(verified, obj) {
|
||||
// ...
|
||||
});
|
||||
|
||||
// is equivilant to this:
|
||||
const verifier = jws.createVerify();
|
||||
pubKeyStream.pipe(verifier.publicKey);
|
||||
sigStream.pipe(verifier.signature);
|
||||
verifier.on('done', function(verified, obj) {
|
||||
// ...
|
||||
});
|
||||
```
|
||||
|
||||
## Class: SignStream
|
||||
|
||||
A `Readable Stream` that emits a single data event (the calculated
|
||||
signature) when done.
|
||||
|
||||
### Event: 'done'
|
||||
`function (signature) { }`
|
||||
|
||||
### signer.payload
|
||||
|
||||
A `Writable Stream` that expects the JWS payload. Do *not* use if you
|
||||
passed a `payload` option to the constructor.
|
||||
|
||||
Example:
|
||||
|
||||
```js
|
||||
payloadStream.pipe(signer.payload);
|
||||
```
|
||||
|
||||
### signer.secret<br>signer.key<br>signer.privateKey
|
||||
|
||||
A `Writable Stream`. Expects the JWS secret for HMAC, or the privateKey
|
||||
for ECDSA and RSA. Do *not* use if you passed a `secret` or `key` option
|
||||
to the constructor.
|
||||
|
||||
Example:
|
||||
|
||||
```js
|
||||
privateKeyStream.pipe(signer.privateKey);
|
||||
```
|
||||
|
||||
## Class: VerifyStream
|
||||
|
||||
This is a `Readable Stream` that emits a single data event, the result
|
||||
of whether or not that signature was valid.
|
||||
|
||||
### Event: 'done'
|
||||
`function (valid, obj) { }`
|
||||
|
||||
`valid` is a boolean for whether or not the signature is valid.
|
||||
|
||||
### verifier.signature
|
||||
|
||||
A `Writable Stream` that expects a JWS Signature. Do *not* use if you
|
||||
passed a `signature` option to the constructor.
|
||||
|
||||
### verifier.secret<br>verifier.key<br>verifier.publicKey
|
||||
|
||||
A `Writable Stream` that expects a public key or secret. Do *not* use if you
|
||||
passed a `key` or `secret` option to the constructor.
|
||||
|
||||
# TODO
|
||||
|
||||
* It feels like there should be some convenience options/APIs for
|
||||
defining the algorithm rather than having to define a header object
|
||||
with `{ alg: 'ES512' }` or whatever every time.
|
||||
|
||||
* X.509 support, ugh
|
||||
|
||||
# License
|
||||
|
||||
MIT
|
||||
|
||||
```
|
||||
Copyright (c) 2013-2015 Brian J. Brennan
|
||||
|
||||
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.
|
||||
```
|
||||
|
||||
[encrypted-key-docs]: https://nodejs.org/api/crypto.html#crypto_sign_sign_private_key_output_format
|
47
node_modules/lodash.includes/LICENSE
generated
vendored
Normal file
47
node_modules/lodash.includes/LICENSE
generated
vendored
Normal file
@ -0,0 +1,47 @@
|
||||
Copyright jQuery Foundation and other contributors <https://jquery.org/>
|
||||
|
||||
Based on Underscore.js, copyright Jeremy Ashkenas,
|
||||
DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
|
||||
|
||||
This software consists of voluntary contributions made by many
|
||||
individuals. For exact contribution history, see the revision history
|
||||
available at https://github.com/lodash/lodash
|
||||
|
||||
The following license applies to all parts of this software except as
|
||||
documented below:
|
||||
|
||||
====
|
||||
|
||||
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.
|
||||
|
||||
====
|
||||
|
||||
Copyright and related rights for sample code are waived via CC0. Sample
|
||||
code is defined as all source code displayed within the prose of the
|
||||
documentation.
|
||||
|
||||
CC0: http://creativecommons.org/publicdomain/zero/1.0/
|
||||
|
||||
====
|
||||
|
||||
Files located in the node_modules and vendor directories are externally
|
||||
maintained libraries used by this software which have their own
|
||||
licenses; we recommend you read them, as their terms may differ from the
|
||||
terms above.
|
18
node_modules/lodash.includes/README.md
generated
vendored
Normal file
18
node_modules/lodash.includes/README.md
generated
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
# lodash.includes v4.3.0
|
||||
|
||||
The [lodash](https://lodash.com/) method `_.includes` exported as a [Node.js](https://nodejs.org/) module.
|
||||
|
||||
## Installation
|
||||
|
||||
Using npm:
|
||||
```bash
|
||||
$ {sudo -H} npm i -g npm
|
||||
$ npm i --save lodash.includes
|
||||
```
|
||||
|
||||
In Node.js:
|
||||
```js
|
||||
var includes = require('lodash.includes');
|
||||
```
|
||||
|
||||
See the [documentation](https://lodash.com/docs#includes) or [package source](https://github.com/lodash/lodash/blob/4.3.0-npm-packages/lodash.includes) for more details.
|
745
node_modules/lodash.includes/index.js
generated
vendored
Normal file
745
node_modules/lodash.includes/index.js
generated
vendored
Normal file
@ -0,0 +1,745 @@
|
||||
/**
|
||||
* lodash (Custom Build) <https://lodash.com/>
|
||||
* Build: `lodash modularize exports="npm" -o ./`
|
||||
* Copyright jQuery Foundation and other contributors <https://jquery.org/>
|
||||
* Released under MIT license <https://lodash.com/license>
|
||||
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
||||
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
||||
*/
|
||||
|
||||
/** Used as references for various `Number` constants. */
|
||||
var INFINITY = 1 / 0,
|
||||
MAX_SAFE_INTEGER = 9007199254740991,
|
||||
MAX_INTEGER = 1.7976931348623157e+308,
|
||||
NAN = 0 / 0;
|
||||
|
||||
/** `Object#toString` result references. */
|
||||
var argsTag = '[object Arguments]',
|
||||
funcTag = '[object Function]',
|
||||
genTag = '[object GeneratorFunction]',
|
||||
stringTag = '[object String]',
|
||||
symbolTag = '[object Symbol]';
|
||||
|
||||
/** Used to match leading and trailing whitespace. */
|
||||
var reTrim = /^\s+|\s+$/g;
|
||||
|
||||
/** Used to detect bad signed hexadecimal string values. */
|
||||
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
|
||||
|
||||
/** Used to detect binary string values. */
|
||||
var reIsBinary = /^0b[01]+$/i;
|
||||
|
||||
/** Used to detect octal string values. */
|
||||
var reIsOctal = /^0o[0-7]+$/i;
|
||||
|
||||
/** Used to detect unsigned integer values. */
|
||||
var reIsUint = /^(?:0|[1-9]\d*)$/;
|
||||
|
||||
/** Built-in method references without a dependency on `root`. */
|
||||
var freeParseInt = parseInt;
|
||||
|
||||
/**
|
||||
* A specialized version of `_.map` for arrays without support for iteratee
|
||||
* shorthands.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} [array] The array to iterate over.
|
||||
* @param {Function} iteratee The function invoked per iteration.
|
||||
* @returns {Array} Returns the new mapped array.
|
||||
*/
|
||||
function arrayMap(array, iteratee) {
|
||||
var index = -1,
|
||||
length = array ? array.length : 0,
|
||||
result = Array(length);
|
||||
|
||||
while (++index < length) {
|
||||
result[index] = iteratee(array[index], index, array);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* The base implementation of `_.findIndex` and `_.findLastIndex` without
|
||||
* support for iteratee shorthands.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} array The array to inspect.
|
||||
* @param {Function} predicate The function invoked per iteration.
|
||||
* @param {number} fromIndex The index to search from.
|
||||
* @param {boolean} [fromRight] Specify iterating from right to left.
|
||||
* @returns {number} Returns the index of the matched value, else `-1`.
|
||||
*/
|
||||
function baseFindIndex(array, predicate, fromIndex, fromRight) {
|
||||
var length = array.length,
|
||||
index = fromIndex + (fromRight ? 1 : -1);
|
||||
|
||||
while ((fromRight ? index-- : ++index < length)) {
|
||||
if (predicate(array[index], index, array)) {
|
||||
return index;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* The base implementation of `_.indexOf` without `fromIndex` bounds checks.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} array The array to inspect.
|
||||
* @param {*} value The value to search for.
|
||||
* @param {number} fromIndex The index to search from.
|
||||
* @returns {number} Returns the index of the matched value, else `-1`.
|
||||
*/
|
||||
function baseIndexOf(array, value, fromIndex) {
|
||||
if (value !== value) {
|
||||
return baseFindIndex(array, baseIsNaN, fromIndex);
|
||||
}
|
||||
var index = fromIndex - 1,
|
||||
length = array.length;
|
||||
|
||||
while (++index < length) {
|
||||
if (array[index] === value) {
|
||||
return index;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* The base implementation of `_.isNaN` without support for number objects.
|
||||
*
|
||||
* @private
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
|
||||
*/
|
||||
function baseIsNaN(value) {
|
||||
return value !== value;
|
||||
}
|
||||
|
||||
/**
|
||||
* The base implementation of `_.times` without support for iteratee shorthands
|
||||
* or max array length checks.
|
||||
*
|
||||
* @private
|
||||
* @param {number} n The number of times to invoke `iteratee`.
|
||||
* @param {Function} iteratee The function invoked per iteration.
|
||||
* @returns {Array} Returns the array of results.
|
||||
*/
|
||||
function baseTimes(n, iteratee) {
|
||||
var index = -1,
|
||||
result = Array(n);
|
||||
|
||||
while (++index < n) {
|
||||
result[index] = iteratee(index);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* The base implementation of `_.values` and `_.valuesIn` which creates an
|
||||
* array of `object` property values corresponding to the property names
|
||||
* of `props`.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} object The object to query.
|
||||
* @param {Array} props The property names to get values for.
|
||||
* @returns {Object} Returns the array of property values.
|
||||
*/
|
||||
function baseValues(object, props) {
|
||||
return arrayMap(props, function(key) {
|
||||
return object[key];
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a unary function that invokes `func` with its argument transformed.
|
||||
*
|
||||
* @private
|
||||
* @param {Function} func The function to wrap.
|
||||
* @param {Function} transform The argument transform.
|
||||
* @returns {Function} Returns the new function.
|
||||
*/
|
||||
function overArg(func, transform) {
|
||||
return function(arg) {
|
||||
return func(transform(arg));
|
||||
};
|
||||
}
|
||||
|
||||
/** Used for built-in method references. */
|
||||
var objectProto = Object.prototype;
|
||||
|
||||
/** Used to check objects for own properties. */
|
||||
var hasOwnProperty = objectProto.hasOwnProperty;
|
||||
|
||||
/**
|
||||
* Used to resolve the
|
||||
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
||||
* of values.
|
||||
*/
|
||||
var objectToString = objectProto.toString;
|
||||
|
||||
/** Built-in value references. */
|
||||
var propertyIsEnumerable = objectProto.propertyIsEnumerable;
|
||||
|
||||
/* Built-in method references for those with the same name as other `lodash` methods. */
|
||||
var nativeKeys = overArg(Object.keys, Object),
|
||||
nativeMax = Math.max;
|
||||
|
||||
/**
|
||||
* Creates an array of the enumerable property names of the array-like `value`.
|
||||
*
|
||||
* @private
|
||||
* @param {*} value The value to query.
|
||||
* @param {boolean} inherited Specify returning inherited property names.
|
||||
* @returns {Array} Returns the array of property names.
|
||||
*/
|
||||
function arrayLikeKeys(value, inherited) {
|
||||
// Safari 8.1 makes `arguments.callee` enumerable in strict mode.
|
||||
// Safari 9 makes `arguments.length` enumerable in strict mode.
|
||||
var result = (isArray(value) || isArguments(value))
|
||||
? baseTimes(value.length, String)
|
||||
: [];
|
||||
|
||||
var length = result.length,
|
||||
skipIndexes = !!length;
|
||||
|
||||
for (var key in value) {
|
||||
if ((inherited || hasOwnProperty.call(value, key)) &&
|
||||
!(skipIndexes && (key == 'length' || isIndex(key, length)))) {
|
||||
result.push(key);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} object The object to query.
|
||||
* @returns {Array} Returns the array of property names.
|
||||
*/
|
||||
function baseKeys(object) {
|
||||
if (!isPrototype(object)) {
|
||||
return nativeKeys(object);
|
||||
}
|
||||
var result = [];
|
||||
for (var key in Object(object)) {
|
||||
if (hasOwnProperty.call(object, key) && key != 'constructor') {
|
||||
result.push(key);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if `value` is a valid array-like index.
|
||||
*
|
||||
* @private
|
||||
* @param {*} value The value to check.
|
||||
* @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
|
||||
* @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
|
||||
*/
|
||||
function isIndex(value, length) {
|
||||
length = length == null ? MAX_SAFE_INTEGER : length;
|
||||
return !!length &&
|
||||
(typeof value == 'number' || reIsUint.test(value)) &&
|
||||
(value > -1 && value % 1 == 0 && value < length);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if `value` is likely a prototype object.
|
||||
*
|
||||
* @private
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
|
||||
*/
|
||||
function isPrototype(value) {
|
||||
var Ctor = value && value.constructor,
|
||||
proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
|
||||
|
||||
return value === proto;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if `value` is in `collection`. If `collection` is a string, it's
|
||||
* checked for a substring of `value`, otherwise
|
||||
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
||||
* is used for equality comparisons. If `fromIndex` is negative, it's used as
|
||||
* the offset from the end of `collection`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 0.1.0
|
||||
* @category Collection
|
||||
* @param {Array|Object|string} collection The collection to inspect.
|
||||
* @param {*} value The value to search for.
|
||||
* @param {number} [fromIndex=0] The index to search from.
|
||||
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
|
||||
* @returns {boolean} Returns `true` if `value` is found, else `false`.
|
||||
* @example
|
||||
*
|
||||
* _.includes([1, 2, 3], 1);
|
||||
* // => true
|
||||
*
|
||||
* _.includes([1, 2, 3], 1, 2);
|
||||
* // => false
|
||||
*
|
||||
* _.includes({ 'a': 1, 'b': 2 }, 1);
|
||||
* // => true
|
||||
*
|
||||
* _.includes('abcd', 'bc');
|
||||
* // => true
|
||||
*/
|
||||
function includes(collection, value, fromIndex, guard) {
|
||||
collection = isArrayLike(collection) ? collection : values(collection);
|
||||
fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
|
||||
|
||||
var length = collection.length;
|
||||
if (fromIndex < 0) {
|
||||
fromIndex = nativeMax(length + fromIndex, 0);
|
||||
}
|
||||
return isString(collection)
|
||||
? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
|
||||
: (!!length && baseIndexOf(collection, value, fromIndex) > -1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if `value` is likely an `arguments` object.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 0.1.0
|
||||
* @category Lang
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
|
||||
* else `false`.
|
||||
* @example
|
||||
*
|
||||
* _.isArguments(function() { return arguments; }());
|
||||
* // => true
|
||||
*
|
||||
* _.isArguments([1, 2, 3]);
|
||||
* // => false
|
||||
*/
|
||||
function isArguments(value) {
|
||||
// Safari 8.1 makes `arguments.callee` enumerable in strict mode.
|
||||
return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&
|
||||
(!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if `value` is classified as an `Array` object.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 0.1.0
|
||||
* @category Lang
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is an array, else `false`.
|
||||
* @example
|
||||
*
|
||||
* _.isArray([1, 2, 3]);
|
||||
* // => true
|
||||
*
|
||||
* _.isArray(document.body.children);
|
||||
* // => false
|
||||
*
|
||||
* _.isArray('abc');
|
||||
* // => false
|
||||
*
|
||||
* _.isArray(_.noop);
|
||||
* // => false
|
||||
*/
|
||||
var isArray = Array.isArray;
|
||||
|
||||
/**
|
||||
* Checks if `value` is array-like. A value is considered array-like if it's
|
||||
* not a function and has a `value.length` that's an integer greater than or
|
||||
* equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 4.0.0
|
||||
* @category Lang
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is array-like, else `false`.
|
||||
* @example
|
||||
*
|
||||
* _.isArrayLike([1, 2, 3]);
|
||||
* // => true
|
||||
*
|
||||
* _.isArrayLike(document.body.children);
|
||||
* // => true
|
||||
*
|
||||
* _.isArrayLike('abc');
|
||||
* // => true
|
||||
*
|
||||
* _.isArrayLike(_.noop);
|
||||
* // => false
|
||||
*/
|
||||
function isArrayLike(value) {
|
||||
return value != null && isLength(value.length) && !isFunction(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is like `_.isArrayLike` except that it also checks if `value`
|
||||
* is an object.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 4.0.0
|
||||
* @category Lang
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is an array-like object,
|
||||
* else `false`.
|
||||
* @example
|
||||
*
|
||||
* _.isArrayLikeObject([1, 2, 3]);
|
||||
* // => true
|
||||
*
|
||||
* _.isArrayLikeObject(document.body.children);
|
||||
* // => true
|
||||
*
|
||||
* _.isArrayLikeObject('abc');
|
||||
* // => false
|
||||
*
|
||||
* _.isArrayLikeObject(_.noop);
|
||||
* // => false
|
||||
*/
|
||||
function isArrayLikeObject(value) {
|
||||
return isObjectLike(value) && isArrayLike(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if `value` is classified as a `Function` object.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 0.1.0
|
||||
* @category Lang
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is a function, else `false`.
|
||||
* @example
|
||||
*
|
||||
* _.isFunction(_);
|
||||
* // => true
|
||||
*
|
||||
* _.isFunction(/abc/);
|
||||
* // => false
|
||||
*/
|
||||
function isFunction(value) {
|
||||
// The use of `Object#toString` avoids issues with the `typeof` operator
|
||||
// in Safari 8-9 which returns 'object' for typed array and other constructors.
|
||||
var tag = isObject(value) ? objectToString.call(value) : '';
|
||||
return tag == funcTag || tag == genTag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if `value` is a valid array-like length.
|
||||
*
|
||||
* **Note:** This method is loosely based on
|
||||
* [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 4.0.0
|
||||
* @category Lang
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
|
||||
* @example
|
||||
*
|
||||
* _.isLength(3);
|
||||
* // => true
|
||||
*
|
||||
* _.isLength(Number.MIN_VALUE);
|
||||
* // => false
|
||||
*
|
||||
* _.isLength(Infinity);
|
||||
* // => false
|
||||
*
|
||||
* _.isLength('3');
|
||||
* // => false
|
||||
*/
|
||||
function isLength(value) {
|
||||
return typeof value == 'number' &&
|
||||
value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if `value` is the
|
||||
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
|
||||
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 0.1.0
|
||||
* @category Lang
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
|
||||
* @example
|
||||
*
|
||||
* _.isObject({});
|
||||
* // => true
|
||||
*
|
||||
* _.isObject([1, 2, 3]);
|
||||
* // => true
|
||||
*
|
||||
* _.isObject(_.noop);
|
||||
* // => true
|
||||
*
|
||||
* _.isObject(null);
|
||||
* // => false
|
||||
*/
|
||||
function isObject(value) {
|
||||
var type = typeof value;
|
||||
return !!value && (type == 'object' || type == 'function');
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
||||
* and has a `typeof` result of "object".
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 4.0.0
|
||||
* @category Lang
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
||||
* @example
|
||||
*
|
||||
* _.isObjectLike({});
|
||||
* // => true
|
||||
*
|
||||
* _.isObjectLike([1, 2, 3]);
|
||||
* // => true
|
||||
*
|
||||
* _.isObjectLike(_.noop);
|
||||
* // => false
|
||||
*
|
||||
* _.isObjectLike(null);
|
||||
* // => false
|
||||
*/
|
||||
function isObjectLike(value) {
|
||||
return !!value && typeof value == 'object';
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if `value` is classified as a `String` primitive or object.
|
||||
*
|
||||
* @static
|
||||
* @since 0.1.0
|
||||
* @memberOf _
|
||||
* @category Lang
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is a string, else `false`.
|
||||
* @example
|
||||
*
|
||||
* _.isString('abc');
|
||||
* // => true
|
||||
*
|
||||
* _.isString(1);
|
||||
* // => false
|
||||
*/
|
||||
function isString(value) {
|
||||
return typeof value == 'string' ||
|
||||
(!isArray(value) && isObjectLike(value) && objectToString.call(value) == stringTag);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if `value` is classified as a `Symbol` primitive or object.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 4.0.0
|
||||
* @category Lang
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
|
||||
* @example
|
||||
*
|
||||
* _.isSymbol(Symbol.iterator);
|
||||
* // => true
|
||||
*
|
||||
* _.isSymbol('abc');
|
||||
* // => false
|
||||
*/
|
||||
function isSymbol(value) {
|
||||
return typeof value == 'symbol' ||
|
||||
(isObjectLike(value) && objectToString.call(value) == symbolTag);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts `value` to a finite number.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 4.12.0
|
||||
* @category Lang
|
||||
* @param {*} value The value to convert.
|
||||
* @returns {number} Returns the converted number.
|
||||
* @example
|
||||
*
|
||||
* _.toFinite(3.2);
|
||||
* // => 3.2
|
||||
*
|
||||
* _.toFinite(Number.MIN_VALUE);
|
||||
* // => 5e-324
|
||||
*
|
||||
* _.toFinite(Infinity);
|
||||
* // => 1.7976931348623157e+308
|
||||
*
|
||||
* _.toFinite('3.2');
|
||||
* // => 3.2
|
||||
*/
|
||||
function toFinite(value) {
|
||||
if (!value) {
|
||||
return value === 0 ? value : 0;
|
||||
}
|
||||
value = toNumber(value);
|
||||
if (value === INFINITY || value === -INFINITY) {
|
||||
var sign = (value < 0 ? -1 : 1);
|
||||
return sign * MAX_INTEGER;
|
||||
}
|
||||
return value === value ? value : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts `value` to an integer.
|
||||
*
|
||||
* **Note:** This method is loosely based on
|
||||
* [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 4.0.0
|
||||
* @category Lang
|
||||
* @param {*} value The value to convert.
|
||||
* @returns {number} Returns the converted integer.
|
||||
* @example
|
||||
*
|
||||
* _.toInteger(3.2);
|
||||
* // => 3
|
||||
*
|
||||
* _.toInteger(Number.MIN_VALUE);
|
||||
* // => 0
|
||||
*
|
||||
* _.toInteger(Infinity);
|
||||
* // => 1.7976931348623157e+308
|
||||
*
|
||||
* _.toInteger('3.2');
|
||||
* // => 3
|
||||
*/
|
||||
function toInteger(value) {
|
||||
var result = toFinite(value),
|
||||
remainder = result % 1;
|
||||
|
||||
return result === result ? (remainder ? result - remainder : result) : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts `value` to a number.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 4.0.0
|
||||
* @category Lang
|
||||
* @param {*} value The value to process.
|
||||
* @returns {number} Returns the number.
|
||||
* @example
|
||||
*
|
||||
* _.toNumber(3.2);
|
||||
* // => 3.2
|
||||
*
|
||||
* _.toNumber(Number.MIN_VALUE);
|
||||
* // => 5e-324
|
||||
*
|
||||
* _.toNumber(Infinity);
|
||||
* // => Infinity
|
||||
*
|
||||
* _.toNumber('3.2');
|
||||
* // => 3.2
|
||||
*/
|
||||
function toNumber(value) {
|
||||
if (typeof value == 'number') {
|
||||
return value;
|
||||
}
|
||||
if (isSymbol(value)) {
|
||||
return NAN;
|
||||
}
|
||||
if (isObject(value)) {
|
||||
var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
|
||||
value = isObject(other) ? (other + '') : other;
|
||||
}
|
||||
if (typeof value != 'string') {
|
||||
return value === 0 ? value : +value;
|
||||
}
|
||||
value = value.replace(reTrim, '');
|
||||
var isBinary = reIsBinary.test(value);
|
||||
return (isBinary || reIsOctal.test(value))
|
||||
? freeParseInt(value.slice(2), isBinary ? 2 : 8)
|
||||
: (reIsBadHex.test(value) ? NAN : +value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an array of the own enumerable property names of `object`.
|
||||
*
|
||||
* **Note:** Non-object values are coerced to objects. See the
|
||||
* [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
|
||||
* for more details.
|
||||
*
|
||||
* @static
|
||||
* @since 0.1.0
|
||||
* @memberOf _
|
||||
* @category Object
|
||||
* @param {Object} object The object to query.
|
||||
* @returns {Array} Returns the array of property names.
|
||||
* @example
|
||||
*
|
||||
* function Foo() {
|
||||
* this.a = 1;
|
||||
* this.b = 2;
|
||||
* }
|
||||
*
|
||||
* Foo.prototype.c = 3;
|
||||
*
|
||||
* _.keys(new Foo);
|
||||
* // => ['a', 'b'] (iteration order is not guaranteed)
|
||||
*
|
||||
* _.keys('hi');
|
||||
* // => ['0', '1']
|
||||
*/
|
||||
function keys(object) {
|
||||
return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an array of the own enumerable string keyed property values of `object`.
|
||||
*
|
||||
* **Note:** Non-object values are coerced to objects.
|
||||
*
|
||||
* @static
|
||||
* @since 0.1.0
|
||||
* @memberOf _
|
||||
* @category Object
|
||||
* @param {Object} object The object to query.
|
||||
* @returns {Array} Returns the array of property values.
|
||||
* @example
|
||||
*
|
||||
* function Foo() {
|
||||
* this.a = 1;
|
||||
* this.b = 2;
|
||||
* }
|
||||
*
|
||||
* Foo.prototype.c = 3;
|
||||
*
|
||||
* _.values(new Foo);
|
||||
* // => [1, 2] (iteration order is not guaranteed)
|
||||
*
|
||||
* _.values('hi');
|
||||
* // => ['h', 'i']
|
||||
*/
|
||||
function values(object) {
|
||||
return object ? baseValues(object, keys(object)) : [];
|
||||
}
|
||||
|
||||
module.exports = includes;
|
69
node_modules/lodash.includes/package.json
generated
vendored
Normal file
69
node_modules/lodash.includes/package.json
generated
vendored
Normal file
@ -0,0 +1,69 @@
|
||||
{
|
||||
"_from": "lodash.includes@^4.3.0",
|
||||
"_id": "lodash.includes@4.3.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-YLuYqHy5I8aMoeUTJUgzFISfVT8=",
|
||||
"_location": "/lodash.includes",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "lodash.includes@^4.3.0",
|
||||
"name": "lodash.includes",
|
||||
"escapedName": "lodash.includes",
|
||||
"rawSpec": "^4.3.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^4.3.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/jsonwebtoken"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz",
|
||||
"_shasum": "60bb98a87cb923c68ca1e51325483314849f553f",
|
||||
"_spec": "lodash.includes@^4.3.0",
|
||||
"_where": "/Users/josh.burman/Projects/braid/node_modules/jsonwebtoken",
|
||||
"author": {
|
||||
"name": "John-David Dalton",
|
||||
"email": "john.david.dalton@gmail.com",
|
||||
"url": "http://allyoucanleet.com/"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/lodash/lodash/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": [
|
||||
{
|
||||
"name": "John-David Dalton",
|
||||
"email": "john.david.dalton@gmail.com",
|
||||
"url": "http://allyoucanleet.com/"
|
||||
},
|
||||
{
|
||||
"name": "Blaine Bublitz",
|
||||
"email": "blaine.bublitz@gmail.com",
|
||||
"url": "https://github.com/phated"
|
||||
},
|
||||
{
|
||||
"name": "Mathias Bynens",
|
||||
"email": "mathias@qiwi.be",
|
||||
"url": "https://mathiasbynens.be/"
|
||||
}
|
||||
],
|
||||
"deprecated": false,
|
||||
"description": "The lodash method `_.includes` exported as a module.",
|
||||
"homepage": "https://lodash.com/",
|
||||
"icon": "https://lodash.com/icon.svg",
|
||||
"keywords": [
|
||||
"lodash-modularized",
|
||||
"includes"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "lodash.includes",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/lodash/lodash.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\""
|
||||
},
|
||||
"version": "4.3.0"
|
||||
}
|
22
node_modules/lodash.isboolean/LICENSE
generated
vendored
Normal file
22
node_modules/lodash.isboolean/LICENSE
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/>
|
||||
Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas,
|
||||
DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
|
||||
|
||||
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.
|
18
node_modules/lodash.isboolean/README.md
generated
vendored
Normal file
18
node_modules/lodash.isboolean/README.md
generated
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
# lodash.isboolean v3.0.3
|
||||
|
||||
The [lodash](https://lodash.com/) method `_.isBoolean` exported as a [Node.js](https://nodejs.org/) module.
|
||||
|
||||
## Installation
|
||||
|
||||
Using npm:
|
||||
```bash
|
||||
$ {sudo -H} npm i -g npm
|
||||
$ npm i --save lodash.isboolean
|
||||
```
|
||||
|
||||
In Node.js:
|
||||
```js
|
||||
var isBoolean = require('lodash.isboolean');
|
||||
```
|
||||
|
||||
See the [documentation](https://lodash.com/docs#isBoolean) or [package source](https://github.com/lodash/lodash/blob/3.0.3-npm-packages/lodash.isboolean) for more details.
|
70
node_modules/lodash.isboolean/index.js
generated
vendored
Normal file
70
node_modules/lodash.isboolean/index.js
generated
vendored
Normal file
@ -0,0 +1,70 @@
|
||||
/**
|
||||
* lodash 3.0.3 (Custom Build) <https://lodash.com/>
|
||||
* Build: `lodash modularize exports="npm" -o ./`
|
||||
* Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/>
|
||||
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
||||
* Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
||||
* Available under MIT license <https://lodash.com/license>
|
||||
*/
|
||||
|
||||
/** `Object#toString` result references. */
|
||||
var boolTag = '[object Boolean]';
|
||||
|
||||
/** Used for built-in method references. */
|
||||
var objectProto = Object.prototype;
|
||||
|
||||
/**
|
||||
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
|
||||
* of values.
|
||||
*/
|
||||
var objectToString = objectProto.toString;
|
||||
|
||||
/**
|
||||
* Checks if `value` is classified as a boolean primitive or object.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Lang
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
|
||||
* @example
|
||||
*
|
||||
* _.isBoolean(false);
|
||||
* // => true
|
||||
*
|
||||
* _.isBoolean(null);
|
||||
* // => false
|
||||
*/
|
||||
function isBoolean(value) {
|
||||
return value === true || value === false ||
|
||||
(isObjectLike(value) && objectToString.call(value) == boolTag);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
||||
* and has a `typeof` result of "object".
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Lang
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
||||
* @example
|
||||
*
|
||||
* _.isObjectLike({});
|
||||
* // => true
|
||||
*
|
||||
* _.isObjectLike([1, 2, 3]);
|
||||
* // => true
|
||||
*
|
||||
* _.isObjectLike(_.noop);
|
||||
* // => false
|
||||
*
|
||||
* _.isObjectLike(null);
|
||||
* // => false
|
||||
*/
|
||||
function isObjectLike(value) {
|
||||
return !!value && typeof value == 'object';
|
||||
}
|
||||
|
||||
module.exports = isBoolean;
|
69
node_modules/lodash.isboolean/package.json
generated
vendored
Normal file
69
node_modules/lodash.isboolean/package.json
generated
vendored
Normal file
@ -0,0 +1,69 @@
|
||||
{
|
||||
"_from": "lodash.isboolean@^3.0.3",
|
||||
"_id": "lodash.isboolean@3.0.3",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-bC4XHbKiV82WgC/UOwGyDV9YcPY=",
|
||||
"_location": "/lodash.isboolean",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "lodash.isboolean@^3.0.3",
|
||||
"name": "lodash.isboolean",
|
||||
"escapedName": "lodash.isboolean",
|
||||
"rawSpec": "^3.0.3",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^3.0.3"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/jsonwebtoken"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz",
|
||||
"_shasum": "6c2e171db2a257cd96802fd43b01b20d5f5870f6",
|
||||
"_spec": "lodash.isboolean@^3.0.3",
|
||||
"_where": "/Users/josh.burman/Projects/braid/node_modules/jsonwebtoken",
|
||||
"author": {
|
||||
"name": "John-David Dalton",
|
||||
"email": "john.david.dalton@gmail.com",
|
||||
"url": "http://allyoucanleet.com/"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/lodash/lodash/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": [
|
||||
{
|
||||
"name": "John-David Dalton",
|
||||
"email": "john.david.dalton@gmail.com",
|
||||
"url": "http://allyoucanleet.com/"
|
||||
},
|
||||
{
|
||||
"name": "Blaine Bublitz",
|
||||
"email": "blaine@iceddev.com",
|
||||
"url": "https://github.com/phated"
|
||||
},
|
||||
{
|
||||
"name": "Mathias Bynens",
|
||||
"email": "mathias@qiwi.be",
|
||||
"url": "https://mathiasbynens.be/"
|
||||
}
|
||||
],
|
||||
"deprecated": false,
|
||||
"description": "The lodash method `_.isBoolean` exported as a module.",
|
||||
"homepage": "https://lodash.com/",
|
||||
"icon": "https://lodash.com/icon.svg",
|
||||
"keywords": [
|
||||
"lodash-modularized",
|
||||
"isboolean"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "lodash.isboolean",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/lodash/lodash.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\""
|
||||
},
|
||||
"version": "3.0.3"
|
||||
}
|
47
node_modules/lodash.isinteger/LICENSE
generated
vendored
Normal file
47
node_modules/lodash.isinteger/LICENSE
generated
vendored
Normal file
@ -0,0 +1,47 @@
|
||||
Copyright jQuery Foundation and other contributors <https://jquery.org/>
|
||||
|
||||
Based on Underscore.js, copyright Jeremy Ashkenas,
|
||||
DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
|
||||
|
||||
This software consists of voluntary contributions made by many
|
||||
individuals. For exact contribution history, see the revision history
|
||||
available at https://github.com/lodash/lodash
|
||||
|
||||
The following license applies to all parts of this software except as
|
||||
documented below:
|
||||
|
||||
====
|
||||
|
||||
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.
|
||||
|
||||
====
|
||||
|
||||
Copyright and related rights for sample code are waived via CC0. Sample
|
||||
code is defined as all source code displayed within the prose of the
|
||||
documentation.
|
||||
|
||||
CC0: http://creativecommons.org/publicdomain/zero/1.0/
|
||||
|
||||
====
|
||||
|
||||
Files located in the node_modules and vendor directories are externally
|
||||
maintained libraries used by this software which have their own
|
||||
licenses; we recommend you read them, as their terms may differ from the
|
||||
terms above.
|
18
node_modules/lodash.isinteger/README.md
generated
vendored
Normal file
18
node_modules/lodash.isinteger/README.md
generated
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
# lodash.isinteger v4.0.4
|
||||
|
||||
The [lodash](https://lodash.com/) method `_.isInteger` exported as a [Node.js](https://nodejs.org/) module.
|
||||
|
||||
## Installation
|
||||
|
||||
Using npm:
|
||||
```bash
|
||||
$ {sudo -H} npm i -g npm
|
||||
$ npm i --save lodash.isinteger
|
||||
```
|
||||
|
||||
In Node.js:
|
||||
```js
|
||||
var isInteger = require('lodash.isinteger');
|
||||
```
|
||||
|
||||
See the [documentation](https://lodash.com/docs#isInteger) or [package source](https://github.com/lodash/lodash/blob/4.0.4-npm-packages/lodash.isinteger) for more details.
|
265
node_modules/lodash.isinteger/index.js
generated
vendored
Normal file
265
node_modules/lodash.isinteger/index.js
generated
vendored
Normal file
@ -0,0 +1,265 @@
|
||||
/**
|
||||
* lodash (Custom Build) <https://lodash.com/>
|
||||
* Build: `lodash modularize exports="npm" -o ./`
|
||||
* Copyright jQuery Foundation and other contributors <https://jquery.org/>
|
||||
* Released under MIT license <https://lodash.com/license>
|
||||
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
||||
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
||||
*/
|
||||
|
||||
/** Used as references for various `Number` constants. */
|
||||
var INFINITY = 1 / 0,
|
||||
MAX_INTEGER = 1.7976931348623157e+308,
|
||||
NAN = 0 / 0;
|
||||
|
||||
/** `Object#toString` result references. */
|
||||
var symbolTag = '[object Symbol]';
|
||||
|
||||
/** Used to match leading and trailing whitespace. */
|
||||
var reTrim = /^\s+|\s+$/g;
|
||||
|
||||
/** Used to detect bad signed hexadecimal string values. */
|
||||
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
|
||||
|
||||
/** Used to detect binary string values. */
|
||||
var reIsBinary = /^0b[01]+$/i;
|
||||
|
||||
/** Used to detect octal string values. */
|
||||
var reIsOctal = /^0o[0-7]+$/i;
|
||||
|
||||
/** Built-in method references without a dependency on `root`. */
|
||||
var freeParseInt = parseInt;
|
||||
|
||||
/** Used for built-in method references. */
|
||||
var objectProto = Object.prototype;
|
||||
|
||||
/**
|
||||
* Used to resolve the
|
||||
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
||||
* of values.
|
||||
*/
|
||||
var objectToString = objectProto.toString;
|
||||
|
||||
/**
|
||||
* Checks if `value` is an integer.
|
||||
*
|
||||
* **Note:** This method is based on
|
||||
* [`Number.isInteger`](https://mdn.io/Number/isInteger).
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 4.0.0
|
||||
* @category Lang
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is an integer, else `false`.
|
||||
* @example
|
||||
*
|
||||
* _.isInteger(3);
|
||||
* // => true
|
||||
*
|
||||
* _.isInteger(Number.MIN_VALUE);
|
||||
* // => false
|
||||
*
|
||||
* _.isInteger(Infinity);
|
||||
* // => false
|
||||
*
|
||||
* _.isInteger('3');
|
||||
* // => false
|
||||
*/
|
||||
function isInteger(value) {
|
||||
return typeof value == 'number' && value == toInteger(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if `value` is the
|
||||
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
|
||||
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 0.1.0
|
||||
* @category Lang
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
|
||||
* @example
|
||||
*
|
||||
* _.isObject({});
|
||||
* // => true
|
||||
*
|
||||
* _.isObject([1, 2, 3]);
|
||||
* // => true
|
||||
*
|
||||
* _.isObject(_.noop);
|
||||
* // => true
|
||||
*
|
||||
* _.isObject(null);
|
||||
* // => false
|
||||
*/
|
||||
function isObject(value) {
|
||||
var type = typeof value;
|
||||
return !!value && (type == 'object' || type == 'function');
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
||||
* and has a `typeof` result of "object".
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 4.0.0
|
||||
* @category Lang
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
||||
* @example
|
||||
*
|
||||
* _.isObjectLike({});
|
||||
* // => true
|
||||
*
|
||||
* _.isObjectLike([1, 2, 3]);
|
||||
* // => true
|
||||
*
|
||||
* _.isObjectLike(_.noop);
|
||||
* // => false
|
||||
*
|
||||
* _.isObjectLike(null);
|
||||
* // => false
|
||||
*/
|
||||
function isObjectLike(value) {
|
||||
return !!value && typeof value == 'object';
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if `value` is classified as a `Symbol` primitive or object.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 4.0.0
|
||||
* @category Lang
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
|
||||
* @example
|
||||
*
|
||||
* _.isSymbol(Symbol.iterator);
|
||||
* // => true
|
||||
*
|
||||
* _.isSymbol('abc');
|
||||
* // => false
|
||||
*/
|
||||
function isSymbol(value) {
|
||||
return typeof value == 'symbol' ||
|
||||
(isObjectLike(value) && objectToString.call(value) == symbolTag);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts `value` to a finite number.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 4.12.0
|
||||
* @category Lang
|
||||
* @param {*} value The value to convert.
|
||||
* @returns {number} Returns the converted number.
|
||||
* @example
|
||||
*
|
||||
* _.toFinite(3.2);
|
||||
* // => 3.2
|
||||
*
|
||||
* _.toFinite(Number.MIN_VALUE);
|
||||
* // => 5e-324
|
||||
*
|
||||
* _.toFinite(Infinity);
|
||||
* // => 1.7976931348623157e+308
|
||||
*
|
||||
* _.toFinite('3.2');
|
||||
* // => 3.2
|
||||
*/
|
||||
function toFinite(value) {
|
||||
if (!value) {
|
||||
return value === 0 ? value : 0;
|
||||
}
|
||||
value = toNumber(value);
|
||||
if (value === INFINITY || value === -INFINITY) {
|
||||
var sign = (value < 0 ? -1 : 1);
|
||||
return sign * MAX_INTEGER;
|
||||
}
|
||||
return value === value ? value : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts `value` to an integer.
|
||||
*
|
||||
* **Note:** This method is loosely based on
|
||||
* [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 4.0.0
|
||||
* @category Lang
|
||||
* @param {*} value The value to convert.
|
||||
* @returns {number} Returns the converted integer.
|
||||
* @example
|
||||
*
|
||||
* _.toInteger(3.2);
|
||||
* // => 3
|
||||
*
|
||||
* _.toInteger(Number.MIN_VALUE);
|
||||
* // => 0
|
||||
*
|
||||
* _.toInteger(Infinity);
|
||||
* // => 1.7976931348623157e+308
|
||||
*
|
||||
* _.toInteger('3.2');
|
||||
* // => 3
|
||||
*/
|
||||
function toInteger(value) {
|
||||
var result = toFinite(value),
|
||||
remainder = result % 1;
|
||||
|
||||
return result === result ? (remainder ? result - remainder : result) : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts `value` to a number.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 4.0.0
|
||||
* @category Lang
|
||||
* @param {*} value The value to process.
|
||||
* @returns {number} Returns the number.
|
||||
* @example
|
||||
*
|
||||
* _.toNumber(3.2);
|
||||
* // => 3.2
|
||||
*
|
||||
* _.toNumber(Number.MIN_VALUE);
|
||||
* // => 5e-324
|
||||
*
|
||||
* _.toNumber(Infinity);
|
||||
* // => Infinity
|
||||
*
|
||||
* _.toNumber('3.2');
|
||||
* // => 3.2
|
||||
*/
|
||||
function toNumber(value) {
|
||||
if (typeof value == 'number') {
|
||||
return value;
|
||||
}
|
||||
if (isSymbol(value)) {
|
||||
return NAN;
|
||||
}
|
||||
if (isObject(value)) {
|
||||
var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
|
||||
value = isObject(other) ? (other + '') : other;
|
||||
}
|
||||
if (typeof value != 'string') {
|
||||
return value === 0 ? value : +value;
|
||||
}
|
||||
value = value.replace(reTrim, '');
|
||||
var isBinary = reIsBinary.test(value);
|
||||
return (isBinary || reIsOctal.test(value))
|
||||
? freeParseInt(value.slice(2), isBinary ? 2 : 8)
|
||||
: (reIsBadHex.test(value) ? NAN : +value);
|
||||
}
|
||||
|
||||
module.exports = isInteger;
|
69
node_modules/lodash.isinteger/package.json
generated
vendored
Normal file
69
node_modules/lodash.isinteger/package.json
generated
vendored
Normal file
@ -0,0 +1,69 @@
|
||||
{
|
||||
"_from": "lodash.isinteger@^4.0.4",
|
||||
"_id": "lodash.isinteger@4.0.4",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-YZwK89A/iwTDH1iChAt3sRzWg0M=",
|
||||
"_location": "/lodash.isinteger",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "lodash.isinteger@^4.0.4",
|
||||
"name": "lodash.isinteger",
|
||||
"escapedName": "lodash.isinteger",
|
||||
"rawSpec": "^4.0.4",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^4.0.4"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/jsonwebtoken"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz",
|
||||
"_shasum": "619c0af3d03f8b04c31f5882840b77b11cd68343",
|
||||
"_spec": "lodash.isinteger@^4.0.4",
|
||||
"_where": "/Users/josh.burman/Projects/braid/node_modules/jsonwebtoken",
|
||||
"author": {
|
||||
"name": "John-David Dalton",
|
||||
"email": "john.david.dalton@gmail.com",
|
||||
"url": "http://allyoucanleet.com/"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/lodash/lodash/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": [
|
||||
{
|
||||
"name": "John-David Dalton",
|
||||
"email": "john.david.dalton@gmail.com",
|
||||
"url": "http://allyoucanleet.com/"
|
||||
},
|
||||
{
|
||||
"name": "Blaine Bublitz",
|
||||
"email": "blaine.bublitz@gmail.com",
|
||||
"url": "https://github.com/phated"
|
||||
},
|
||||
{
|
||||
"name": "Mathias Bynens",
|
||||
"email": "mathias@qiwi.be",
|
||||
"url": "https://mathiasbynens.be/"
|
||||
}
|
||||
],
|
||||
"deprecated": false,
|
||||
"description": "The lodash method `_.isInteger` exported as a module.",
|
||||
"homepage": "https://lodash.com/",
|
||||
"icon": "https://lodash.com/icon.svg",
|
||||
"keywords": [
|
||||
"lodash-modularized",
|
||||
"isinteger"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "lodash.isinteger",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/lodash/lodash.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\""
|
||||
},
|
||||
"version": "4.0.4"
|
||||
}
|
22
node_modules/lodash.isnumber/LICENSE
generated
vendored
Normal file
22
node_modules/lodash.isnumber/LICENSE
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/>
|
||||
Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas,
|
||||
DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
|
||||
|
||||
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.
|
18
node_modules/lodash.isnumber/README.md
generated
vendored
Normal file
18
node_modules/lodash.isnumber/README.md
generated
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
# lodash.isnumber v3.0.3
|
||||
|
||||
The [lodash](https://lodash.com/) method `_.isNumber` exported as a [Node.js](https://nodejs.org/) module.
|
||||
|
||||
## Installation
|
||||
|
||||
Using npm:
|
||||
```bash
|
||||
$ {sudo -H} npm i -g npm
|
||||
$ npm i --save lodash.isnumber
|
||||
```
|
||||
|
||||
In Node.js:
|
||||
```js
|
||||
var isNumber = require('lodash.isnumber');
|
||||
```
|
||||
|
||||
See the [documentation](https://lodash.com/docs#isNumber) or [package source](https://github.com/lodash/lodash/blob/3.0.3-npm-packages/lodash.isnumber) for more details.
|
79
node_modules/lodash.isnumber/index.js
generated
vendored
Normal file
79
node_modules/lodash.isnumber/index.js
generated
vendored
Normal file
@ -0,0 +1,79 @@
|
||||
/**
|
||||
* lodash 3.0.3 (Custom Build) <https://lodash.com/>
|
||||
* Build: `lodash modularize exports="npm" -o ./`
|
||||
* Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/>
|
||||
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
||||
* Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
||||
* Available under MIT license <https://lodash.com/license>
|
||||
*/
|
||||
|
||||
/** `Object#toString` result references. */
|
||||
var numberTag = '[object Number]';
|
||||
|
||||
/** Used for built-in method references. */
|
||||
var objectProto = Object.prototype;
|
||||
|
||||
/**
|
||||
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
|
||||
* of values.
|
||||
*/
|
||||
var objectToString = objectProto.toString;
|
||||
|
||||
/**
|
||||
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
||||
* and has a `typeof` result of "object".
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Lang
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
||||
* @example
|
||||
*
|
||||
* _.isObjectLike({});
|
||||
* // => true
|
||||
*
|
||||
* _.isObjectLike([1, 2, 3]);
|
||||
* // => true
|
||||
*
|
||||
* _.isObjectLike(_.noop);
|
||||
* // => false
|
||||
*
|
||||
* _.isObjectLike(null);
|
||||
* // => false
|
||||
*/
|
||||
function isObjectLike(value) {
|
||||
return !!value && typeof value == 'object';
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if `value` is classified as a `Number` primitive or object.
|
||||
*
|
||||
* **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are classified
|
||||
* as numbers, use the `_.isFinite` method.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Lang
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
|
||||
* @example
|
||||
*
|
||||
* _.isNumber(3);
|
||||
* // => true
|
||||
*
|
||||
* _.isNumber(Number.MIN_VALUE);
|
||||
* // => true
|
||||
*
|
||||
* _.isNumber(Infinity);
|
||||
* // => true
|
||||
*
|
||||
* _.isNumber('3');
|
||||
* // => false
|
||||
*/
|
||||
function isNumber(value) {
|
||||
return typeof value == 'number' ||
|
||||
(isObjectLike(value) && objectToString.call(value) == numberTag);
|
||||
}
|
||||
|
||||
module.exports = isNumber;
|
69
node_modules/lodash.isnumber/package.json
generated
vendored
Normal file
69
node_modules/lodash.isnumber/package.json
generated
vendored
Normal file
@ -0,0 +1,69 @@
|
||||
{
|
||||
"_from": "lodash.isnumber@^3.0.3",
|
||||
"_id": "lodash.isnumber@3.0.3",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-POdoEMWSjQM1IwGsKHMX8RwLH/w=",
|
||||
"_location": "/lodash.isnumber",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "lodash.isnumber@^3.0.3",
|
||||
"name": "lodash.isnumber",
|
||||
"escapedName": "lodash.isnumber",
|
||||
"rawSpec": "^3.0.3",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^3.0.3"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/jsonwebtoken"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz",
|
||||
"_shasum": "3ce76810c5928d03352301ac287317f11c0b1ffc",
|
||||
"_spec": "lodash.isnumber@^3.0.3",
|
||||
"_where": "/Users/josh.burman/Projects/braid/node_modules/jsonwebtoken",
|
||||
"author": {
|
||||
"name": "John-David Dalton",
|
||||
"email": "john.david.dalton@gmail.com",
|
||||
"url": "http://allyoucanleet.com/"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/lodash/lodash/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": [
|
||||
{
|
||||
"name": "John-David Dalton",
|
||||
"email": "john.david.dalton@gmail.com",
|
||||
"url": "http://allyoucanleet.com/"
|
||||
},
|
||||
{
|
||||
"name": "Blaine Bublitz",
|
||||
"email": "blaine@iceddev.com",
|
||||
"url": "https://github.com/phated"
|
||||
},
|
||||
{
|
||||
"name": "Mathias Bynens",
|
||||
"email": "mathias@qiwi.be",
|
||||
"url": "https://mathiasbynens.be/"
|
||||
}
|
||||
],
|
||||
"deprecated": false,
|
||||
"description": "The lodash method `_.isNumber` exported as a module.",
|
||||
"homepage": "https://lodash.com/",
|
||||
"icon": "https://lodash.com/icon.svg",
|
||||
"keywords": [
|
||||
"lodash-modularized",
|
||||
"isnumber"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "lodash.isnumber",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/lodash/lodash.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\""
|
||||
},
|
||||
"version": "3.0.3"
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user