/** * UAE Pass Authentication Hook * * React hook for UAE Pass authentication with WebView support */ import type { UAEPassAuthResult, UAEPassWebViewAuthParams } from '../types'; export interface UseUAEPassAuthOptions { onSuccess?: (result: UAEPassAuthResult) => void; onError?: (error: string) => void; onCancel?: () => void; } export interface UseUAEPassAuthReturn { /** * Start UAE Pass authentication * Returns auth result with authorization code if successful */ authenticate: () => Promise; /** * Check if UAE Pass app is installed */ checkAppInstalled: () => Promise; /** * Exchange authorization code for tokens * Requires clientSecret (should be done on backend for security) */ exchangeCode: (params: { code: string; codeVerifier?: string; clientSecret?: string; }) => Promise; /** * Prepare auth params for WebView component * Use this when UAE Pass app IS installed */ prepareForWebView: () => Promise; /** * Loading state */ isLoading: boolean; /** * Current auth result */ authResult: UAEPassAuthResult | null; /** * Reset auth state */ reset: () => void; } /** * Hook for UAE Pass authentication * * @param options - Callback options for success, error, and cancel * @returns Authentication methods and state * * @example * ```typescript * const { authenticate, isLoading } = useUAEPassAuth({ * onSuccess: (result) => { * console.log('Auth code:', result.authorizationCode); * }, * onError: (error) => { * console.error('Error:', error); * }, * }); * ``` */ export declare const useUAEPassAuth: (options?: UseUAEPassAuthOptions) => UseUAEPassAuthReturn; export default useUAEPassAuth;