mirror of
https://github.com/spacebarchat/server.git
synced 2026-10-23 04:22:47 +00:00
perf: cache jwt secret as key
This commit is contained in:
1 parent
5b6b97e86c
commit
810f5dd84c
3 files changed
+21
-7
No files matched your search
@@ -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) => {
|
||||
|
||||
Reference in new issue
Block a user