WebAssembly Integration Demo

Demonstrating client-side cryptographic operations using Go WASM modules

WASM Module Status

Crypto Module

Key generation, signing, verification

DID Module

DID creation, authentication, proofs

Loading WASM modules...

Integration Benefits

✓ Before (JavaScript)

  • • HTTP requests to backend API
  • • Network latency for each operation
  • • JavaScript crypto libraries (tweetnacl)
  • • Server-side key management
  • • Multiple round trips for complex operations

✓ After (WASM)

  • • Native Go crypto operations in browser
  • • Zero network latency for crypto ops
  • • Same crypto library as backend (gnark-crypto)
  • • Client-side key management
  • • Batched operations with single function calls

Live Demonstrations

Code Examples

Before (API Calls):

// Old approach - API calls
const response = await fetch('/api/did/create', {
  method: 'POST',
  body: JSON.stringify(formData)
});
const result = await response.json();

After (WASM with Binary Encoding):

// New approach - Direct WASM calls with binary data
import { cryptoWasm } from '@/lib/crypto-wasm';

// Generate key pair (returns Uint8Array)
const keyPair = await cryptoWasm.generateKeyPair();

// Sign message with binary data
const messageBytes = cryptoWasm.stringToUint8Array(message);
const signature = await cryptoWasm.signMessage(keyPair.privateKey, messageBytes);

// Verify with binary data
const isValid = await cryptoWasm.verifySignature(keyPair.publicKey, messageBytes, signature);