diff --git a/backend/src/common/services/token/token.services.ts b/backend/src/common/services/token/token.services.ts index 408bc05aa..035f01f6f 100644 --- a/backend/src/common/services/token/token.services.ts +++ b/backend/src/common/services/token/token.services.ts @@ -2,20 +2,20 @@ import { type JWTPayload as TokenPayload } from 'jose'; import { jwtVerify, SignJWT } from 'jose'; class TokenService { - private SECRET_KEY: Uint8Array; - private EXPIRATION_TIME: string; + private SECRET_KEY: Uint8Array; + private EXPIRATION_TIME: string; - public constructor(secretKey: string, expirationTime: string) { - this.SECRET_KEY = new TextEncoder().encode(secretKey); - this.EXPIRATION_TIME = expirationTime; - } + public constructor(secretKey: string, expirationTime: string) { + this.SECRET_KEY = new TextEncoder().encode(secretKey); + this.EXPIRATION_TIME = expirationTime; + } public async createToken(userId: number): Promise { - return await new SignJWT({ userId }) - .setProtectedHeader({ alg: 'HS256' }) - .setExpirationTime(this.EXPIRATION_TIME) - .sign(this.SECRET_KEY); - } + return await new SignJWT({ userId }) + .setProtectedHeader({ alg: 'HS256' }) + .setExpirationTime(this.EXPIRATION_TIME) + .sign(this.SECRET_KEY); + } public async verifyToken(token: string): Promise { try {