Compare commits

..

No commits in common. "80dff138cc3e14ff6657ebb3cf05c70aaf568575" and "3231f916f816f435ebd530d43eba989a22e1bbe1" have entirely different histories.

2 changed files with 3 additions and 4 deletions

1
.gitignore vendored
View File

@ -1,4 +1,3 @@
node_modules
pnpm-lock.yaml
.env
dist

View File

@ -1,4 +1,4 @@
import {type JWTHeaderParameters, type JWTPayload, jwtVerify, SignJWT} from "jose";
import Jose, {type JWTHeaderParameters, type JWTPayload} from "jose";
import {Logger} from "tslog";
const logger = new Logger({ name: "JwtService" });
@ -13,7 +13,7 @@ const logger = new Logger({ name: "JwtService" });
*/
async function JwtVerifyService(jwt: string | Uint8Array): Promise<null | JWTPayload> {
try {
const result = await jwtVerify(
const result = await Jose.jwtVerify(
jwt,
new TextEncoder()
.encode(`${process.env["JWT_SECRET"]}`),
@ -43,7 +43,7 @@ async function JwtVerifyService(jwt: string | Uint8Array): Promise<null | JWTPay
* - A promise that resolves with the signed JWT token.
*/
async function JwtSignService(payload: JWTPayload, pHeader: JWTHeaderParameters, expTime: string | number | Date, audience: string | string[]): Promise<string> {
return await new SignJWT(payload)
return await new Jose.SignJWT(payload)
.setProtectedHeader(pHeader)
.setIssuedAt(new Date())
.setIssuer(`${process.env["JWT_SECRET"]} - Mathis HERRIOT`)