import { type ClassValue, clsx } from "clsx" import { twMerge } from "tailwind-merge" export function cn(...inputs: ClassValue[]) { return twMerge(clsx(inputs)) } export async function hashPassword(password: string): Promise { const encoder = new TextEncoder() const salt = process.env.AUTH_SECRET || '' const data = encoder.encode(password + salt) const hash = await crypto.subtle.digest('SHA-256', data) return btoa(String.fromCharCode(...new Uint8Array(hash))) } export async function comparePassword(password: string, hashedPassword: string): Promise { const hash = await hashPassword(password) return hash === hashedPassword }