sign

https://github.com/panva/jose/blob/main/docs/classes/jwt_sign.SignJWT.md

import { SignJWT } from "jose";

async sign(payload: Record<string, string>, options?: { expire: string }) {
  return await new SignJWT(payload)
    .setProtectedHeader({ alg: "HS256" })
    .setExpirationTime(options?.expire ?? "30d")
    .sign(this.secret);
}

verify

https://github.com/panva/jose/blob/main/docs/functions/jwt_verify.jwtVerify.md

import { jwtVerify } from "jose";

async verify(token: string) {
  return await jwtVerify(token, this.secret);
}