Skip to main content

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

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
  • Drop-in delegate hooks for Keychain, Passkey, and biometrics on both platforms
  • Identical core to TypeScript / iOS / Android SDKs (same proofs, same network protocol)

Installation

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 for native setup details and any Hermes/Expo caveats.

Quick Example

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

const config = PrivacyBoostConfig.create({
  serverUrl: 'https://test-api.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

MethodPurpose
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

Guides

Advanced

Reference

Requirements

  • React Native 0.71+
  • iOS deployment target 14+ (16+ for Passkey defaults)
  • Android minSdkVersion 26+ (34+ for Passkey defaults)
  • Hermes or JSC (both supported)