Skip to main content

Browser Setup

This guide covers browser-specific considerations for the Privacy Boost WASM SDK.

WASM Initialization

WASM modules must be initialized before use. This is an async operation:

Lazy Loading

For better initial page load, lazy-load the WASM module:

React Integration

Basic Hook

Context Provider

Vue Integration

Svelte Integration

Web Workers

For heavy operations, run the SDK in a Web Worker:

worker.ts

main.ts

Content Security Policy

If using CSP, allow WASM execution:
Or in server headers:

Cross-Origin Isolation

For SharedArrayBuffer support (improves performance):

Browser Compatibility

Performance Tips

  1. Initialize once - Call init() only once per page load
  2. Reuse SDK instance - Don’t recreate the SDK unnecessarily
  3. Use Web Workers - For proof generation (heavy computation)
  4. Enable compression - Serve WASM with gzip/brotli

Next Steps