Skip to main content

Turnkey SDK

js-build

Overview

The Turnkey SDK includes functionality to interact with Turnkey in various contexts and ecosystems. It consists of three main NPM package groups. The diagram below helps visualize the packages in our SDK organized by the functionality they expose. homepage screenshot

Primary Turnkey Web SDK Packages

The following packages expose the main functionality required to build Turnkey-powered applications. Each package exposes functions, and/or client classes with methods that manage the process of authenticating requests to the Turnkey API in the contexts of a generic browser environment or react client environment, or a server environment. While these higher level packages are the main points of reference to be used while designing and building Turnkey applications, they wrap other packages with lower level functionality which we also expose separately for those who would like to explore them for more specialized use cases. These packages are listed and described below in the Advanced Functionality SDK Packages section. Our main web SDK packages are as follows: The diagram below helps visualize how each package can be used to devlop the appropriate service in your Turnkey Powered Application, and how Turnkey requests would flow between those services. homepage screenshot

Chain/Ecosystem-Specific Signing SDK Packages

The following packages contain chain or ecosystem specific signers that take some of our Primary Turnkey Web SDK Packages (usually @turnkey/sdk-browser or @turnkey/sdk-server) and add additional support based on the signing process or transaction structure relevant to that specific chain or ecosystem.

Advanced Functionality SDK Packages

For those with more specialized use cases, Turnkey exposes it’s lower level-libraries stamping and encryption libraries to be used directly. Note: for most use-cases, these libraries are not meant to be used directly and we encourage working on designing your application mainlyusing our Primary Turnkey Web SDK Packages along with our Chain and Ecosystem Specific SDK Packages as per your use case!

Request Stamping

Utilities

Code Examples

Instant examples (powered by Stackblitz)

The following code examples have been loaded into Stackblitz web environments so you can test them out immediately

Other Code Examples

The below examples will require a local installation of node.js. Follow the specific instructions in the respective readme’s of each examples to run them!

Demos built with Turnkey

Demo Consumer Wallet (code)

A minimal consumer wallet app powered by Turnkey. Behind the scenes, it uses @turnkey/ethers for signing and WalletConnect (v1) for accessing dapps. https://github.com/tkhq/demo-consumer-wallet/assets/127255904/2c3409df-2d7c-4ec3-9aa8-e2944a0b0e0a See https://github.com/tkhq/demo-consumer-wallet for the code. A wallet application showing how users can register and authenticate using passkeys. This demo uses the Turnkey API to create a new Turnkey Sub-Organization for each user, create a testnet Ethereum address and send a transaction on Sepolia (ETH testnet). homepage screenshot See https://wallet.tx.xyz (and https://github.com/tkhq/demo-passkey-wallet for the code).

Demo Ethers Passkeys (code)

A simple application demonstrating how to create sub-organizations, create private keys, and sign with the @turnkey/ethers signer, using passkeys. homepage screenshot See https://github.com/tkhq/demo-ethers-passkeys for the code.

Demo Viem Passkeys (code)

A similar, simple application demonstrating how to create sub-organizations, create private keys, and sign with the @turnkey/viem signer, using passkeys. homepage screenshot See https://github.com/tkhq/demo-viem-passkeys for the code.

React Native Demo App (code)

A React Native app that demonstrates how to use the Turnkey’s JavaScript packages in a mobile environment to authenticate users, create wallets, export wallets, sign messages, and more https://github.com/user-attachments/assets/e4cff012-11e9-4636-b67a-5dbf75355832 See https://github.com/tkhq/react-native-demo-wallet for the code.

Flutter Demo App (code)

A Flutter app that demonstrates how to use the Turnkey’s Flutter packages to authenticate users, create wallets, export wallets, sign messages, and more https://github.com/user-attachments/assets/3d583ed8-1eff-4101-ae43-3c76c655e635 See https://github.com/tkhq/dart-sdk/tree/main/examples/flutter-demo-app for the code