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.

iOS SDK

The Privacy Boost iOS SDK is a native Swift framework that wraps the Rust core via UniFFI. It exposes idiomatic Swift APIs (async throws, structs, enums with associated values) for shielding, unshielding, and private transfers.

Features

  • Native Swift framework — no JavaScript bridge, no WebView
  • async/await everywhere — works with Swift Concurrency and SwiftUI
  • Strongly-typed SDKError enum with associated values for pattern matching
  • Drop-in defaults for Keychain, Passkey (iOS 16+), and biometrics
  • Wallet-agnostic — implement WalletDelegate once for any signer
  • Identical core to the TypeScript / Android / React Native SDKs (same proofs, same network protocol)

Installation

Add the SwiftPM package to your project. See the installation guide for full details.
// Package.swift
.package(url: "https://github.com/sunnyside-io/privacy-boost-ios", from: "0.2.0"),
Then import:
import PrivacyBoost
import PrivacyBoostDefaults  // optional — Keychain + Passkey defaults

Quick Example

import PrivacyBoost

let config = PrivacyBoostConfig(
    serverUrl: "https://test-api.privacyboost.io",
    chainId: nil,                    // discovered from server
    shieldContractAddress: nil,      // discovered from server
    wethContractAddress: "0x4200000000000000000000000000000000000006",
    teePublicKey: nil,
    appId: "app_abc123xyz",
    persistenceStorage: nil,
    persistenceUnlock: nil
)

let sdk = try PrivacyBoost(config: config)

// Authenticate with a WalletDelegate you implement
let result = try await sdk.authenticate(
    wallet: myWalletDelegate,
    keySource: .walletDerived,
    tokenProvider: nil
)

switch result {
case .authenticated(let login):
    print("Privacy address:", login.privacyAddress)
case .credentialRequired(let challenge):
    // Prompt user for PIN/biometric, then call sdk.submitCredential(...)
    break
case .mnemonicGenerated(let mnemonic):
    // First-time user — display mnemonic, then call sdk.proceedAfterMnemonic(...)
    break
case .recoveryRequired:
    // Vault is in a recovery state — see Authentication concepts
    break
}

// Shield 1 ETH-equivalent of WETH
let amount = try sdk.parseAmount("1.0", decimals: 18)
let shielded = try await sdk.shield(
    tokenAddress: "0x4200000000000000000000000000000000000006",
    amount: amount
)
print("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

Documentation

Getting Started

Guides

Advanced

Reference

Requirements

  • iOS 14+ (iOS 16+ required for Passkey defaults)
  • Swift 5.7+
  • Xcode 14+