#!/bin/bash # Build synor-crypto-wasm WASM module using Docker # This script builds the WASM module and copies it to the web wallet set -e SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" PROJECT_ROOT="$(dirname "$SCRIPT_DIR")" cd "$PROJECT_ROOT" echo "==========================================" echo "Building synor-crypto-wasm WASM module" echo "==========================================" # Build the WASM Docker image echo "Step 1: Building Docker image..." docker build -f Dockerfile.wasm -t synor-wasm-builder . # Copy WASM artifacts to web wallet echo "Step 2: Copying WASM artifacts..." docker run --rm \ -v "$PROJECT_ROOT/apps/web/src/wasm:/dest" \ synor-wasm-builder \ sh -c 'cp -r /wasm-output/pkg/* /dest/' echo "==========================================" echo "WASM build complete!" echo "==========================================" echo "" echo "Files copied to: apps/web/src/wasm/" ls -la "$PROJECT_ROOT/apps/web/src/wasm/" echo "" echo "The web wallet can now use client-side Dilithium3 signatures." echo "" echo "Usage in TypeScript:" echo " import { createHybridSignatureLocal } from './lib/crypto';" echo " const signature = await createHybridSignatureLocal(message, seed);"