API Reference
Complete API reference for the Privacy Boost Android SDK.Generated Documentation
Full API documentation can be generated usingcargo doc:
PrivacyBoost
Main SDK class for Android.Constructor
config- SDK configuration
Properties
Connection & Authentication Methods
authenticate
wallet- Implementation ofWalletDelegateinterfacekeySource- Optional key derivation source. Ifnulland no persistence is configured, defaults toKeySource.WalletDerived. Ifnullwith persistence configured and no existing vault, an error is thrown.tokenProvider- Optional custom token provider. Ifnull, the SDK sends the login payload directly to the Privacy Boost backend. Supply aTokenProviderto route authentication through your own server.
AuthResult - either AuthResult.Authenticated(LoginResult) or AuthResult.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. Passnullto 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 null 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
Call
A single on-chain call to relay.value and data are 0x-hex.
PreparedShield
Returned byprepareShield and buildShieldPayload.
TransactionReceipt
The mined-receipt type 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 Interface
TokenProvider Interface
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-transfer (gift) methods on thePrivacyBoost instance. Preview feature
— pending external audit, enabled per deployment. See the
Claimable Transfers guide for usage and the
concept page for the trust model. Suspend
methods should be called inside withContext(Dispatchers.IO).
giftFundToWallet
tokenAddress- Token contract addressamount- Amount in wei (as string)recipientWallet- Recipient’s Ethereum address the gift binds to (irrevocable)refundAfterBlock- Block height after which an unclaimed gift may be reclaimedcurrentBlock- Current chain head; pre-validates the refund delay
TransferResult with giftRecord (persist it) and claimLink
giftFund
tokenAddress- Token contract addressamount- Amount in wei (as string)recipientPrivacyAddress- Recipient’s 194-char privacy address (ECDH target)recipientWallet- Recipient’s Ethereum address the gift binds to (irrevocable)refundAfterBlock- Block height after which an unclaimed gift may be reclaimedcurrentBlock- Current chain head; pre-validates the refund delay
TransferResult with giftRecord (persist it) and claimLink
giftClaim
getPendingGifts().
Parameters:
index- Position in the pending-gift listacknowledgeUnknownSender- Must betrue; consents to funds from a hidden sender
giftClaimByCGift
cGift. Preferred over index
when the pending list may shift as gifts settle.
Parameters:
cGift- Stable gift commitmentacknowledgeUnknownSender- Must betrue
giftClaimFromLink
pbgift:v1:... claim link without a server lookup first.
Parameters:
link- Apbgift:v1:...claim linkacknowledgeUnknownSender- Must betrue
giftRefundByRecord
refundAfterBlock has elapsed.
Parameters:
index- Position ingetGiftRecords()
giftRefund
getPendingGifts
getGiftRecords
decodeGiftLink
pbgift:v1:... claim link into a preview. Synchronous and throwing
— works fully offline, so it does not need withContext(Dispatchers.IO).
Parameters:
link- Apbgift:v1:...claim link
GiftLinkPreview
giftFundSecretBearer(...) also exists but is experimental, disabled by
default, and a bearer instrument (whoever holds the link can claim). See the
concept page before considering it.Gift Types
TransferResult returned by the
fund / claim / refund methods:
Portal
Portal deposit-address building blocks. Preview feature — pending external audit, enabled per deployment. Android exposes the low-level primitives only (no high-levelportal resource); your app owns the EIP-7702 transaction
orchestration. See the Portal Deposits guide for the
lifecycle and the concept page for the trust
model and launch limitations.
Instance Methods
publishPortalRegistry
withContext(Dispatchers.IO).
Parameters:
portal- The portal deposit addressE
portalDelegateAddress
/info, or null
if the server does not support portals.
Portal lifecycle
createPortal(index)— Derive portalE, gaslessly delegate and register it via the server relays, then publish the discovery entry. Passnullto use the next free derivation index.listPortals()— List the authenticated account’s portals with status and derivation index.listPortalDeposits(portal)— List deposits observed at a portal.getPortalStatus(portal)— Return registry/on-chain status for one portal.sweepPortal(portal, tokenId)— SendrequestPortalDepositfrom the connected wallet and return the transaction hash.reclaimPortalDeposit(depositId)— SendcancelPortalDepositfrom the connected wallet and return the transaction hash.withdrawPortal(...)— Build a signed EIP-1559 transaction that withdraws raw funds resting at seed-derived portalE. Broadcast the returned raw transaction yourself.
Top-Level Functions
These package-level functions are low-level escape hatches for custodial integrations that manage their own portal EOA key. The seed-derivedcreatePortal flow does not expose a private key.
generatePortalEoa()— Generate a fresh portal addressEand its secret private key for custodial integrations.encodePortalWithdraw(token, to, amount)— EncodePortalDelegate.withdrawcalldata for a custodial integration that already controlsE.
Portal Types
See Also
- Getting Started - Quick start guide
- Wallet Integration - Wallet delegate implementation
- Session Storage - Session persistence
- Claimable Transfers - Gift methods
- Portal Deposits - Portal building blocks