14 lines
344 B
JavaScript
Executable File
14 lines
344 B
JavaScript
Executable File
const jwt = require('jwt-simple');
|
|
const moment = require('moment');
|
|
const config = require('./config');
|
|
|
|
exports.createToken = function(user, TFA) {
|
|
var payload = {
|
|
sub: user,
|
|
TFA: TFA,
|
|
iat: moment().unix(),
|
|
exp: moment().add(5, 'm').unix(), //5 minutillos
|
|
};
|
|
return jwt.encode(payload, config.TOKEN_SECRET, 'HS512');
|
|
};
|