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)
ShieldResult 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
prepareShield
finalizeShield(...) to recover the on-chain request
id.
Parameters:
tokenAddress- Token contract address (zero address = native ETH)amount- Amount in wei (as string)recipient- (Optional) recipient privacy address. Passnilto shield to yourself.
PreparedShield with the calls to relay and the note commitment
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
Stateless shield helpers
Top-level functions for building a deposit payload without a signed-in session — for a backend that holds only a recipient’s privacy address. No wallet, no private keys.buildShieldPayload builds a recipient-targeted deposit payload from public
material only. Resolve tokenId, shieldContractAddress, and teePublicKey
from the token catalog / config. An ephemeral sender keypair is generated and
discarded internally, and the note is spendable only by recipient.
wethContractAddress is required only when shielding native ETH;
minShieldAmount (per-token minimum in wei) rejects below-minimum deposits;
emitApprove emits the ERC-20 approve call (pass true by default).
finalizeShield recovers the on-chain shield request id from the mined receipt
of a relayed deposit. Stateless — the caller obtained the receipt from its own
relay/RPC. Throws if the deposit reverted or the DepositRequested log is
absent.
Types
PrivacyBoostConfig
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
ShieldResult
Returned byshield and finalizeShield.
UnshieldResult
TransferResult
send(), giftRecord and claimLink are nil; they are
populated by the gift funding methods.
Call
A single on-chain call to relay.value and data are 0x-hex.
PreparedShield
Returned byprepareShield and buildShieldPayload.
TransactionReceipt
The mined-receipt record passed tofinalizeShield.
Transaction
IdentityResult
ExportedSession
data is an opaque serialized core session. Store and pass it back unchanged;
do not parse or persist individual key fields.
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
Gift Methods
Claimable transfers (gifts). See the Claimable Transfers guide and the concept page.Preview feature — pending external audit, and enabled per deployment. These
methods may not be present in the checked-in generated Swift bindings.
TransferResult whose giftRecord and
claimLink fields are populated for gift operations.
giftFundToWallet
tokenAddress- Token contract addressamount- Amount in wei (as string)recipientWallet- Recipient’s Ethereum address the gift binds torefundAfterBlock- Block height after which an unclaimed gift may be reclaimedcurrentBlock- Current chain head; pre-validates the refund delay
TransferResult with claimLink and giftRecord populated
giftFund
recipientPrivacyAddress.
Parameters:
recipientPrivacyAddress- Recipient’s 194-char privacy address (the ciphertext’s ECDH target)- Other parameters as in
giftFundToWallet
TransferResult with claimLink and giftRecord populated
giftClaim
getPendingGifts().
Parameters:
index- Position in the pending-gifts listacknowledgeUnknownSender- Must betrue; acknowledges accepting funds from an unknown sender
giftClaimByCGift
cGift (preferred when the list
may shift as gifts settle).
giftClaimFromLink
pbgift:v1:... claim link, without a server lookup
first.
giftRefundByRecord
index
is the positional index into getGiftRecords().
giftRefund
getPendingGifts
getGiftRecords
decodeGiftLink
A third funding mode,
giftFundSecretBearer, binds a gift to a secret instead
of a wallet. It is experimental, disabled by default, and a bearer
instrument (whoever holds the link can claim). See the
concept page before considering it.GiftRecord
PendingGift
GiftLinkPreview
TransferResult are documented under
TransferResult.
Portal
Portal deposit addresses. See the Portal Deposits guide and the concept page.Preview feature — pending external audit, and enabled per deployment. iOS
exposes the portal lifecycle as methods on
PrivacyBoost. Low-level portal
functions are limited to custodial escape hatches.createPortal, which derives the portal EOA from the
account seed and keeps the key inside core.
createPortal
E, gaslessly delegate and register it via the server relays, then
publish the discovery entry. Pass nil to use the next free derivation index.
listPortals
listPortalDeposits
portal.
getPortalStatus
sweepPortal
requestPortalDeposit from the connected wallet and return the transaction
hash.
reclaimPortalDeposit
cancelPortalDeposit from the connected wallet and return the transaction
hash.
withdrawPortal
E. Broadcast the returned raw transaction yourself.
Low-level escape hatches
These top-level functions are for custodial integrations that manage their own portal EOA key. The seed-derivedcreatePortal flow does not expose a private
key.
generatePortalEoa
E and its secret private key.
encodePortalWithdraw
publishPortalRegistry
E → blind) — the supported submit path so
the indexer can credit deposits to the right account.
portalDelegateAddress
/info, or nil
if the server does not support portals.
PortalEoa
See Also
- Getting Started - Quick start guide
- Wallet Integration - Wallet delegate implementation