Files added to repository
This commit is contained in:
3
config/config.js
Executable file
3
config/config.js
Executable file
@@ -0,0 +1,3 @@
|
||||
module.exports = {
|
||||
TOKEN_SECRET: process.env.TOKEN_SECRET || "Master2023" //Clave para codificar token
|
||||
};
|
13
config/services.js
Executable file
13
config/services.js
Executable file
@@ -0,0 +1,13 @@
|
||||
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');
|
||||
};
|
Reference in New Issue
Block a user