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

@taceo/oprf-core

v0.4.0

Published

Threshold OPRF client core: BabyJubJub, hash-to-curve, Chaum-Pedersen ZKP, FROST-style distributed proofs

Readme

@taceo/oprf-core

Threshold OPRF client core: BabyJubJub curve, hash-to-curve, Chaum-Pedersen ZKP, and FROST-style distributed proofs.

This package provides the cryptographic primitives for building oblivious pseudo-random function (OPRF) clients in the TACEO threshold OPRF protocol.

Installation

pnpm add @taceo/oprf-core

Usage

Basic OPRF Operations

import {
  blindQuery,
  unblindResponse,
  finalizeOutput,
  randomBlindingFactor,
  prepareBlindingFactor,
} from '@taceo/oprf-core';

// 1. Generate a random blinding factor
const beta = randomBlindingFactor();

// 2. Blind the query before sending to server
const query = 12345n;
const blindedQuery = blindQuery(query, beta);

// 3. [Server evaluates OPRF and returns blindedResponse]

// 4. Unblind the server response
const prepared = prepareBlindingFactor(beta);
const unblinded = unblindResponse(blindedResponse, prepared);

// 5. Finalize the OPRF output
const domainSeparator = 0n;
const output = finalizeOutput(domainSeparator, query, unblinded);

Hash-to-Curve

import { encodeToCurve } from '@taceo/oprf-core';

// Maps a field element to a BabyJubJub curve point
const point = encodeToCurve(12345n);

DLog Equality Proofs (Chaum-Pedersen)

import {
  dlogEqualityProof,
  dlogEqualityVerify,
  BABYJUBJUB_SUBGROUP_GENERATOR_AFFINE,
} from '@taceo/oprf-core';

// Prove that log_G(pk) = log_B(R) without revealing the secret
const proof = dlogEqualityProof(secretKey, baseG, publicKey, baseB, responseR);
dlogEqualityVerify(proof, publicKey, baseB, responseR, baseG);

Distributed DLog (FROST-style)

import { DLogCommitmentsShamir, DLogSessionShamir } from '@taceo/oprf-core';

// Combine commitments from multiple parties
const combined = DLogCommitmentsShamir.combineCommitments(
  commitments,
  contributingParties
);

// Combine proof shares into a single verifiable proof
const proof = combined.combineProofs(requestId, proofShares, publicKey, base);

Shamir Secret Sharing

import { lagrangeFromCoeff, reconstruct } from '@taceo/oprf-core';

// Compute Lagrange coefficients for interpolation
const coeffs = lagrangeFromCoeff(contributingParties);

// Reconstruct a secret from shares
const secret = reconstruct(shares, contributingParties);

API

OPRF Operations (oprfClient)

  • randomBlindingFactor(): BlindingFactor — sample random non-zero scalar
  • prepareBlindingFactor(beta): PreparedBlindingFactor — compute inverse for unblinding
  • blindQuery(query, beta): AffinePoint — blind query as encode_to_curve(query) × β
  • unblindResponse(response, prepared): AffinePoint — unblind as response × β⁻¹
  • finalizeOutput(domainSeparator, query, unblinded): bigint — hash via Poseidon2 (2Hash-DH)
  • finalizeQuery(query, response, beta, domainSeparator): bigint — convenience: unblind + finalize

Curve & Field

  • babyjubjub — BabyJubJub twisted Edwards curve from @noble/curves
  • G — prime-order subgroup generator
  • Fr — scalar field (subgroup order)
  • Fq — base field
  • BABYJUBJUB_SUBGROUP_GENERATOR_AFFINE — generator as affine point
  • encodeToCurve(input): Point — hash-to-curve via Elligator2 + rational map
  • babyJubJubAffineToCompressedBytes(point): Uint8Array — compressed serialization

DLog Equality

  • dlogEqualityProof(...): DLogEqualityProof — create Chaum-Pedersen proof
  • dlogEqualityVerify(...): void — verify proof (throws InvalidProofError)
  • challengeHash(...): bigint — Fiat-Shamir challenge via Blake3

Distributed DLog (Shamir)

  • DLogCommitmentsShamir — combines partial commitments from threshold parties
  • DLogSessionShamir — manages a distributed proof session
  • lagrangeFromCoeff(parties): bigint[] — Lagrange interpolation coefficients
  • reconstruct(shares, parties): bigint — reconstruct secret from shares

License

MIT