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 🙏

© 2026 – Pkg Stats / Ryan Hefner

dkls23-wasm

v0.1.1

Published

WASM bindings for DKLs23 threshold cryptography (t-of-n DKG/DSG) supporting both web and Node.js environments

Downloads

413

Readme

dkls23-wasm

WASM-bindgen wrapper for DKLs23, implementing threshold distributed key generation (DKG) and distributed signing (DSG) for Ethereum-compatible cryptography. Supports t-of-n threshold schemes (e.g., 2-of-2, 2-of-3, 3-of-5, etc.). This project compiles Rust code to WebAssembly for use in web browsers and Node.js.

Installation

npm install dkls23-wasm

Usage

In Web Browser

import init, { 
  dkg_start, 
  dkg_handle, 
  sign_start, 
  sign_handle,
  evm_address_from_sec1_pubkey_uncompressed 
} from 'dkls23-wasm';

// Initialize WASM module
await init();

// Use the DKG/DSG functions
const dkgResult = dkg_start(/* parameters */);
// ... your code here

In Node.js

import pkg from 'dkls23-wasm';

// Direct usage - no init() needed for Node.js
const dkgResult = pkg.dkg_start(/* parameters */);
const signResult = pkg.sign_start(/* parameters */);
// ... your code here

Explicit Target Import

// Force web version
import init, { dkg_start } from 'dkls23-wasm/web';
await init();

// Force Node.js version  
import pkg from 'dkls23-wasm/node';
pkg.dkg_start(/* parameters */);

API Functions

  • dkg_start(partyId, threshold, parties, domainLabel) - Start DKG process
    • threshold: Number of parties required for signing (t)
    • parties: Total number of parties (n)
    • partyId: This party's identifier (0-based)
  • dkg_handle(stateBlobJson, peerMsgJson) - Handle DKG messages/rounds
  • sign_start(keyshareB64, digest32B64, chainPath) - Start DSG process
  • sign_handle(stateBlobJson, peerMsgJson) - Handle DSG messages/rounds
  • evm_address_from_sec1_pubkey_uncompressed() - Convert public key to EVM address
  • init_panic_hook() - Initialize panic hook for debugging
  • wasm_memory_info() - Get WASM memory usage information

Threshold Configuration Examples

// 2-of-2: Both parties needed for signing
const result = pkg.dkg_start(0, 2, 2, 'my-domain');

// 2-of-3: Any 2 of 3 parties can sign
const result = pkg.dkg_start(0, 2, 3, 'my-domain'); 

// 3-of-5: Any 3 of 5 parties can sign  
const result = pkg.dkg_start(0, 3, 5, 'my-domain');

// 5-of-7: Any 5 of 7 parties can sign
const result = pkg.dkg_start(0, 5, 7, 'my-domain');

Development

Building

# Build both targets
npm run build

# Or use the build script
./build.sh

# Build specific targets
npm run build:web    # Build for web browsers
npm run build:node   # Build for Node.js

Testing

# Run Rust tests
cargo test

# Run WASM tests in browser
wasm-pack test --chrome --headless

# Run WASM tests in Node.js
wasm-pack test --node

Documentation

Components

Core Features

DKG (Distributed Key Generation)

Multi-round protocol for generating shared keypairs in t-of-n threshold schemes. Supports any threshold configuration (2-of-2, 2-of-3, 3-of-5, etc.).

DSG (Distributed Signing)

Multi-round protocol for threshold ECDSA signatures using generated keypairs. Only requires t parties to cooperate for signing.

Publishing to npm

Prerequisites

  1. Create an account on npmjs.com
  2. Login via CLI: npm login
  3. Ensure the package name is available: check on npmjs.com or run npm view dkls23-wasm

Build and Publish

# 1. Build the package
./build.sh

# 2. Update version in package.json if needed
npm version patch  # or minor/major

# 3. Publish to npm
npm publish

Publishing Checklist

  • [ ] Update package version
  • [ ] Update repository URLs in package.json and Cargo.toml
  • [ ] Build both web and Node.js targets
  • [ ] Test the package locally: npm link and test in another project
  • [ ] Publish: npm publish
  • [ ] Verify publication: npm view dkls23-wasm

Local Testing

# Link the package locally
npm link

# In another project
npm link dkls23-wasm

# Test both environments
node -e "import('dkls23-wasm').then(console.log)"  # Node.js
# Import in browser and test web version

Package Structure

The published package supports dual environments through exports:

  • Default: Automatically chooses web or Node.js based on environment
  • Web: import from 'dkls23-wasm/web' - for browsers
  • Node: import from 'dkls23-wasm/node' - for Node.js

Files included in npm package:

  • pkg-web/ - Web-optimized WASM and JS bindings
  • pkg-node/ - Node.js-optimized WASM and JS bindings
  • TypeScript definitions for both environments

License

MIT OR Apache-2.0