mirror of
https://github.com/khairul169/home-lab.git
synced 2025-04-28 08:39:34 +07:00
15 lines
380 B
TypeScript
15 lines
380 B
TypeScript
import * as jwt from "hono/jwt";
|
|
|
|
const JWT_SECRET =
|
|
process.env.JWT_SECRET || "75396f4ba17e0012d4511b8d4a5bae11c51008a3";
|
|
|
|
export const generateToken = async (data: any) => {
|
|
return jwt.sign(data, JWT_SECRET);
|
|
};
|
|
|
|
export const verifyToken = async (token: string) => {
|
|
return jwt.verify(token, JWT_SECRET);
|
|
};
|
|
|
|
export const authMiddleware = jwt.jwt({ secret: JWT_SECRET });
|