Skip to main content

Libraries

Turnkey currently has SDK implementations in JavaScript and Go.


The following are libraries we have direct compatibility with:

Ethers

@turnkey/ethers exports a TurnkeySigner that serves as a drop-in replacement for an Ethers signer. Out of the box, it supports { signTransaction | signMessage | signTypedData }. See full implementation here for more details and examples. Note that you must bring your own provider and connect it to the TurnkeySigner.

// Initialize a Turnkey Signer
const turnkeySigner = new TurnkeySigner({
...
});

// Bring your own provider (such as Alchemy or Infura: https://docs.ethers.org/v5/api/providers/)
const network = "goerli";
const provider = new ethers.providers.InfuraProvider(network);
const connectedSigner = turnkeySigner.connect(provider);

Viem

@turnkey/viem provides a Turnkey Custom Account (signer) which implements the signing APIs expected by Viem clients.

See with-viem and with-viem-and-passkeys for examples.

CosmJS

Similarly, @turnkey/cosmjs exports a TurnkeyDirectWallet that serves as a drop-in replacement for a CosmJS direct wallet. It includes support for signDirect. See full implementation here for more details and examples.

// Initialize a Turnkey Signer
const turnkeySigner = await TurnkeyDirectWallet.init({
config: {
...
},
prefix: "celestia", // can be replaced with other Cosmos chains
});

const account = refineNonNull((await turnkeySigner.getAccounts())[0]);
const compressedPublicKey = toHex(account.pubkey);
const selfAddress = account.address;

@solana/web3

We have released a package that you can use to sign transactions and messages: @turnkey/solana. See here for an example.