Getting Started
This guide walks you through integrating the Privacy Boost React Native SDK into your app.For a minimal copy-paste example, see the React Native Quickstart. This guide explains each step in detail.
Prerequisites
- An App ID and server URL (see Configuration)
- A wallet integration (WalletConnect, custom, etc.)
- Familiarity with authentication options (optional for development, required for production)
Overview
The React Native SDK follows a simple flow:- Initialize - Create SDK instance with configuration
- Authenticate - Connect wallet and authenticate via
WalletDelegate - Use - Deposit, unshield, transfer tokens
Basic Setup
1. Import the SDK
2. Configure the SDK
PrivacyBoostConfig.create() validates the fields and fills in defaults. Only
serverUrl and appId are required — chainId, shieldContractAddress, and
teePublicKey are automatically discovered from the server if omitted.
Passing undefined explicitly is required for nullable fields because the
generated types declare them as required-but-nullable.
3. Initialize
Connecting a Wallet
The SDK uses theWalletDelegate interface to interact with wallets. You must implement this interface:
authenticate() returns a tagged union with four possible
outcomes — you must handle each:
CredentialRequired only fires when persistence with PIN/password/biometric
unlock is configured (see the persistenceUnlock field on PrivacyBoostConfig).
For the simple case (no persistence), authenticate() returns Authenticated
(returning user) or MnemonicGenerated (first-time user) directly.App Authentication (TokenProvider)
If your backend issues app-level auth tokens, implementTokenProvider and
pass it to authenticate():
Core Operations
Check Balance
Deposit Tokens
Move tokens from wallet to shielded pool:requestId with sdk.getShieldStatus(requestId) to poll the shield’s
finality state. wrapTxHash is only present when depositing native ETH (the
SDK wraps to WETH first).
Withdraw Tokens
Move tokens from shielded pool to wallet:Private Transfer
Send tokens privately to another user:Error Handling
The SDK throwsSDKError for various failure conditions:
Session Persistence
Save and restore sessions to avoid re-signing:Next Steps
Deposits
Deposit tokens into the shielded pool
Withdrawals
Withdraw tokens from the shielded pool
Private Transfers
Send tokens privately between users
Balances
Query and display token balances
Transaction History
View and filter transaction history
Wallet Integration
Connect wallets and authenticate
Session Storage
Secure persistence with AsyncStorage and Keychain
Error Handling
Error codes and recovery patterns