import { ConvexError } from "convex/values" /** * True when a gated Convex action rejected the request because the server saw no * valid identity (see `convex/authGuard.ts`). The browser trusts a token only by * its `exp` claim — it never verifies the signature — so a stale-but-unexpired * token reads as "signed in" locally while Convex rejects it. Callers use this to * clear the dead session and re-prompt login instead of surfacing a raw error. */ export function isUnauthenticatedError(e: unknown): boolean { return ( e instanceof ConvexError && typeof e.data === "object" && e.data !== null && (e.data as { kind?: unknown }).kind === "unauthenticated" ) }