examples/

directory
v2.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 9, 2026 License: Apache-2.0

README

Examples

This directory contains example code for using the Turnkey Go SDK. Each subdirectory contains a self-contained example with its own README and .env file for configuration. The examples demonstrate various authentication flows and features of the Turnkey platform.

Policies

Some examples require specific Turnkey policies to be configured on your organization before they will work. Refer to the Turnkey policy overview for details on how to create and manage policies.

Set up

[!NOTE] Please refer to the main README for getting started with setting up your Turnkey environment.

All examples are run from the repo root. For each example:

  1. Copy .env.example to .env in the example's directory and fill in the values.
  2. Run using set -a && source examples/<example>/.env && set +a && go run ./examples/<example>

Refer to each example's README for the exact commands.

Available Examples

  • apikey: Demonstrates how to authenticate using an API key.

  • delegated_access: Shows how to set up delegated access for a sub-organization.

  • otp: Example of using one-time password (OTP) flows for authentication.

  • signing: Demonstrates how to sign messages and transactions using the SDK.

  • wallets: Shows how to manage wallets and sign transactions with them.

  • whoami: Example of using the WhoAmI endpoint to retrieve the current user's ID.

Directories

Path Synopsis
Package main demonstrates the delegated access setup.
Package main demonstrates the delegated access setup.
Package main demonstrates the OTP enclave authentication flow.
Package main demonstrates the OTP enclave authentication flow.
signing
wallets
create_wallet command
Package main demonstrates an API client which creates a new wallet with a wallet account.
Package main demonstrates an API client which creates a new wallet with a wallet account.
create_wallet_accounts command
Package main demonstrates an API client which creates new wallet accounts.
Package main demonstrates an API client which creates new wallet accounts.
export_wallet command
Package main demonstrates exporting a wallet mnemonic via the Turnkey enclave export flow.
Package main demonstrates exporting a wallet mnemonic via the Turnkey enclave export flow.
export_wallet_account command
Package main demonstrates exporting a wallet account's private key via the Turnkey enclave export flow.
Package main demonstrates exporting a wallet account's private key via the Turnkey enclave export flow.
import_wallet command
Package main demonstrates importing a wallet from a mnemonic phrase.
Package main demonstrates importing a wallet from a mnemonic phrase.
Package main demonstrates an API client which returns the UserID of its API key.
Package main demonstrates an API client which returns the UserID of its API key.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL