Skip to main content

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

Overview

The React Native SDK follows a simple flow:
  1. Initialize - Create SDK instance with configuration
  2. Authenticate - Connect wallet and authenticate via WalletDelegate
  3. 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 the WalletDelegate interface to interact with wallets. You must implement this interface:
You can use any React Native web3 library (such as ethers.js, viem, or WalletConnect) to implement this delegate. Then authenticate. 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, implement TokenProvider and pass it to authenticate():

Core Operations

Check Balance

Deposit Tokens

Move tokens from wallet to shielded pool:
Use 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 throws SDKError 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