mirror of
https://github.com/spacebarchat/server.git
synced 2024-11-10 12:42:44 +01:00
20 lines
820 B
JavaScript
20 lines
820 B
JavaScript
"use strict";
|
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
};
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.checkToken = void 0;
|
|
const Constants_1 = require("./Constants");
|
|
const jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));
|
|
const Config_1 = __importDefault(require("./Config"));
|
|
function checkToken(token) {
|
|
return new Promise((res, rej) => {
|
|
jsonwebtoken_1.default.verify(token, Config_1.default.getAll().api.security.jwtSecret, Constants_1.JWTOptions, (err, decoded) => {
|
|
if (err || !decoded)
|
|
return rej("Invalid Token");
|
|
return res(decoded);
|
|
});
|
|
});
|
|
}
|
|
exports.checkToken = checkToken;
|
|
//# sourceMappingURL=checkToken.js.map
|