/**
 * Sigma Identity — OAuth flow + CWI wallet connection.
 *
 * The full flow: initiateSigmaOAuth() redirects to Sigma Identity →
 * user authenticates → redirect back → completeSigmaOAuth() exchanges
 * code → connectSigmaWallet() opens CWI iframe with the authenticated
 * identity. After that, the wallet is a standard WalletInterface.
 */
import { type SigmaSignInOptions, sigmaClient } from '@sigma-auth/better-auth-plugin/client';
import type { ConnectWalletResult, WalletProviderConfig } from './connectWallet';
export declare const SIGMA_URL = "https://auth.sigmaidentity.com";
export interface SigmaOAuthConfig {
    clientId: string;
    callbackURL?: string;
}
export interface SigmaOAuthResult {
    bapId: string;
    pubkey: string;
    user: Record<string, unknown>;
    accessToken: string;
}
export interface SigmaProviderConfig extends WalletProviderConfig {
    type: 'sigma';
    clientId: string;
    callbackURL?: string;
}
type SigmaPluginActions = ReturnType<ReturnType<typeof sigmaClient>['getActions']>;
type SigmaAugmentedClient = {
    sigma: SigmaPluginActions['sigma'];
    signIn: {
        sigma: SigmaPluginActions['signIn']['sigma'];
    };
};
declare const baseAuthClient: import("better-auth/client").AuthClient<{
    baseURL: string;
    plugins: import("better-auth").BetterAuthClientPlugin[];
}>;
export declare const sigmaAuthClient: typeof baseAuthClient & SigmaAugmentedClient;
/**
 * Redirect to Sigma Identity authorize endpoint.
 * Handles PKCE, sessionStorage, wallet-check gate.
 * Returns a never-resolving Promise since the page navigates away.
 */
export declare function initiateSigmaOAuth(config: SigmaOAuthConfig, options?: Omit<SigmaSignInOptions, 'clientId' | 'callbackURL'>): Promise<never>;
/**
 * Complete the OAuth callback. Verifies state, exchanges code,
 * returns user data with bapId and pubkey.
 */
export declare function completeSigmaOAuth(searchParams: URLSearchParams): Promise<SigmaOAuthResult>;
export declare function setSigmaIdentity(bapId: string): void;
/**
 * Connect to a Sigma wallet via CWI iframe.
 * Call after completing OAuth — sets the identity and waits for
 * the iframe to authenticate. Returns a standard ConnectWalletResult.
 */
export declare function connectSigmaWallet(bapId: string): Promise<ConnectWalletResult>;
/**
 * Return the persisted Sigma identity (bapId) from a prior login, or null.
 * Pure storage read — no network, no redirect.
 */
export declare function getStoredSigmaBapId(): string | null;
/**
 * Restore a Sigma wallet session non-interactively from the persisted bapId.
 *
 * Use this for auto-reconnect: it re-opens the CWI iframe for an
 * already-authenticated identity WITHOUT triggering a new OAuth redirect.
 * Returns null when there is no stored identity to restore — callers should
 * stay disconnected in that case rather than forcing a redirect (redirecting
 * to "reconnect" rewrites the PKCE state on every load and causes an infinite
 * auth loop).
 */
export declare function reconnectSigmaWallet(): Promise<ConnectWalletResult | null>;
export {};
//# sourceMappingURL=sigma-oauth.d.ts.map