Rust and WASM did-method-plc tools and structures
at main 1.1 kB view raw
1#!/bin/bash 2set -e 3 4echo "🔨 Building atproto-plc WASM module..." 5echo "" 6 7# Check if wasm-pack is installed 8if ! command -v wasm-pack &> /dev/null; then 9 echo "❌ Error: wasm-pack is not installed" 10 echo " Install it with: cargo install wasm-pack" 11 exit 1 12fi 13 14# Check if wasm32 target is installed 15if ! rustup target list | grep -q "wasm32-unknown-unknown (installed)"; then 16 echo "📦 Installing wasm32-unknown-unknown target..." 17 rustup target add wasm32-unknown-unknown 18fi 19 20# Clean previous build 21if [ -d "pkg" ]; then 22 echo "🧹 Cleaning previous build..." 23 rm -rf pkg 24fi 25 26# Build for Node.js 27echo "🔧 Building WASM module for Node.js..." 28cd .. 29wasm-pack build \ 30 --target nodejs \ 31 --out-dir wasm/pkg \ 32 --features wasm \ 33 --release 34 35cd wasm 36 37echo "" 38echo "✅ Build complete!" 39echo "" 40echo "📦 WASM module output:" 41ls -lh pkg/*.wasm 42 43echo "" 44echo "📝 Next steps:" 45echo " 1. Install Node.js dependencies: npm install" 46echo " 2. Run the tool: node plc-audit.js did:plc:z72i7hdynmk6r22z27h6tvur"