import { A as AuthgearConfig, S as Session, U as UserInfo, P as Page, J as JWTPayload } from './types-D6m4Hact.js'; export { a as PromptOption, c as SessionState } from './types-D6m4Hact.js'; /** * Read the current session in a Server Component, Route Handler, or Server Action. * Automatically refreshes the access token if expired, so `session.accessToken` is * always valid when the session state is `Authenticated`. Use this when you need a * fresh access token to call a downstream API (e.g. inside a Server Action). */ declare function auth(config: AuthgearConfig): Promise; /** * Get the current user in a Server Component or Route Handler. * Automatically refreshes the access token if expired, including persisting a * rotated refresh token when the Authgear project has refresh token rotation enabled. * Returns null if not authenticated or if the session cannot be refreshed. */ declare function currentUser(config: AuthgearConfig): Promise; /** * Verify a JWT access token (from Authorization: Bearer header). * Useful for protecting API routes. * * @throws {Error} If the token is invalid, expired, or has wrong issuer/audience */ declare function verifyAccessToken(token: string, config: AuthgearConfig): Promise; /** * Get a URL that opens an Authgear page (e.g. `/settings`) with the current * user already authenticated — no re-login required. * * Exchanges the user's refresh token for a short-lived `app_session_token` * via `POST /oauth2/app_session_token`, then builds an authorization URL * that uses that token as a `login_hint` so Authgear can authenticate the * user silently. * * @param page - A `Page` enum value (e.g. `Page.Settings`) or an arbitrary path string. * @param config - The Authgear SDK config. * @returns A URL string. Open it in a new tab (`window.open(url, "_blank")`). * @throws {Error} If the user is not authenticated or has no refresh token. * * @example * ```ts * // Server Action * "use server"; * import { getOpenURL, Page } from "@authgear/nextjs/server"; * import { authgearConfig } from "@/lib/authgear"; * * export async function getSettingsURLAction() { * return getOpenURL(Page.Settings, authgearConfig); * } * ``` */ declare function getOpenURL(page: Page | string, config: AuthgearConfig): Promise; export { JWTPayload, Page, Session, UserInfo, auth, currentUser, getOpenURL, verifyAccessToken };