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

hyli-noir

v0.3.0

Published

A library of noir programs used by Hyli.

Downloads

47

Readme

Hyli-noir

A TypeScript/JavaScript library providing Noir-based zero-knowledge proof functionality for the Hyli ecosystem. This library enables secure secret verification through cryptographic proofs without revealing sensitive information.

Features

  • 🔐 Zero-Knowledge Secret Verification: Generate proofs that demonstrate knowledge of a password without revealing it
  • 🛡️ Identity-Based Authentication: Combine user identity with password hashing for secure authentication
  • 📦 Blob Transaction Support: Create and manage blob transactions containing encrypted secrets
  • Noir Circuit Integration: Built on Noir's zero-knowledge proof system with UltraHonk backend
  • 🔧 TypeScript Support: Full TypeScript definitions and type safety

Installation

npm install hyli-noir

Peer Dependencies

This library requires the following peer dependencies:

npm install @aztec/[email protected] @noir-lang/[email protected] @noir-lang/[email protected]

Quick Start

import { check_secret } from 'hyli-noir';

// Hash a password
const hashedPassword = await check_secret.hash_password('my-secret-password');

// Generate identity hash
const identityHash = await check_secret.identity_hash('[email protected]', 'my-secret-password');

// Build a blob transaction
const blob = await check_secret.build_blob('[email protected]', 'my-secret-password');

// Generate a proof transaction
const proofTx = await check_secret.build_proof_transaction(
  '[email protected]',
  'my-secret-password',
  '0x1234567890abcdef...', // transaction hash
  0, // blob index
  1  // total blob count
);

API Reference

Core Functions

hash_password(password: string): Promise<Uint8Array>

Hashes a password using SHA-256.

Parameters:

  • password - The password string to hash

Returns: Promise resolving to a 32-byte Uint8Array containing the SHA-256 hash

identity_hash(identity: string, password: string): Promise<string>

Creates a combined hash of identity and password for authentication.

Parameters:

  • identity - The user's identity string
  • password - The user's password string

Returns: Promise resolving to a hex-encoded string of the combined hash

build_blob(identity: string, password: string): Promise<Blob>

Creates a blob transaction containing a secret derived from identity and password.

Parameters:

  • identity - The user's identity string
  • password - The user's password string

Returns: Promise resolving to a Blob object containing the encrypted secret

build_proof_transaction(identity, password, tx_hash, blob_index, tx_blob_count, circuit?): Promise<ProofTransaction>

Generates a zero-knowledge proof transaction demonstrating knowledge of the password.

Parameters:

  • identity - The user's identity string
  • password - The user's password string
  • tx_hash - The blob transaction hash string
  • blob_index - The index of the blob in the transaction
  • tx_blob_count - Total number of blobs in the transaction
  • circuit - Optional compiled Noir circuit (defaults to check_secret circuit)

Returns: Promise resolving to a ProofTransaction containing the generated proof

register_contract(node, circuit?): Promise<void>

Registers the Noir contract with the node if not already registered.

Parameters:

  • node - The NodeApiHttpClient instance
  • circuit - Optional compiled Noir circuit (defaults to check_secret circuit)

Utility Functions

assert(condition: boolean, message: string): void

Throws an error if the condition is false.

sha256(data: Uint8Array): Promise<Uint8Array>

Computes SHA-256 hash of the input data.

stringToBytes(input: string): Uint8Array

Converts a string to Uint8Array using UTF-8 encoding.

encodeToHex(data: Uint8Array): string

Converts Uint8Array to hex string representation.

How It Works

The library implements a zero-knowledge proof system for secret verification:

  1. Password Hashing: The user's password is hashed using SHA-256 to create a fixed-size secret
  2. Identity Combination: The identity is concatenated with the hashed password using a colon separator
  3. Final Hash: The combined value is hashed again to create the stored secret
  4. Proof Generation: A zero-knowledge proof is generated that demonstrates knowledge of the password without revealing it
  5. Verification: The proof can be verified against the stored hash without exposing the original password

Security Considerations

  • Passwords are never stored in plain text
  • The zero-knowledge proof system ensures password privacy
  • All cryptographic operations use industry-standard algorithms (SHA-256)
  • The system is designed to prevent replay attacks and unauthorized access

Development

Building Noir contract

In ./check-jwt/ folder if ./Prover.toml is present and well constructed

nargo execute

It builds and executes the circuit.

In ./check-secret/, to build without executing do

nargo build

Building library

bun run build

Publishing

bun run pub

License

MIT

Contributing

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

Support

For issues and questions:

Related Projects

  • Hyli - The main Hyli ecosystem
  • Noir - Zero-knowledge proof language