Documentation Index
Fetch the complete documentation index at: https://mintlify.com/tkhq/sdk/llms.txt
Use this file to discover all available pages before exploring further.
@turnkey/core is the low-level TypeScript client for the Turnkey API. It is designed for frameworks and environments where @turnkey/react-wallet-kit is not available, including Angular, Vue, Svelte, and highly custom integrations. It also serves as the foundation for React Native via @turnkey/react-native-wallet-kit.
@turnkey/core supersedes @turnkey/sdk-browser. New integrations should use this package.Installation
The TurnkeyClient class
TurnkeyClient is the main entry point for all Turnkey operations. It manages stampers (for request authentication), session storage, wallet connections, and the HTTP client that communicates with the Turnkey API and Auth Proxy.
Constructor
TurnkeyClient accepts a TurnkeySDKClientConfig object:
Your Turnkey parent organization ID.
The Auth Proxy configuration ID. Required when using Auth Proxy flows.
Turnkey API base URL. Defaults to
https://api.turnkey.com.Auth Proxy base URL. Defaults to
https://authproxy.turnkey.com.Configuration for the passkey stamper. Required to use passkey authentication.
Configuration for the external wallet manager. Required to use wallet-based authentication or connecting external wallets.
The default stamper to use for requests that require signing (ApiKey, Passkey, or Wallet).
Initialization
Callclient.init() once before using any other methods. This initializes storage, stampers, and the HTTP client in parallel:
Creating an HTTP client
You can create additionalTurnkeySDKClientBase instances with different configurations:
Authentication methods
Passkey
External wallet
OTP (email and SMS)
OAuth
Session management
TurnkeyClient manages sessions using a built-in storage manager. Sessions are keyed by a sessionKey string.
| Method | Description |
|---|---|
storeSession(params) | Persist a session token under a given session key |
getSession(params?) | Retrieve the active or a specific session |
setActiveSession(params) | Make a specific session the active one |
refreshSession(params?) | Refresh the active or a specific session before expiry |
logout(params?) | Clear the active or a specific session and delete associated key pairs |
Wallet methods
| Method | Description |
|---|---|
fetchWallets(params?) | Retrieve the user’s embedded wallets |
fetchWalletAccounts(params?) | Retrieve accounts for a specific wallet |
createWallet(params) | Create a new embedded wallet |
exportWallet(params) | Export a wallet as an encrypted bundle |
exportPrivateKey(params) | Export a private key as an encrypted bundle |
exportWalletAccount(params) | Export a wallet account as an encrypted bundle |
importWallet(params) | Import a wallet from an encrypted bundle |
importPrivateKey(params) | Import a private key from an encrypted bundle |
Signing methods
| Method | Description |
|---|---|
signMessage(params) | Sign an arbitrary message with a wallet account |
signTransaction(params) | Sign a transaction |
signAndSendTransaction(params) | Sign and broadcast a transaction |
ethSendTransaction(params) | Send an EVM transaction |
solSendTransaction(params) | Send a Solana transaction |
Integration with stampers
@turnkey/core integrates with the following stamper packages for request signing:
@turnkey/api-key-stamper
Signs requests with an API key pair. Used for server-side and session-based authentication.
@turnkey/webauthn-stamper
Signs requests using a WebAuthn passkey credential. Used for passkey-based authentication.
TurnkeyClient.init() based on the provided config. You can also supply custom stamper instances to the constructor: