MCPcopy Index your code
hub / github.com/TomDoesTech/REST-API-Tutorial-Updated / signJwt

Function signJwt

src/utils/jwt.utils.ts:4–18  ·  view source on GitHub ↗
(
  object: Object,
  keyName: "accessTokenPrivateKey" | "refreshTokenPrivateKey",
  options?: jwt.SignOptions | undefined
)

Source from the content-addressed store, hash-verified

2import config from "config";
3
4export function signJwt(
5 object: Object,
6 keyName: "accessTokenPrivateKey" | "refreshTokenPrivateKey",
7 options?: jwt.SignOptions | undefined
8) {
9 const signingKey = Buffer.from(
10 config.get<string>(keyName),
11 "base64"
12 ).toString("ascii");
13
14 return jwt.sign(object, signingKey, {
15 ...(options && options),
16 algorithm: "RS256",
17 });
18}
19
20export function verifyJwt(
21 token: string,

Callers 2

createUserSessionHandlerFunction · 0.90
reIssueAccessTokenFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected