import type { OAuthProvider, User } from '@openfort/openfort-js'; import { type OpenfortError } from '../../../errors/base.js'; import type { OpenfortHookOptions } from '../../../types.js'; import type { EthereumUserWallet, SolanaUserWallet } from '../walletTypes.js'; import { type CreateWalletPostAuthOptions } from './useConnectToWalletPostAuth.js'; type InitializeOAuthOptions = { provider: OAuthProvider; redirectTo?: string; } & OpenfortHookOptions; type InitOAuthReturnType = { error?: OpenfortError; }; export type StoreCredentialsResult = { user?: User; wallet?: EthereumUserWallet | SolanaUserWallet; error?: OpenfortError; }; type StoreCredentialsOptions = { userId: string; token: string; } & OpenfortHookOptions & CreateWalletPostAuthOptions; type AuthHookOptions = { redirectTo?: string; } & OpenfortHookOptions & CreateWalletPostAuthOptions; /** * Hook for OAuth-based authentication operations * * This hook manages OAuth authentication flows including provider initialization, * credential storage, and wallet connection after successful OAuth authentication. * It supports multiple OAuth providers and handles the complete authentication lifecycle * from provider selection to wallet setup. * * @param hookOptions - Optional configuration with callback functions and authentication options * @returns Current OAuth authentication state and actions * * @example * ```tsx * import { OAuthProvider, useOAuth } from '@openfort/react' * * function OAuthSignIn() { * const { initOAuth, isLoading, error } = useOAuth() * const signIn = async () => { * const result = await initOAuth({ provider: OAuthProvider.GOOGLE }) * if (result.error) console.error(result.error.shortMessage) * } * return * } * ``` */ export declare const useOAuth: (hookOptions?: AuthHookOptions) => { isLoading: boolean; isError: boolean; isSuccess: boolean; error: OpenfortError | null | undefined; initOAuth: (options: InitializeOAuthOptions) => Promise; linkOauth: (options: InitializeOAuthOptions) => Promise; storeCredentials: ({ userId, token, ...options }: StoreCredentialsOptions) => Promise; }; export {};