Spaces:
Sleeping
Sleeping
Download backend/src/utils/jwt.ts from cuteepeiarchu/PathFinders: direct link, hf CLI and curl.
- Browser
- Download file 332 Bytes
-
https://huggingface.co/spaces/cuteepeiarchu/PathFinders/resolve/main/backend/src/utils/jwt.ts
- Command line
-
hf download hf://spaces/cuteepeiarchu/PathFinders/backend/src/utils/jwt.ts
-
curl -L -o jwt.ts https://huggingface.co/spaces/cuteepeiarchu/PathFinders/resolve/main/backend/src/utils/jwt.ts
332 Bytes
| import jwt from "jsonwebtoken"; | |
| import { env } from "../config/env"; | |
| export const signToken = (userId: string) => | |
| jwt.sign({ sub: userId }, env.jwtSecret, { | |
| expiresIn: env.jwtExpiresIn as jwt.SignOptions["expiresIn"], | |
| }); | |
| export const verifyToken = (token: string) => | |
| jwt.verify(token, env.jwtSecret) as jwt.JwtPayload; | |