A web application demonstrating JubJub curve signatures using Rust WebAssembly and Next.js.
project/
├── rust-jubjub-wasm/ # Rust WASM library
│ ├── src/
│ │ └── lib.rs # Rust implementation for jubjub keys
│ ├── Cargo.toml
│ └── Cargo.lock
└── jubjub-signature-app/ # Next.js frontend
├── src/
│ ├── app/
│ │ └── page.tsx
│ ├── components/
│ │ └── SignatureComponent.tsx
│ └── wasm/ # Compiled WASM files
└── next.config.js
- Build the Rust WASM Library
# In the rust project root directory
wasm-pack build --target web
- Set up the Next.js Application
# Navigate to the Next.js app directory
cd jubjub-signature-app
# Install dependencies
npm install
# Create wasm directory if it doesn't exist
mkdir -p src/wasm
# Copy WASM files from rust project
cp -r ../pkg/* src/wasm/
- Run the Development Server
# In the jubjub-signature-app directory
npm run dev
The application will be available at http://localhost:3000
-
Missing WASM Files
- Ensure you've run
wasm-pack build --target web
in the root directory - Check that all files from
pkg/
are copied tojubjub-signature-app/src/wasm/
- Ensure you've run
-
Node Modules Issues
- If you encounter module-related errors, try:
cd jubjub-signature-app rm -rf node_modules rm package-lock.json npm install
- If you encounter module-related errors, try:
-
WASM Loading Issues
- Verify
next.config.js
has the correct WASM configuration - Check browser console for WASM-related errors
- Verify
- Click "Generate Keypair" to create a new JubJub keypair
- Enter a message in the input field
- Click "Sign Message" to create a signature
- Click "Verify Signature" to verify the signature
- Generate JubJub keypairs
- Sign messages using JubJub signatures
- Verify signatures
- Display public keys and signatures in hex format
- Uses the JubJub elliptic curve for signatures
- Compiled to WebAssembly using wasm-pack
- Exports KeyPair generation, signing, and verification functions
- Built with Next.js 13+ App Router
- Uses TypeScript for type safety
- Tailwind CSS for styling
- WebAssembly integration for cryptographic operations
To make changes to the Rust code:
- Modify the Rust code in
src/lib.rs
- Rebuild the WASM package:
wasm-pack build --target web
- Copy the new WASM files to the Next.js app:
cp -r pkg/* jubjub-signature-app/src/wasm/
- Restart the Next.js development server