import { OAuthProviders } from "@turnkey/sdk-types";
/**
 * Builds the OAuth state parameter string
 */
export declare function buildOAuthState(params: {
    provider: OAuthProviders;
    flow: "redirect" | "popup";
    publicKey: string;
    nonce?: string;
    additionalState?: Record<string, string> | undefined;
}): string;
/**
 * Opens a centered OAuth popup window
 */
export declare function openOAuthPopup(): Window | null;
/**
 * Redirects to OAuth provider URL
 */
export declare function redirectToOAuthProvider(url: string): Promise<never>;
/**
 * Cleans up OAuth parameters from URL (removes hash and search)
 */
export declare function cleanupOAuthUrl(): void;
/**
 * Cleans up OAuth hash from URL but preserves search parameters
 */
export declare function cleanupOAuthUrlPreserveSearch(): void;
/**
 * Parses the OAuth state parameter string into an object
 */
export declare function parseStateParam(stateParam: string | null | undefined): {
    sessionKey?: string;
    oauthIntent?: string;
    provider?: string;
    flow?: string;
    publicKey?: string;
    openModal?: string;
    [key: string]: string | undefined;
};
/**
 * Result from parsing an OAuth response (both popup and redirect flows)
 */
export interface OAuthResponseResult {
    /** The OIDC token (for non-PKCE providers) */
    idToken?: string | null | undefined;
    /** The authorization code (for PKCE providers) */
    authCode?: string | null | undefined;
    /** Session key from state */
    sessionKey?: string | undefined;
    /** The provider from state */
    provider?: string | null;
    /** Flow type from state */
    flow?: string | null;
    /** Public key from state */
    publicKey?: string | null;
    /** Open modal flag from state */
    openModal?: string | null;
    /** OAuth intent from state */
    oauthIntent?: string | null;
    /** Nonce from state */
    nonce?: string | null;
}
/**
 * Unified OAuth response parser for both popup and redirect flows.
 * Handles both:
 * - PKCE flows (Facebook, Discord, X): code in search parameters
 * - Non-PKCE flows (Google, Apple): id_token in hash parameters
 * - Apple's non-standard hash format where state parameters are directly embedded
 *
 * @param url - The full URL to parse (from popup or redirect)
 * @param expectedProvider - Optional provider if already known (for popup flows)
 * @returns Parsed OAuth response data including tokens, codes, and state parameters, or null if invalid
 */
export declare function parseOAuthResponse(url: string, expectedProvider?: OAuthProviders): OAuthResponseResult | null;
/**
 * Parameters for building an OAuth URL
 */
export interface BuildOAuthUrlParams {
    provider: OAuthProviders;
    clientId: string;
    redirectUri: string;
    publicKey: string;
    nonce: string;
    flow: "redirect" | "popup";
    codeChallenge?: string | undefined;
    additionalState?: Record<string, string> | undefined;
}
/**
 * Builds the complete OAuth authorization URL for a provider
 */
export declare function buildOAuthUrl(params: BuildOAuthUrlParams): string;
//# sourceMappingURL=url.d.ts.map