npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@waku/zerokit-rln-wasm

v0.3.0

Published

[![npm version](https://badge.fury.io/js/@waku%2Fzerokit-rln-wasm.svg)](https://badge.fury.io/js/@waku%2Fzerokit-rln-wasm) [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT) [![License: Apache 2.0](ht

Downloads

929

Readme

RLN for WASM

npm version License: MIT License: Apache 2.0

The Zerokit RLN WASM Module provides WebAssembly bindings for working with Rate-Limiting Nullifier RLN zkSNARK proofs and primitives. This module is used by waku-org/js-rln to enable RLN functionality in JavaScript/TypeScript applications.

Install Dependencies

[!NOTE] This project requires the following tools:

  • wasm-pack - for compiling Rust to WebAssembly
  • cargo-make - for running build commands
  • nvm - to install and manage Node.js

Ensure all dependencies are installed before proceeding.

Manually

Install wasm-pack

cargo install wasm-pack --version=0.13.1

Install cargo-make

cargo install cargo-make

Install Node.js

If you don't have nvm (Node Version Manager), install it by following the installation instructions.

After installing nvm, install and use Node.js v22.14.0:

nvm install 22.14.0
nvm use 22.14.0
nvm alias default 22.14.0

If you already have Node.js installed, check your version with node -v command — the version must be strictly greater than 22.

Or install everything

You can run the following command from the root of the repository to install all required dependencies for zerokit

make installdeps

Building the library

First, navigate to the rln-wasm directory:

cd rln-wasm

Compile zerokit for wasm32-unknown-unknown:

cargo make build

Running tests and benchmarks

cargo make test

If you want to run the tests in browser headless mode, you can use the following command:

cargo make test_browser

Parallel computation

The library supports parallel computation using the wasm-bindgen-rayon crate, enabling multi-threaded execution in the browser.

[!NOTE] Parallel support is not enabled by default due to WebAssembly and browser limitations.
Compiling this feature requires nightly Rust.

Build Setup

Install nightly Rust

rustup install nightly

Build Commands

To enable parallel computation for WebAssembly threads, you can use the following command:

cargo make build_parallel

WebAssembly Threading Support

Most modern browsers support WebAssembly threads, but they require the following headers to enable SharedArrayBuffer, which is necessary for multithreading:

  • Cross-Origin-Opener-Policy: same-origin
  • Cross-Origin-Embedder-Policy: require-corp

Without these, the application will fall back to single-threaded mode.

Feature detection

If you're targeting older browser versions that didn't support WebAssembly threads yet, you'll likely want to create two builds - one with thread support and one without - and use feature detection to choose the right one on the JavaScript side.

You can use wasm-feature-detect library for this purpose. For example, your code might look like this:

import { threads } from 'wasm-feature-detect';

let wasmPkg;

if (await threads()) {
  wasmPkg = await import('./pkg-with-threads/index.js');
  await wasmPkg.default();
  await wasmPkg.initThreadPool(navigator.hardwareConcurrency);
} else {
  wasmPkg = await import('./pkg-without-threads/index.js');
  await wasmPkg.default();
}

wasmPkg.nowCallAnyExportedFuncs();