test: add keys folder

This commit is contained in:
mahyargdz
2025-03-15 14:25:52 +03:30
parent 146c38025a
commit cb9860853e
8 changed files with 123 additions and 17 deletions
+5 -1
View File
@@ -1,3 +1,5 @@
import { readFileSync } from "fs";
import { Injectable } from "@nestjs/common";
import { ConfigService } from "@nestjs/config";
import { PassportStrategy } from "@nestjs/passport";
@@ -12,7 +14,9 @@ export class JwtStrategy extends PassportStrategy(Strategy, JWT_STRATEGY_NAME) {
super({
jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(),
ignoreExpiration: false,
secretOrKey: configService.getOrThrow<string>("JWT_SECRET_KEY"),
secretOrKey: readFileSync(`${process.cwd()}/keys/public.pem`, "utf8"),
algorithms: ["RS256"],
issuer: configService.getOrThrow<string>("JWT_ISSUER"),
});
}