From 026658e7cae69d068384f3b0ea74b347abd76f68 Mon Sep 17 00:00:00 2001 From: Maksym Zub Date: Mon, 6 Jan 2025 15:24:44 +0100 Subject: [PATCH] upd description --- Cargo.lock | 1 - crates/shielder_bindings/Cargo.toml | 3 +- crates/shielder_bindings/README.md | 44 +++++++++++++++++++++++++---- 3 files changed, 39 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0a700ccc..549c2c17 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4714,7 +4714,6 @@ dependencies = [ name = "shielder_bindings" version = "0.1.0" dependencies = [ - "console_error_panic_hook", "getrandom", "halo2_proofs", "rand", diff --git a/crates/shielder_bindings/Cargo.toml b/crates/shielder_bindings/Cargo.toml index 26abdc03..da92be1e 100644 --- a/crates/shielder_bindings/Cargo.toml +++ b/crates/shielder_bindings/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "shielder_bindings" version = "0.1.0" -description = "WASM bindings to shielder circuits for browser" +description = "WASM and mobile bindings for the shielder-circuits" edition.workspace = true authors = ["Cardinal", "Piotr Roslaniec "] @@ -14,7 +14,6 @@ repository.workspace = true crate-type = ["cdylib", "staticlib"] [dependencies] -console_error_panic_hook = { workspace = true } getrandom = { workspace = true, optional = true } halo2_proofs = { workspace = true } rand = { workspace = true, features = ["small_rng"] } diff --git a/crates/shielder_bindings/README.md b/crates/shielder_bindings/README.md index 534ff5cd..9f881061 100644 --- a/crates/shielder_bindings/README.md +++ b/crates/shielder_bindings/README.md @@ -1,13 +1,45 @@ -# `shielder-wasm` +# Shielder Bindings -This crates provides WASM bindings for the circuits from `shielder-circuits` crate and for some parts of `shielder-rust-sdk`. +Platform-native bindings for the Shielder cryptographic operations, supporting both WebAssembly (WASM) and mobile platforms through a unified Rust codebase. -We use the `wasm-pack` tool to generate the bindings. You can find the generated bindings in the `pkg` directory. +## Overview -To build the project, run: +The shielder_bindings crate provides a no_std compatible interface to the Shielder cryptographic operations. It supports multiple compilation targets including WebAssembly for browser environments and platform-native bindings (via UniFFI) for mobile platforms. + +## Building + +### Prerequisites + +- Rust toolchain (see rust-toolchain.toml) +- wasm-pack (for WebAssembly builds) +- Rust target: aarch64-apple-ios-sim (for iOS simulator builds) + +### WebAssembly Builds ```bash -make +# Build both single-threaded and multi-threaded WASM packages +make wasm + +# This will: +# 1. Clean previous builds +# 2. Build single-threaded package +# 3. Build multi-threaded package with rayon support +# 4. Update package configuration ``` -Inspect the `Makefile` and the resulting `pkg` directory for more information. +The WASM build process creates two packages: + +- `pkg-web-singlethreaded`: Standard WASM build +- `pkg-web-multithreaded`: WASM build with rayon-powered multithreading + +### iOS Builds + +```bash +# Generate iOS bindings +make ios + +# This will: +# 1. Build for aarch64-apple-ios-sim target +# 2. Generate Swift bindings using UniFFI +# 3. Output bindings to ios-bindings directory +```