API Reference
Complete API reference for the Privacy Boost iOS SDK.Generated Documentation
Full API documentation can be generated usingcargo doc:
PrivacyBoost
Main SDK class for iOS.Constructor
config- SDK configuration
SDKError.internalError if initialization fails
Properties
Connection & Authentication Methods
authenticate
wallet- Implementation ofWalletDelegateprotocolkeySource- Optional key derivation source. Ifniland no persistence is configured, defaults to.walletDerived. Ifnilwith persistence configured and no existing vault, an error is thrown.tokenProvider- Optional custom token provider. Ifnil, the SDK sends the login payload directly to the Privacy Boost backend. Supply aTokenProviderto route authentication through your own server.
AuthResult - either .authenticated(LoginResult) or .credentialRequired(CredentialChallenge)
Throws:
SDKError.walletErrorif signing failsSDKError.invalidConfigif configuration is invalid or keySource is required but missingSDKError.networkErrorif backend unreachable
submitCredential
authenticate() returns .credentialRequired.
Parameters:
credential- The credential stringtokenProvider- Optional custom token provider for routing authentication through your own server
LoginResult with privacy address and MPK
logout
clearSession
State Accessors
Balance Methods
getBalance
tokenAddress- ERC-20 token contract address
TokenBalance with shielded and wallet amounts
getAllBalances
Vault Operations
deposit
tokenAddress- Token contract addressamount- Amount in wei (as string)
DepositResult with transaction hash
withdraw
tokenAddress- Token contract addressamount- Amount in wei (as string)recipient- Recipient Ethereum address
UnshieldResult with transaction hash
send
tokenAddress- Token contract addressamount- Amount in wei (as string)recipientPrivacyAddress- Recipient’s 194-char privacy address
TransferResult with transaction hash
Transaction History
txType- Filter by type: “deposit”, “withdraw”, “transfer”tokenAddress- Filter by tokenlimit- Maximum results
Session Persistence
exportSession
ExportedSession or nil if not authenticated
importSession
true if session is valid and imported
Address Lookup
resolveIdentity
identifier- MPK or Ethereum address
IdentityResult with privacy address and public keys
Utilities
Module Functions
sdkVersion()— Returns the SDK version stringgenerateMnemonic()— Generates a random 12-word BIP-39 mnemonic
Types
PrivacyBoostConfig
| Field | Type | Description |
|---|---|---|
serverUrl | String | Privacy Boost server URL |
wethContractAddress | String | WETH contract address |
appId | String | Application ID (required) |
chainId | UInt64? | EIP-155 chain ID (optional, auto-discovered from server) |
shieldContractAddress | String? | Shield contract address (optional, auto-discovered from server) |
teePublicKey | String? | TEE public key for encryption (optional) |
KeySource
authenticate().
- walletDerived - Derive keys from a deterministic wallet signature (default when no persistence configured)
- mnemonic - Derive keys from a BIP-39 mnemonic phrase
- rawSeed - Derive keys from raw hex entropy (for testing)
AuthResult
LoginResult
TokenBalance
DepositResult
UnshieldResult
TransferResult
Transaction
IdentityResult
ExportedSession
WalletDelegate Protocol
TokenProvider Protocol
getToken(). Your implementation should forward this payload to your backend, which adds its own credentials and calls the Privacy Boost API.
TokenResponse
Example
SDKError
See Also
- Getting Started - Quick start guide
- Wallet Integration - Wallet delegate implementation