UNPKG

@turnkey/react-wallet-kit

Version:

The easiest and most powerful way to integrate Turnkey's Embedded Wallets into your React applications.

137 lines 5.17 kB
import type { CreateSubOrgParams, TurnkeySDKClientConfig } from "@turnkey/core"; import type { Session, TurnkeyError, TurnkeyNetworkError } from "@turnkey/sdk-types"; import type { ThemeOverrides } from "../providers/theme/Overrides"; export interface TurnkeyCallbacks { onOauthRedirect?: (response: { idToken: string; publicKey: string; }) => void; beforeSessionExpiry?: (params: { sessionKey: string; }) => void; onSessionExpired?: (params: { sessionKey: string; }) => void; onAuthenticationSuccess?: (params: { session: Session | undefined; }) => void; onError?: (error: TurnkeyError | TurnkeyNetworkError) => void; } /** * Configuration for the TurnkeyProvider. * This interface extends the TurnkeySDKClientConfig to include additional UI and auth configurations. * It is used to initialize the TurnkeyProvider with various options such as colors, dark mode, auth methods, and more. * * @interface TurnkeyProviderConfig * @extends {TurnkeySDKClientConfig} */ export interface TurnkeyProviderConfig extends TurnkeySDKClientConfig { /** URL for the export iframe. */ exportIframeUrl?: string | undefined; /** URL for the import iframe. */ importIframeUrl?: string | undefined; /** configuration for authentication methods. */ auth?: { /** enables or disables specific authentication methods. */ methods?: { emailOtpAuthEnabled?: boolean; smsOtpAuthEnabled?: boolean; passkeyAuthEnabled?: boolean; walletAuthEnabled?: boolean; googleOauthEnabled?: boolean; appleOauthEnabled?: boolean; facebookOauthEnabled?: boolean; }; /** order of authentication methods. */ methodOrder?: Array<"socials" | "email" | "sms" | "passkey" | "wallet">; /** order of OAuth authentication methods. */ oauthOrder?: Array<"google" | "apple" | "facebook">; /** configuration for OAuth authentication. */ oauthConfig?: { /** redirect URI for OAuth. */ oauthRedirectUri?: string; /** client ID for Google OAuth. */ googleClientId?: string; /** client ID for Apple OAuth. */ appleClientId?: string; /** client ID for Facebook OAuth. */ facebookClientId?: string; /** whether to open OAuth in the same page. */ openOauthInPage?: boolean; }; /** session expiration time in seconds. */ sessionExpirationSeconds?: string; /** parameters for creating a sub-organization for each authentication method. */ createSuborgParams?: { /** parameters for email OTP authentication. */ emailOtpAuth?: CreateSubOrgParams; /** parameters for SMS OTP authentication. */ smsOtpAuth?: CreateSubOrgParams; /** parameters for passkey authentication. */ passkeyAuth?: CreateSubOrgParams & { passkeyName?: string; }; /** parameters for wallet authentication. */ walletAuth?: CreateSubOrgParams; /** parameters for OAuth authentication. */ oauth?: CreateSubOrgParams; }; /** whether to automatically refresh the session. */ autoRefreshSession?: boolean; }; /** UI configuration. */ ui?: { /** enables or disables dark mode. */ darkMode?: boolean; /** color scheme configuration. */ colors?: { /** light color scheme overrides. */ light?: Partial<ThemeOverrides>; /** dark color scheme overrides. */ dark?: Partial<ThemeOverrides>; }; /** whether to use large action buttons. */ preferLargeActionButtons?: boolean; /** border radius for UI elements. */ borderRadius?: string | number; /** background blur for UI elements. */ backgroundBlur?: string | number; /** whether to render the modal in the provider. */ renderModalInProvider?: boolean; /** whether to suppress missing styles error. */ supressMissingStylesError?: boolean; }; } /**@internal */ export declare enum ExportType { Wallet = "WALLET", PrivateKey = "PRIVATE_KEY", WalletAccount = "WALLET_ACCOUNT" } /** * Enum representing the authentication states of the user. * - Unauthenticated: The user is not authenticated. * - Authenticated: The user is authenticated. */ export declare enum AuthState { Unauthenticated = "unauthenticated", Authenticated = "authenticated" } /** * Enum representing the states of the client. * - Loading: The client is currently loading. * - Ready: The client is ready for use. * - Error: An error occurred while initializing the client. */ export declare enum ClientState { Loading = "loading", Ready = "ready", Error = "error" } /** @internal */ export type WalletId = string; /** @internal */ export type PrivateKeyId = string; /** @internal */ export type Address = string; //# sourceMappingURL=base.d.ts.map