@turnkey/sdk-react-native
Version:
React Native SDK
39 lines • 1.77 kB
TypeScript
import { TurnkeyClient } from "@turnkey/http";
import type { Session, User } from "./types";
/**
* Checks if a given session is valid.
*
* - A session is considered valid if it has a defined expiry time
* and the expiry time is in the future.
*
* @param session - The session to validate.
* @returns `true` if the session is valid, otherwise `false`.
*/
export declare const isValidSession: (session?: Session | null) => boolean;
/**
* Creates an authenticated Turnkey client instance.
*
* - Generates an `ApiKeyStamper` using the provided public and private keys.
* - Instantiates a `TurnkeyClient` with the configured API base URL.
*
* @param publicKey The public key used for authentication.
* @param privateKey The private key used for authentication.
* @param apiBaseUrl The base URL of the Turnkey API.
* @returns A new `TurnkeyClient` instance.
*/
export declare const createClient: (publicKey: string, privateKey: string, apiBaseUrl: string) => TurnkeyClient;
/**
* Fetches user details and associated wallets from the Turnkey API.
*
* - Retrieves the user's `whoami` information to obtain their id and organizationId.
* - Fetches the user's wallets and account details.
* - Fetches the user's profile information.
* - Returns a `User` object containing the retrieved details.
*
* @param client The authenticated `TurnkeyClient` instance.
* @param organizationId The ID of the organization to which the user belongs.
* @returns The `User` object containing user details and associated wallets, or `undefined` if the user is not found.
* @throws If any API request fails.
*/
export declare const fetchUser: (client: TurnkeyClient, organizationId: string) => Promise<User | undefined>;
//# sourceMappingURL=turnkey-helpers.d.ts.map