import jwt from "jsonwebtoken";
import { env } from "../config/env.js";

export function signAccessToken(user) {
  return jwt.sign({ sub: user._id, role: user.role }, env.jwtSecret, { expiresIn: "15m" });
}

export function signRefreshToken(user) {
  return jwt.sign({ sub: user._id }, env.jwtRefreshSecret, { expiresIn: "30d" });
}
