Commit 0e74c4fe by Percy Quispe Huarcaya

feat: Adding token creator and a parser

parent 7f82cfaf
declare module 'util/token' {
export function createJWT(id: string, subject: object, time?: number): string;
export function parseJWT(token: string, id?: string): string; // Adjust the signature if needed
}
\ No newline at end of file
const jwt = require('jsonwebtoken'); const jwt = require('jsonwebtoken');
const { getDefaultPath } = require('./util/osutils') const { getDefaultPath } = require('./osutils')
require('dotenv').config({path: getDefaultPath('global') + "/.env"}); require('dotenv').config({path: getDefaultPath('global') + "/.env"});
......
const {createJWT, parseJWT} = require('../src/token'); const {createJWT, parseJWT} = require('../src/util/token');
describe('Token', () => { describe('Token', () => {
test('should generate and validate a token sending duration time', () => { test('should generate and validate a token sending duration time', () => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment