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

@stasiacarson/zk-diff

v1.2.3

Published

Zero-knowledge proofs for code changes

Readme

ZK-Diff

npm version

ZK-Diff is a tool that uses zero-knowledge proofs to verify code changes in Git repositories. It creates cryptographic proofs that demonstrate the relationship between your codebase before and after changes, without revealing the actual code.

Why Use ZK-Diff?

  • Verify Code Integrity: Ensure that changes to your codebase are legitimate and follow expected patterns
  • Prove Changes Without Revealing Code: Generate cryptographic proofs that verify the relationship between old and new code states without exposing the actual code
  • Git Integration: Seamlessly integrates with your Git workflow through pre-commit hooks
  • Powered by Sindri: Uses Sindri's zero-knowledge proof infrastructure for reliable and efficient proof generation

Installation

Global Installation (recommended for CLI usage)

# Install globally
npm install -g @stasiacarson/zk-diff

# If you encounter permission errors, you might need to use sudo
sudo npm install -g @stasiacarson/zk-diff

Local Installation (for project-specific usage)

# Install as a development dependency in your project
npm install --save-dev @stasiacarson/zk-diff

Getting Started

  1. Initialize ZK-Diff in your Git repository
# If installed globally
zk-diff install

# If installed locally
npx zk-diff install

This will:

  • Create a .env.local file for your Sindri API key
  • Set up Git hooks to automatically generate proofs for commits on the main branch
  • Configure the necessary zero-knowledge circuit
  1. Provide your Sindri API key

During installation, you'll be prompted to enter your Sindri API key. You can get a free API key by signing up at sindri.app.

Alternatively, you can set the SINDRI_API_KEY environment variable before running the install command.

How It Works

  1. Hashing: ZK-Diff generates cryptographic hashes of your codebase before and after changes
  2. Diffing: It computes the differences between the two states
  3. Proof Generation: Using Sindri's zero-knowledge infrastructure, it creates a proof that the new codebase hash can be derived from the old hash and the diff hash
  4. Verification: The proof can be verified without revealing the actual code

Commands

Install

zk-diff install

Sets up ZK-Diff in your Git repository.

Hash

zk-diff hash <directory>

Generates a cryptographic hash of the specified directory.

Diff

zk-diff diff <original-dir> <modified-dir>

Computes and hashes the differences between two directories.

Verify

zk-diff verify <original-dir> <modified-dir>

Generates a zero-knowledge proof that verifies the relationship between the original and modified directories.

Force Proof

zk-diff force-proof <original-dir> <modified-dir>

Similar to verify, but continues even if there's a hash mismatch.

Git Integration

ZK-Diff automatically sets up a pre-commit hook that generates proofs for commits on the main branch. This ensures that all changes to your main branch are cryptographically verified.

Requirements

  • Node.js 14 or higher
  • Git
  • A Sindri API key

Troubleshooting

First Commit

If you're making the first commit in a repository, ZK-Diff will automatically skip the proof generation since there's no previous state to compare against.

Permission Issues

If you encounter permission issues when installing or running ZK-Diff, try using sudo or follow the npm permission fix instructions:

sudo chown -R $(whoami) ~/.npm

License

MIT

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Circuit Versioning

ZK-Diff uses Sindri's circuit tagging system to ensure you always have access to the latest circuit version. When you install ZK-Diff, it will:

  1. Set up your environment to use the tagged circuit (zk-code-diff-verifier:latest)
  2. Use this tag directly when generating proofs, which Sindri automatically resolves to the latest version

This means you'll always benefit from circuit improvements without needing to update your configuration or code.