Demonstrating client-side cryptographic operations using Go WASM modules
Key generation, signing, verification
DID creation, authentication, proofs
// Old approach - API calls
const response = await fetch('/api/did/create', {
method: 'POST',
body: JSON.stringify(formData)
});
const result = await response.json();// 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);