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

@aptos-labs/confidential-assets-bindings

v0.0.6

Published

Bindings for Aptos confidential assets (discrete log + range proofs)

Readme

@aptos-labs/confidential-assets-bindings

Bindings for Aptos confidential assets (discrete log + range proofs).

Installation

npm install @aptos-labs/confidential-assets-bindings

Usage

No initialization required — WASM is loaded automatically on first use, from local node_modules in Node.js or from the versioned unpkg CDN in browsers.

Discrete Log

Solves discrete logarithms on the Ristretto255 curve for 16-bit and 32-bit secrets. Used to decrypt confidential asset balances.

import { solveDiscreteLog } from "@aptos-labs/confidential-assets-bindings";

// y is a compressed Ristretto point (32 bytes): y = g^x
// maxNumBits must be 16 or 32
const x: bigint = await solveDiscreteLog(y, 32);

Range Proofs

Zero-knowledge range proofs using Bulletproofs. Proves a value lies in [0, 2^numBits) without revealing it.

import {
  rangeProof,
  batchRangeProof,
  verifyProof,
  batchVerifyProof,
} from "@aptos-labs/confidential-assets-bindings";

// r is a 32-byte blinding scalar
// valBase and randBase are 32-byte compressed Ristretto points (Pedersen bases)
// numBits must be 8, 16, 32, or 64 (default: 32)
const { proof, commitment } = await rangeProof({ v, r, valBase, randBase, numBits });

const valid = await verifyProof({ proof, comm: commitment, valBase, randBase, numBits });

// Batch variants
const { proof: batchProof, commitments } = await batchRangeProof({ v: values, rs: blindings, valBase, randBase, numBits });

const batchValid = await batchVerifyProof({ proof: batchProof, comms: commitments, valBase, randBase, numBits });

Cross-Version Compatibility

Range proofs are generated with bulletproofs v5.0.0 but are verifiable by bulletproofs v4.0.0, which is the version used in aptos-core. This is covered by tests in rust/core/tests/cross_version_compat.rs.

Algorithm Selection

The discrete log algorithm is selected at compile time via Cargo features. Only one feature can be active at a time.

| Feature | Table Size | WASM Size | Notes | |---------|-----------|-----------|-------| | tbsgs_k (default) | ~512 KiB | ~774 KiB | Recommended: best size/performance ratio | | bsgs_k | ~2.0 MiB | ~2.1 MiB | Faster but larger | | bsgs | ~2.0 MiB | ~2.1 MiB | Standard BSGS | | bl12 | ~258 KiB | ~268 KiB | Smallest but slower |

To build with a different algorithm:

npm run build:wasm -- --no-default-features --features bl12

To compare sizes across all variants:

./scripts/wasm-sizes.sh

Repository Structure

confidential-assets-bindings/
├── rust/
│   ├── core/           # Pure Rust: discrete log + range proof logic
│   └── wasm/           # wasm-bindgen bindings wrapping core
├── scripts/
│   └── wasm-sizes.sh   # Build all variants and compare WASM sizes
├── build/              # Intermediate wasm-pack output (gitignored)
├── dist/               # Final npm artifacts
└── tsdown.config.ts    # JS bundler configuration

Building

Requires mise (or manually: Node 22, Rust 1.84+, wasm-pack).

# Install toolchain versions
mise install

# Build WASM then bundle JS/CJS/types
npm run build

# Build only the WASM
npm run build:wasm

# Bundle JS from existing WASM build
npm run build:js

Testing

# Run all Rust tests (includes cross-version compatibility)
cargo test --manifest-path rust/Cargo.toml --workspace

License

Apache-2.0