Skip to main content

SDK installation

npm package

npm install openac-sdk

Current version in repository: 0.1.0 (wallet-unit-poc/openac-sdk/package.json).

Platform notes

PlatformNotes
BrowserShip WASM + smaller verifying keys to the client; mind download size (see key table in SDK README).
NodeSame WASM; ensure fetch / performance globals exist (Node 18+).
iOS / AndroidNative PoC uses Flutter + Rust (wallet-unit-poc/mobile/); the npm SDK targets JS runtimes.

WASM + assets

From wallet-unit-poc/openac-sdk:

npm install
npm run build:wasm # needs Rust + wasm-pack per script
npm run build

Witness + R1CS files are gitignored under assets/; populate from your Circom build/ outputs per SDK README.

Proving keys

Proving keys are generated offline by the Rust CLI (ecdsa-spartan2):

cd wallet-unit-poc/ecdsa-spartan2
cargo run --release -- prepare setup --size 1k --input ../circom/inputs/jwt/1k/default.json
cargo run --release -- show setup --size 1k --input ../circom/inputs/show/default.json

The --size flag selects the JWT-payload variant (1k, 2k, 4k, 8k). Verifying keys are small (≈ 3 MB) and safe to bundle; proving keys are large — plan distribution accordingly:

SizePrepare PKPrepare VKShow PKShow VKTotal per credential
1k258 MB258 MB3 MB3 MB~522 MB
2k427 MB427 MB3 MB3 MB~860 MB
4k811 MB811 MB3 MB3 MB~1.6 GB
8k1.6 GB1.6 GB3 MB3 MB~3.2 GB

(Source: wallet-unit-poc/openac-sdk/README.md; regenerate locally with the commands above to verify.) For browser wallets, fetch only the VK pair plus the PK matching your worst-case JWT length; for server-side verification, the VK pair alone is sufficient.

Native backend (optional)

NativeBackend wraps the Rust CLI for environments where WASM proving is undesirable — see export in index.ts and tests under tests/native-backend.test.ts.