import * as react from 'react'; import { ReactNode } from 'react'; import { U as UserIdentity, A as AuthState, a as AuthTransport } from '../types-BtGh9nA0.js'; interface AuthContextValue { /** The signed-in person, or null when not authenticated. */ user: UserIdentity | null; /** The full state. Prefer this over `user` when the distinction matters. */ state: AuthState; /** * True until the first identity check completes. Distinct from being signed * out -- rendering the signed-out view in this window is the flash ADR-057 * names. */ loading: boolean; /** * Whether the tenant-local user id is known. Being authenticated is not * sufficient: anything keyed on ownership waits for this rather than sending * null. */ ready: boolean; refresh: () => Promise; login: () => void; logout: () => void; } interface AuthProviderProps { children?: ReactNode; /** * How the identity endpoint is reached. Same-origin cookie by default. * * Create the transport once (a module-level constant) and pass that same * object everywhere. An inline object is a new transport on every render, * and React StrictMode and hot reload render twice. */ transport?: AuthTransport; /** * A fixed identity for LOCAL DEVELOPMENT, used instead of the network. * * The application decides when to pass it, behind its own build-time gate -- * in a Vite app, `import.meta.env.DEV` AND an explicit flag AND a local * hostname, so a production bundle cannot carry the path. A library cannot * read a bundler's build flags, which is why this is a prop and not a check. */ devIdentity?: UserIdentity; /** * Where to send the browser to sign in again, and after signing out. The * gateway's OIDC policy redirects any unauthenticated request to the identity * provider, so the application root is enough: the client neither knows nor * duplicates the login flow. Defaults to "/". */ signInPath?: string; /** How the browser is sent there. Defaults to assigning location. */ navigate?: (path: string) => void; } /** * Context provider for client authentication state. * * The provider and plain-function helpers (such as `reportUnauthorized`) share * one client instance via `sharedAuthClient(transport)`. */ declare function AuthProvider({ children, transport, devIdentity, signInPath, navigate, }: AuthProviderProps): react.FunctionComponentElement>; declare function useAuth(): AuthContextValue; /** * The tenant this session acts within. * * The validated identity is the only source (ADR-057). No query parameter, no * stored value, no fallback: no identity means no tenant, and a second source * for a single-authority value is how an interface comes to present one tenant * while acting in another. */ declare function useTenantId(): string; export { type AuthContextValue, AuthProvider, type AuthProviderProps, AuthState, UserIdentity, useAuth, useTenantId };