import { headers } from "next/headers";

/**
 * Read the CSP nonce generated in middleware.
 * Falls back to empty string when unavailable (e.g., static export).
 */
export function getCspNonce(): string {
  const headerList = headers();
  return headerList.get("x-csp-nonce") || headerList.get("x-nonce") || "";
}
