express-jwt-blacklist
Version:
express-jwt plugin for token blacklisting
20 lines (14 loc) • 551 B
JavaScript
;
var debug = require('./debug').log;
exports.optionalCallback = function(err) {
if (err) debug('optionalCallback:', err);
}
exports.checkString = function(val, key) {
if (typeof val !== 'string' || val.length < 1) throw new Error('Invalid configuration [' + key + '] should be String');
}
exports.checkBoolean = function(val, key) {
if (typeof val !== 'boolean') throw new Error('Invalid configuration [' + key + '] should be Boolean');
}
exports.nowInSeconds = function() {
return Math.floor(new Date().getTime() / 1000);
}