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

@betorigami/provably-fair

v0.2.0

Published

A TypeScript framework designed to deterministically generate and independently verify Provably Fair game outcomes using cryptographic proofs, verifiable randomness, and deterministic replay logic to ensure transparency and auditability.

Readme

🎲 Provably Fair

A TypeScript framework designed to deterministically generate and independently verify Provably Fair game outcomes using cryptographic proofs, verifiable randomness, and deterministic replay logic to ensure transparency and auditability.

✨ Features

  • ✅ Verifiable randomness generated via ECVRF ensuring cryptographic integrity
  • 🔐 Robust public/private key proof system enabling independent outcome verification
  • 🔁 Deterministic replay mechanism supporting reproducible game sessions
  • 🔄 Generation of unique, non-repeating random numbers preventing manipulation
  • 🧹 Modular and extensible architecture facilitating rigorous security reviews and compliance

📦 Installation

npm install @betorigami/provably-fair

🧠 Core Concepts

Seed Generation

A deterministic seed is generated using the following values:

  • gameId: A unique identifier used to identify the game being played.
  • tenantId: A unique identifier representing the tenant serving the game.
  • tenantUserId: A unique identifier for the tenant's user participating in the game.
  • nonce: An incrementing counter that changes with every completed game round to ensure uniqueness.
  • clientSeed: A user-supplied value that introduces user-controlled entropy into the outcome.

This combination guarantees that each seed is unique and reproducible for every game session, enabling transparent and consistent randomness.

Proof Generation and Verification

  • The generated seed is cryptographically signed using the server's private key to produce a proofString.
  • This proof can be independently verified using the corresponding public key, ensuring the integrity of the randomness.
  • The verified proof then seeds a deterministic random byte generator (hashSequence), which drives the game outcome.

📚 Standards and Cryptographic Foundations

This Provably Fair SDK adheres strictly to the Elliptic Curve Verifiable Random Function (ECVRF) specification as defined in the IETF draft draft-irtf-cfrg-vrf-15. The ECVRF protocol provides a rigorous, cryptographically secure method for generating verifiable randomness.

Key Points of the Specification

  • Provable Unpredictability: The VRF output is unpredictable without the private key, ensuring fair randomness.
  • Verifiability: Each random output includes a proof verifiable with the public key, preventing tampering.
  • Deterministic: The VRF output is deterministic for a given input and private key, enabling reproducible audits.

Implementation Details

While this SDK itself is written in TypeScript, the core cryptographic operations leverage the fastcrypto Rust library (documented here) via NAPI-RS, which compiles Rust code into Node.js binaries:

  • This integration provides a secure, high-performance ECVRF implementation.
  • Rust's memory safety and fastcrypto's cryptographic rigor ensure robustness.
  • Using NAPI-RS allows seamless Node.js interoperability without sacrificing security or speed.

🔒 Security Notes

  • The private key must never be exposed to clients or external systems.
  • Result generation using the private key should occur exclusively on secure server environments.
  • The public key is safe for client-side use to independently verify game outcomes.
  • All generated results are deterministic, verifiable, and tamper-proof, providing a strong audit trail and ensuring fairness.