Merge branch 'fosscord:master' into master

This commit is contained in:
Diego Magdaleno
2021-05-22 22:21:25 -05:00
4 changed files with 5 additions and 6 deletions
BIN
View File
Binary file not shown.
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@fosscord/server-util",
"version": "1.2.7",
"version": "1.2.8",
"description": "Utility functions for the all server repositories",
"main": "dist/index.js",
"types": "dist/index.d.ts",
+2 -2
View File
@@ -4,7 +4,7 @@ export * as Constants from "./util/Constants";
export * from "./models/index";
export * from "./util/index";
import Config, { DefaultOptions } from "./util/Config";
import Config from "./util/Config";
import db, { MongooseCache, toObject } from "./util/Database";
export { Config, db, DefaultOptions, MongooseCache, toObject };
export { Config, db, MongooseCache, toObject };
+2 -3
View File
@@ -1,10 +1,9 @@
import { JWTOptions } from "./Constants";
import jwt from "jsonwebtoken";
import Config from "./Config";
export function checkToken(token: string): Promise<any> {
export function checkToken(token: string, jwtSecret: string): Promise<any> {
return new Promise((res, rej) => {
jwt.verify(token, Config.getAll()?.api?.security?.jwtSecret, JWTOptions, (err, decoded: any) => {
jwt.verify(token, jwtSecret, JWTOptions, (err, decoded: any) => {
if (err || !decoded) return rej("Invalid Token");
return res(decoded);