( object: Object, keyName: "accessTokenPrivateKey" | "refreshTokenPrivateKey", options?: jwt.SignOptions | undefined )
| 2 | import config from "config"; |
| 3 | |
| 4 | export 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 | |
| 20 | export function verifyJwt( |
| 21 | token: string, |
no outgoing calls
no test coverage detected