import { cookies } from "next/headers";

/**
 * Sanctum Bearer token, stored httpOnly by the /api/auth/* route handlers
 * (never touched by client-side JS) — see AGENTS.md guidance on Next 16
 * authentication patterns (backend-for-frontend + httpOnly cookie).
 */
export const TOKEN_COOKIE = "kolabora_token";

export async function getToken(): Promise<string | undefined> {
  const store = await cookies();
  return store.get(TOKEN_COOKIE)?.value;
}
