Documentation Index
Fetch the complete documentation index at: https://turnkey-0e7c1f5b-amir-tx-status-webhooks.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
⚠️ This example is outdated !
Head over to SDK Reference for the updated packages.
Initialize the Passkey Client
import { Turnkey } from "@turnkey/sdk-browser";
const turnkey = new Turnkey({
apiBaseUrl: "https://api.turnkey.com",
defaultOrganizationId: process.env.TURNKEY_ORGANIZATION_ID,
});
const passkeyClient = turnkey.passkeyClient();
Call the login function
const response = await passkeyClient.login();
if (response.organizationId) {
navigate("/authenticated-route");
} else {
navigate("/not-authenticated-route");
}
Make read requests on behalf of the authenticated user from the currentUserSession
const currentUserSession = await turnkey.currentUserSession();
const walletsResponse = await currentUserSession.getWallets();
const walletName = walletsResponse.wallets[0].walletName;
Call the passkeyClient directly for write requests
This will always prompt a user to confirm the action with their passkey credentialimport { DEFAULT_ETHEREUM_ACCOUNTS } from "@turnkey/sdk-browser";
const newWalletResponse = await passkeyClient.createWallet({
walletName: "New Wallet for User",
accounts: DEFAULT_ETHEREUM_ACCOUNTS,
});