UNPKG

outers

Version:

outers - a all in one package for your day to day use

42 lines 1.55 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const JWT_Constant_1 = require("../../Config/Constant/JWT.Constant"); // Importing todayDate from JWT.Constant // Main function function verifyCipher(token, cipherList) { try { // Checking if the token is destroyed by manually checking the token let cipherResult = false; // Cipher result cipherList.forEach((cipher) => { if (token.includes(cipher)) { cipherResult = true; } else { cipherResult = false; } }); // Check if the token contains the cipher if (!cipherResult) { return { status: "Not Destroyed", message: "Token is not Destroyed Manually", currentTimeStamp: JWT_Constant_1.todayDate, algoRithm: "HS256 (Default)", }; // Create an error object } return { status: "Already Destroyed", message: "Token is Destroyed Manually with the destroy() method", currentTimeStamp: JWT_Constant_1.todayDate, algoRithm: "HS256 (Default)", }; // Create an error object } catch (_a) { return { status: "error", message: "Error verifying token", currentTimeStamp: JWT_Constant_1.todayDate, algoRithm: "HS256 (Default)", }; // Create an error object } } exports.default = verifyCipher; //# sourceMappingURL=verifyCipher.js.map