> ## Documentation Index
> Fetch the complete documentation index at: https://docs.privacyboost.io/llms.txt
> Use this file to discover all available pages before exploring further.

# React Native SDK

> Cross-platform SDK for privacy-preserving transactions on React Native

# React Native SDK

The Privacy Boost React Native SDK (`@sunnyside-io/privacy-boost-react-native`) wraps the Rust core via UniFFI-generated bindings, giving you a TypeScript surface backed by native iOS and Android binaries — no WebView, no JS-side proving.

## Features

* TypeScript-first API — same idioms as the web SDK, native execution
* Promise-based — works with `async`/`await`, hooks, and any state library
* Tagged-union `SdkError` for exhaustive runtime checks
* Multi-chain via `ChainContextHandle` — operate on multiple chains from one identity
* Construction-time errors for unsupported native persistence options
* Identical core to TypeScript / iOS / Android SDKs (same proofs, same network protocol)

## Installation

```bash theme={null}
npm install @sunnyside-io/privacy-boost-react-native
# or
yarn add @sunnyside-io/privacy-boost-react-native
```

iOS requires a `pod install`; Android picks up the AAR automatically. See the [installation guide](./installation) for native setup details and any Hermes/Expo caveats.

## Quick Example

```typescript theme={null}
import {
  PrivacyBoost,
  PrivacyBoostConfig,
  KeySource,
  AuthResult,
  SdkError,
} from '@sunnyside-io/privacy-boost-react-native';

const config = PrivacyBoostConfig.create({
  serverUrl: 'https://optimism.sepolia.privacyboost.io',
  chainId: undefined,                   // discovered from server
  shieldContractAddress: undefined,     // discovered from server
  wethContractAddress: '0x4200000000000000000000000000000000000006',
  teePublicKey: undefined,
  appId: 'app_abc123xyz',
  persistenceStorage: undefined,
  persistenceUnlock: undefined,
});

const sdk = new PrivacyBoost(config);

// Authenticate with a WalletDelegate you implement
const result = await sdk.authenticate(
  myWalletDelegate,
  new KeySource.WalletDerived(),
  undefined,
);

if (AuthResult.Authenticated.instanceOf(result)) {
  console.log('Privacy address:', result.loginResult.privacyAddress);
} else if (AuthResult.CredentialRequired.instanceOf(result)) {
  // Prompt user for PIN/biometric, then call sdk.submitCredential(...)
} else if (AuthResult.MnemonicGenerated.instanceOf(result)) {
  // First-time user — display mnemonic, then call sdk.proceedAfterMnemonic(...)
} else if (AuthResult.RecoveryRequired.instanceOf(result)) {
  // Vault is in a recovery state — see Authentication concepts
}

// Shield 1 ETH-equivalent of WETH
const amount = sdk.parseAmount('1.0', 18);
const shielded = await sdk.shield(
  '0x4200000000000000000000000000000000000006',
  amount,
);
console.log('Shield tx:', shielded.txHash);
```

## Core Operations

| Method                                                    | Purpose                                |
| --------------------------------------------------------- | -------------------------------------- |
| `sdk.shield(tokenAddress, amount)`                        | Deposit tokens into the shielded pool  |
| `sdk.unshield(tokenAddress, amount, recipient)`           | Withdraw to a public address           |
| `sdk.send(tokenAddress, amount, recipientPrivacyAddress)` | Private transfer                       |
| `sdk.getBalance(tokenAddress)`                            | Single-token shielded + wallet balance |
| `sdk.getAllBalances()`                                    | All tracked balances                   |
| `sdk.getTransactionHistory(...)`                          | Paginated history                      |
| `sdk.resolveIdentity(identifier)`                         | Look up a privacy address              |
| `sdk.createChainContext(config)`                          | Open a chain-scoped handle             |

## Documentation

### Getting Started

* [Installation](./installation)
* [Build from source](./build-from-source)
* [Getting Started](./getting-started)

### Guides

* [Deposits](./guides/deposits)
* [Withdrawals](./guides/withdrawals)
* [Transfers](./guides/transfers)
* [Balances](./guides/balances)
* [Transactions](./guides/transactions)
* [Multi-Chain](./guides/multi-chain)
* [Wallet Integration](./guides/wallet-integration)
* [Session Storage](./guides/session-storage)
* [Error Handling](./guides/error-handling)

### Advanced

* [Performance](./advanced/performance)
* [Error Handling Patterns](./advanced/error-handling)

### Reference

* [API Reference](./api-reference)

## Requirements

* React Native 0.71+
* iOS deployment target 14+
* Android `minSdkVersion` 26+
* Hermes or JSC (both supported)

## Related

* [Multi-Chain Concepts](/sdk/concepts/multi-chain) — architecture overview
* [Authentication Concepts](/sdk/concepts/authentication) — auth flow details
* [Quickstart](/sdk/quickstart/react-native) — 5-minute integration
* [TypeScript SDK](../typescript/getting-started) — sibling SDK with the same API surface
