diff --git a/src/utils/auth.ts b/src/utils/auth.ts index f016f4a..13d5ad6 100644 --- a/src/utils/auth.ts +++ b/src/utils/auth.ts @@ -1,5 +1,5 @@ import { create, verify, getNumericDate } from "https://deno.land/x/djwt@v3.0.1/mod.ts"; -import { hash, verify as verifyHash } from "https://deno.land/x/argon2@v0.9.2/mod.ts"; +import * as bcrypt from "https://deno.land/x/bcrypt@v0.4.1/mod.ts"; import type { JWTPayload, UserRole } from "../types/index.ts"; const JWT_SECRET = Deno.env.get("JWT_SECRET") || "secu-super-secret-key-change-in-production"; @@ -66,15 +66,15 @@ export async function verifyToken(token: string): Promise { } } -// Hash password with Argon2 +// Hash password with bcrypt export async function hashPassword(password: string): Promise { - return await hash(password); + return await bcrypt.hash(password); } // Verify password export async function verifyPassword(password: string, hashedPassword: string): Promise { try { - return await verifyHash(password, hashedPassword); + return await bcrypt.compare(password, hashedPassword); } catch { return false; }