import type { AuthProvider, User } from '@bounded-sh/core'; type RegistrySync = (provider: AuthProvider | null, method: string | null, configKey: string | null) => void; export declare function registerAuthRegistrySync(fn: RegistrySync): void; /** * Atomically commit `provider` as the owner of the active session. The single await * happens BEFORE any state is touched; every write below it runs in one synchronous * block, so no listener or concurrent caller can ever observe a mixed identity * (e.g. the new provider with the old user, or the new user on the old signer). * * Pass `user` to publish the session's user inside the same block (listeners fire * after every pointer already agrees). Omit it when the caller manages the user * separately (e.g. a path that publishes the user only after further checks). */ export declare function adoptSessionProvider(opts: { provider: AuthProvider; /** Canonical auth method string ('email', 'phantom', 'guest', ...). */ method: string; /** Registry key gating provider reuse in getAuthProvider(); use a 'direct:*' * marker for singleton providers that are not rebuilt from config. */ configKey: string; user?: User | null; }): Promise; /** * REPAIR, not establishment: rebuild the provider pointers from the init config * after a prior logout nulled them, so `login()` / `logout()` can dispatch again. * * Deliberately does NOT write the stored auth-method marker, and that omission is * load-bearing rather than an oversight: logout()'s self-heal runs BEFORE it reads * `getIssuerSessionKind()`, and setStoredAuthMethod clears that kind marker for any * non-email method - so stamping a marker here would erase the evidence that the * session being logged out was hosted and silently skip the issuer-cookie bounce. * No session is being established here; the marker already describes the live one. */ export declare function adoptRebuiltProvider(provider: AuthProvider, method: string | null): Promise; /** * The logout-side mirror: clear every pointer a session adoption sets, so a later * login cannot inherit a dead signer. Deliberately LEAVES the global * authProviderInstance in place - global.ts's login()/logout() wrappers treat a null * instance as "not initialized" and would throw at the user after a legitimate * logout; auth/index.ts's own self-heal branches rebuild the registry from * initConfig on the next call either way. */ export declare function clearSessionProviderForLogout(): Promise; export {};