Overview
Turnkey is a key management platform that pairs naturally with Brale’s stablecoin rails.- Turnkey handles wallet creation and transaction signing inside hardware-backed secure enclaves.
- Brale handles regulated stablecoin issuance, on/off-ramps, and transfer orchestration.
Architecture / flow
At a high level:- Turnkey provisions a wallet and gives you an onchain address.
- You register that address with Brale as an external Address (type=external).
- Brale returns an address_id.
- You use that address_id as a Transfer source or destination.
- When funds are in the Turnkey wallet, your app uses Turnkey to sign and broadcast onchain transactions.
What is Turnkey?
Turnkey is a secure key management infrastructure for provisioning and managing wallets at any scale. Every private key exists inside a hardware-backed secure enclave (TEE), and typical workflows never directly handle private key material. Why teams choose Turnkey:- Hardware-backed security: Private keys live in verifiable secure enclaves and are never directly exposed.
- Programmable signing policies: Define fine-grained rules governing which transactions can be signed, by whom, and under what conditions.
- Per-user sub-organizations: Give each team or end-user an isolated key hierarchy for embedded wallet applications.
- Server-side or client-side: Works equally well for backend automation, treasury, B2B, and user-facing embedded wallet flows.
Prerequisites
- A Brale account with KYB started or completed, and an API client created in the Brale Dashboard
- A Turnkey account with an organization and API key pair
- A decision on which network(s) you want to support (for example, EVM chains like base)
Authenticate with Brale
Exchange your Brale client credentials for a bearer token:Get your account_id
- If you only have a single Brale account, use that account_id.
- If you operate managed accounts, use the managed account’s account_id for the end customer you are funding.
Get the wallet address from Turnkey
You only need one thing from Turnkey to use Brale: the onchain address you want to fund (or receive funds from). The examples below cover two common patterns. Turnkey supports additional SDKs. See the SDK overview for the full list.Option A: Embedded wallet with @turnkey/react-wallet-kit
Once your user is authenticated, read the wallet address from the wallets array returned by the useTurnkey hook:Option B: Server-side wallet with @turnkey/sdk-server
For server-side or treasury use cases, retrieve addresses from the Turnkey API using @turnkey/sdk-server:Register the Turnkey wallet in Brale
Create an external address and capture the returned address_id:- If the same address format is valid across multiple networks (for example, EVM chains), include all relevant onchain transfer_types in a single call.
- If the address format differs by chain (for example, non-EVM), create separate external Addresses.
Onramp: send stablecoins to the Turnkey wallet
Option A: wire → stablecoin → Turnkey wallet
Option B: ach_debit → stablecoin → Turnkey wallet
ach_debit flows require additional setup (end-user funding addresses, Plaid flows, etc.). Once configured, the Transfer pattern is the same: the destination is your Turnkey address_id. See: ach_debit to end user walletSign and send from the Turnkey wallet
This section is Turnkey-specific. Brale does not require a particular signing library or transaction stack for external wallets. With stablecoins in the Turnkey wallet, all onchain activity is signed by Turnkey. Keys never leave the enclave. Your app constructs an onchain transaction, Turnkey produces a signed payload, and you broadcast it. Be sure your onchain transaction configuration matches the chain and token you’re using (contract address, decimals, gas settings, and chain ID).- ERC-20 transfer example (viem, react-wallet-kit) Use viem to encode the ERC-20 transfer calldata, sign it with signTransaction from useTurnkey, then broadcast via a public client.
Offramping (stablecoin → USD)
Brale’s offramp converts stablecoins to fiat from Brale-custodied addresses (type=internal). For a Turnkey wallet, that means:- Send stablecoins from the Turnkey wallet to a Brale custodial deposit address.
- Wait for the inbound onchain deposit to be credited to the Brale custodial address.
- Initiate the stablecoin-to-fiat payout workflow.
References
Brale- Quick Start, Your First Brale Stablecoin Transfer
- Authentication
- Add an External Destination
- Self-custody Wallets
- Stablecoin to Fiat (Offramp)
- ach_debit to end user wallet