Skip to main content
Closed beta: the Secrets API is currently in closed beta. Contact us to get onboarded.
An exchange API key that can place orders, cancel orders, or move funds is a direct line to your balance sheet. It usually sits in an environment variable, a config file, or a vault that decrypts inside the infrastructure you are trying to protect. An attacker who compromises that infrastructure gets the key too. Turnkey removes the plaintext from your infrastructure entirely. The credential lives encrypted inside a secure enclave, and every retrieval is evaluated by the policy engine before the enclave releases anything. You decide which service identities can retrieve which keys, under what conditions, and with how many approvals. This solution builds on Secret Storage. Typical credentials this pattern protects:
  • Exchange and EMS API keys for trading operations (REST and WebSocket)
  • Long-lived JWTs and bearer tokens with broad authority
  • OAuth refresh tokens for backend services
  • Service account credentials for third party platforms

Why not a traditional secrets vault?

Key implementation decisions

Example: exchange trading key for a trading firm

A trading firm holds a long-lived JWT for an execution management system that authorizes placing and canceling orders on crypto exchanges. The plaintext should never exist in the firm’s own infrastructure.

Policy: scope retrieval to the trading service

Implementation steps

1

Import the API key

Import the credential once, with static properties the policies above target. The client encrypts the plaintext to the enclave. Turnkey’s API and database only ever see ciphertext:
You can now delete the plaintext from wherever it existed before.
2

Retrieve at runtime

The trading service authenticates with its own credentials and retrieves the key when it boots or opens a session. exportSecret generates the ephemeral keypair, submits the export activity, decrypts the result, and zeroizes the key:
3

Require approval for high-risk keys

For withdrawal-capable keys, add a consensus policy so no service can retrieve them alone:
The export stays in ACTIVITY_STATUS_CONSENSUS_NEEDED until a risk admin approves it from the dashboard or via approve_activity, and the released payload is still readable only by the trading service.
4

Rotate and revoke

Rotate by importing the replacement key and deleting the old secret. Revoke a service by invalidating its session keys or removing its user. Policy changes take effect immediately, with no re-encryption or re-import of the stored keys.

Next steps