Skip to content

Latest commit

 

History

History

export-in-node

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Example: export-in-node

This example demonstrates the following:

  • Programmatic export of a private key, wallet, or wallet account from your Turnkey organization
  • Verification of enclave signature during export
  • Decryption of sensitive data using HPKE (Hybrid Public Key Encryption)

Getting started

1/ Cloning the example

Make sure you have Node.js installed locally; we recommend using Node v18+.

$ git clone https://github.com/tkhq/sdk
$ cd sdk/
$ corepack enable  # Install `pnpm`
$ pnpm install -r  # Install dependencies
$ pnpm run build-all  # Compile source code
$ cd examples/export-in-node/

2/ Setting up Turnkey

The first step is to set up your Turnkey organization. By following the Quickstart guide, you should have:

  • A public/private API key pair for Turnkey
  • An organization ID

Once you've gathered these values, add them to a new .env.local file. Notice that your private key should be securely managed and never be committed to git.

$ cp .env.local.example .env.local

Now open .env.local and add the missing environment variables:

  • API_PUBLIC_KEY
  • API_PRIVATE_KEY
  • BASE_URL
  • ORGANIZATION_ID

3/ Running the script

$ pnpm start

You should see output similar to the following:

Enter Export Type, either wallet, key, account: