Files added to repository

This commit is contained in:
2023-06-18 20:46:04 +02:00
commit bf9b20499b
17 changed files with 665 additions and 0 deletions

3
config/config.js Executable file
View File

@@ -0,0 +1,3 @@
module.exports = {
TOKEN_SECRET: process.env.TOKEN_SECRET || "Master2023" //Clave para codificar token
};

13
config/services.js Executable file
View 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');
};