2 files changed, 14 insertions, 1 deletions
diff --git a/src/util/checkToken.ts b/src/util/checkToken.ts
index 96c7806a..b4635126 100644
--- a/src/util/checkToken.ts
+++ b/src/util/checkToken.ts
@@ -2,7 +2,7 @@ import { JWTOptions } from "./Constants";
import jwt from "jsonwebtoken";
import Config from "./Config";
-export function checkToken(token: string) {
+export function checkToken(token: string): Promise<any> {
return new Promise((res, rej) => {
jwt.verify(token, Config.getAll().api.security.jwtSecret, JWTOptions, (err, decoded: any) => {
if (err || !decoded) return rej("Invalid Token");
diff --git a/src/util/convertBigIntToString.ts b/src/util/convertBigIntToString.ts
new file mode 100644
index 00000000..2c8d9a38
--- /dev/null
+++ b/src/util/convertBigIntToString.ts
@@ -0,0 +1,13 @@
+import "missing-native-js-functions";
+
+export function convertBigIntToString(obj: any) {
+ if (typeof obj === "bigint") obj = obj.toString();
+
+ if (typeof obj === "object") {
+ obj.keys().forEach((key: string) => {
+ obj[key] = convertBigIntToString(obj[key]);
+ });
+ }
+
+ return obj;
+}
|