UNPKG

@turnkey/react-wallet-kit

Version:

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

73 lines 3 kB
import { Session, TurnkeyError, TurnkeyErrorCodes } from "@turnkey/sdk-types"; import type { TurnkeyCallbacks } from "./types/base"; import { WalletProvider } from "@turnkey/core"; export declare const GOOGLE_AUTH_URL = "https://accounts.google.com/o/oauth2/v2/auth"; export declare const APPLE_AUTH_URL = "https://account.apple.com/auth/authorize"; export declare const APPLE_AUTH_SCRIPT_URL = "https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js"; export declare const FACEBOOK_AUTH_URL = "https://www.facebook.com/v11.0/dialog/oauth"; export declare const FACEBOOK_GRAPH_URL = "https://graph.facebook.com/v11.0/oauth/access_token"; export declare const popupWidth = 500; export declare const popupHeight = 600; export declare const SESSION_WARNING_THRESHOLD_MS: number; export declare const authErrors: { passkey: { createFailed: string; loginFailed: string; timeoutOrNotAllowed: string; }; otp: { sendFailed: string; invalidEmail: string; invalidPhone: string; }; oauth: { loginFailed: string; }; wallet: { loginFailed: string; noPublicKey: string; }; suborg: { fetchFailed: string; createFailed: string; }; }; export declare const useDebouncedCallback: <T extends (...args: any[]) => void>(fn: T, wait?: number) => T; export declare const isValidSession: (session?: Session | undefined) => boolean; export declare function withTurnkeyErrorHandling<T>(fn: () => Promise<T>, callbacks?: { onError?: (error: TurnkeyError) => void; }, fallbackMessage?: string, fallbackCode?: TurnkeyErrorCodes): Promise<T>; export declare function parseOAuthRedirect(hash: string): { idToken: string | null | undefined; provider: string | null; flow: string | null; publicKey: string | null; openModal: string | null; }; export declare function generateChallengePair(): Promise<{ verifier: string; codeChallenge: string; }>; export declare function exchangeCodeForToken(clientId: string, redirectUri: string, code: string, codeVerifier: string): Promise<{ id_token: string; }>; export declare function handleFacebookPKCEFlow({ code, publicKey, openModal, clientId, redirectURI, callbacks, completeOauth, onPushPage, }: { code: string; publicKey: string; openModal?: string | null; clientId: string; redirectURI: string; callbacks?: TurnkeyCallbacks | undefined; completeOauth: (params: { oidcToken: string; publicKey: string; }) => Promise<string>; onPushPage: (idToken: string) => Promise<void>; }): Promise<void>; export declare function useScreenSize(): { width: number; isMobile: boolean; }; export declare function isWalletConnect(wallet: WalletProvider): boolean; export declare function useWalletProviderState(initialState?: WalletProvider[]): readonly [WalletProvider[], (newProviders: WalletProvider[]) => void]; //# sourceMappingURL=utils.d.ts.map