🔧 Fix: bcrypt statt argon2 (kompatibel)

This commit is contained in:
2026-03-12 16:09:34 +00:00
parent 256b8e20a5
commit 0be17882d5

View File

@@ -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<JWTPayload | null> {
}
}
// Hash password with Argon2
// Hash password with bcrypt
export async function hashPassword(password: string): Promise<string> {
return await hash(password);
return await bcrypt.hash(password);
}
// Verify password
export async function verifyPassword(password: string, hashedPassword: string): Promise<boolean> {
try {
return await verifyHash(password, hashedPassword);
return await bcrypt.compare(password, hashedPassword);
} catch {
return false;
}