Skip to main content

SDK Structure

The SDK is split into two packages: a core library (packages/core) that contains all cryptographic logic, and a mobile package (packages/mobile) that adds platform-specific adapters for React Native.

Cross-Platform Strategy

Three subsystems require platform-specific implementations: proof generation, discrete-log solving, and persistent storage. Each is abstracted behind an interface, with platform-appropriate implementations registered at startup.

Proof Generation

PlatformImplementationNotes
iOSMoPro (native Rust via Expo modules)Fastest, uses compiled Noir circuits
iOS/AndroidWebViewMT (multi-threaded WASM in a hidden WebView)Fallback, requires COOP/COEP headers for SharedArrayBuffer
Browser/NodeNoirJS + bb.js (WASM)Default, no native dependencies

The adapter interface (NativeProverAdapter) exposes prove(), init(), isReady(), and destroy(). If a native adapter is registered, the SDK uses it; otherwise it falls back to WASM.

Discrete-Log Solver

PlatformImplementationNotes
iOSNative Rust via Expo modulesUses precomputed tame DP tables
BrowserWASM, multi-threaded if SharedArrayBuffer availableFalls back to cooperative single-threaded mode
NodeWASM (node-specific build)Direct import

The adapter interface (NativeSolverAdapter) exposes init(), solve(), and dispose().

Key Storage

PlatformImplementation
iOSMMKV (encrypted persistent storage via react-native-mmkv)
BrowserlocalStorage or IndexedDB
NodeFilesystem
FallbackIn-memory Map

The StorageAdapter interface exposes get(), set(), delete(), and clear(). The SDK auto-detects the environment and picks the appropriate backend.

Initialization

On mobile, setupMobileEB() detects available native modules and registers the best adapters. On web and Node, the SDK uses WASM implementations directly with no setup needed beyond creating an EBClient instance.