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)
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/
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
$ pnpm start
You should see output similar to the following:
Enter Export Type, either wallet, key, account: