Overview
The Turnkey Swift SDK provides a straightforward way to create and manage wallets in your Swift application. You can create wallets, derive accounts, import/export, and refresh wallet state fromTurnkeyContext.
Before you start, make sure you’re familiar with Wallets and Wallet Accounts.
Creation
There are two ways to create wallets and accounts:- During signup (sub-organization creation): Configure default wallet/accounts in your signup parameters so users get a wallet at account creation time. See Sub-organization customization for how to set
CreateSubOrgParamsglobally or per auth method. - After authentication (active session): Create wallets programmatically using the
TurnkeyContextonce the user is authenticated.
Wallet
Create a wallet with one Ethereum account using an active session:CreateWalletButton.swift
Wallet accounts
You can derive additional addresses for an existing wallet using the HTTP client:Private keys
Private keys are typically created when creating wallet accounts or by importing existing key material. See Importing → Private key.Listing wallets in the UI
TheTurnkeyContext maintains wallets for the active session. You can render them in your views:
Refreshing wallets
CallrefreshWallets() to re-fetch wallets and accounts for the current session:
Exporting
The Swift SDK lets you securely import/export wallets, accounts, and private keys. You can return decrypted values for developer workflows or handle encrypted bundles explicitly.Wallet
Default: decrypt locally and return the mnemonic (developer-friendly).Wallet account
Private key
Importing
Wallet
Imports a wallet from a mnemonic and automatically refreshes local state.Private key
Imports a private key from plaintext key material and automatically refreshes local state.Deleting
If a wallet, wallet account, or private key has not been exported, you must
either export it first or pass the
deleteWithoutExport: true flag in the
delete request.