summary refs log tree commit diff
path: root/src/util
diff options
context:
space:
mode:
authorSamuel <34555296+Flam3rboy@users.noreply.github.com>2023-03-17 17:47:43 +0100
committerSamuel <34555296+Flam3rboy@users.noreply.github.com>2023-03-17 17:47:43 +0100
commit810f5dd84cab8249f90276ce3acde5ffe6938c8d (patch)
treed3937ad69408a3e4e924f6d52dc38a43db7a6ffb /src/util
parentfix: types when using yarn (diff)
downloadserver-810f5dd84cab8249f90276ce3acde5ffe6938c8d.tar.xz
perf: cache jwt secret as key
Diffstat (limited to 'src/util')
-rw-r--r--src/util/util/Token.ts3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/util/util/Token.ts b/src/util/util/Token.ts
index ffc442aa..67e4b879 100644
--- a/src/util/util/Token.ts
+++ b/src/util/util/Token.ts
@@ -19,6 +19,7 @@
 import jwt, { VerifyOptions } from "jsonwebtoken";
 import { Config } from "./Config";
 import { User } from "../entities";
+import { KeyObject } from "crypto";
 
 export const JWTOptions: VerifyOptions = { algorithms: ["HS256"] };
 
@@ -62,7 +63,7 @@ async function checkEmailToken(
 
 export function checkToken(
 	token: string,
-	jwtSecret: string,
+	jwtSecret: string | KeyObject,
 	isEmailVerification = false,
 ): Promise<UserTokenData> {
 	return new Promise((res, rej) => {