diff --git a/src/app/api/auth/register/route.ts b/src/app/api/auth/register/route.ts index b09bcb7..7963053 100644 --- a/src/app/api/auth/register/route.ts +++ b/src/app/api/auth/register/route.ts @@ -1,5 +1,4 @@ import { NextRequest, NextResponse } from 'next/server'; -import { hash } from 'bcryptjs'; // Temporary in-memory user storage (replace with database) const users: Map = new Map(); @@ -31,8 +30,8 @@ export async function POST(request: NextRequest) { ); } - // Hash password - const hashedPassword = await hash(password, 10); + // Hash password using simple hash (not production-ready) + const hashedPassword = await hashPassword(password); // Create user const user = { @@ -67,3 +66,12 @@ export async function POST(request: NextRequest) { ); } } + +// Simple hash function (not secure - for development only) +async function hashPassword(password: string): Promise { + const encoder = new TextEncoder(); + const data = encoder.encode(password); + const hashBuffer = await crypto.subtle.digest('SHA-256', data); + const hashArray = Array.from(new Uint8Array(hashBuffer)); + return hashArray.map(b => b.toString(16).padStart(2, '0')).join(''); +}