JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1607
  • Score
    100M100P100Q117914F
  • License GPL-3.0-or-later WITH Classpath-exception-2.0

WebAssembly bindings for the Parity `verifiable` crate

Package Exports

  • verifiablejs/bundler
  • verifiablejs/nodejs
  • verifiablejs/pkg-bundler/verifiablejs_bg.js

Readme

Verifiable JS

This package provides JavaScript/TypeScript bindings for the Parity Verifiable crate.

Features

  • Generate proofs of membership in a set with known members
  • Validate proofs
  • Sign and verify messages
  • All cryptographic operations are performed using the Bandersnatch curve implementation

Installation

npm install verifiablejs

Usage

For bundler environments (Webpack, Vite, Rollup, etc.)

import init, { one_shot, validate, sign, verify_signature, member_from_entropy } from 'verifiablejs/bundler';

// Initialize the WASM module
await init();

// Generate a proof
const entropy = new Uint8Array(32); // Your entropy bytes
const members = new Uint8Array(...); // Your encoded members list
const context = new TextEncoder().encode("my-context");
const message = new TextEncoder().encode("my-message");

const result = one_shot(entropy, members, context, message);
const { proof, alias, member } = result;

// Validate a proof
const validatedAlias = validate(proof, members, context, message);

// Sign a message
const signature = sign(entropy, message);

// Verify a signature
const isValid = verify_signature(signature, message, member);

For Node.js or Bun

import init, { one_shot, validate, sign, verify_signature, member_from_entropy } from 'verifiablejs/nodejs';

// Initialize the WASM module
await init();

// Use the same API as above

Building

npm run build

This builds both bundler and Node.js targets:

  • wasm-pack build --release --target bundler --features small-ring
  • wasm-pack build --release --target nodejs --features small-ring

Testing

npm test

This will run both Rust and WASM tests:

  • cargo test --features "small-ring"
  • wasm-pack test --node --features small-ring

Releasing

This project uses Changesets for version management.

  1. Create a changeset: pnpm changeset (select bump type: patch/minor/major)
  2. Version bump: pnpm version (consumes changesets, updates package.json and CHANGELOG.md)
  3. Publish: pnpm release (builds and publishes to npm)

License

Licensed under GPL-3.0-or-later WITH Classpath-exception-2.0