import { prisma } from "./prisma"; import bcrypt from "bcryptjs"; export async function hashPassword(password: string): Promise { return bcrypt.hash(password, 12); } export async function verifyPassword(password: string, hashed: string): Promise { return bcrypt.compare(password, hashed); } export function requireRole(user: { role: string }, ...allowed: string[]) { if (!allowed.includes(user.role)) { throw new Error("Forbidden"); } }