// src/utils/authUtils.ts

export interface AuthResponse {
    token?: string;
    message?: string;
    error?: string;
}

/**
 * Bezpieczne haszowanie SHA-512
 */
export async function sha512(message: string): Promise<string> {
    const msgUint8 = new TextEncoder().encode(message);
    const hashBuffer = await crypto.subtle.digest('SHA-512', msgUint8);
    const hashArray = Array.from(new Uint8Array(hashBuffer));
    return hashArray.map(b => b.toString(16).padStart(2, '0')).join('');
}