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

@qudag/napi-core

v0.1.0

Published

N-API bindings for QuDAG quantum-resistant DAG and cryptography

Readme

@qudag/napi-core

High-performance N-API bindings for QuDAG quantum-resistant cryptography and DAG consensus.

Features

  • ML-DSA (CRYSTALS-Dilithium): Quantum-resistant digital signatures at security level 3
  • ML-KEM (CRYSTALS-Kyber): Quantum-resistant key encapsulation (ML-KEM-768)
  • HQC: Hamming Quasi-Cyclic encryption at multiple security levels
  • Quantum Fingerprints: Data integrity verification using quantum-resistant hashing
  • QuantumDAG: Simplified DAG with vertex management

Installation

npm install @qudag/napi-core

Requirements

  • Node.js >= 18.0.0
  • Native bindings for your platform (automatically installed)

Quick Start

ML-DSA Digital Signatures

const { MlDsaKeyPair } = require('@qudag/napi-core');

// Generate a key pair
const keypair = MlDsaKeyPair.generate();

// Sign a message
const message = Buffer.from('Hello, quantum world!');
const signature = keypair.sign(message);

// Verify the signature
const publicKey = keypair.toPublicKey();
const isValid = publicKey.verify(message, signature);
console.log('Signature valid:', isValid); // true

ML-KEM Key Exchange

const { MlKem } = require('@qudag/napi-core');

// Generate a key pair
const { publicKey, secretKey } = MlKem.keygen();

// Encapsulate a shared secret
const { ciphertext, sharedSecret: ss1 } = MlKem.encapsulate(publicKey);

// Decapsulate to recover the shared secret
const ss2 = MlKem.decapsulate(secretKey, ciphertext);

// Secrets match!
console.log('Match:', Buffer.compare(ss1, ss2) === 0); // true

Quantum Fingerprints

const { QuantumFingerprint } = require('@qudag/napi-core');

// Generate a fingerprint
const data = Buffer.from('Important data');
const fingerprint = QuantumFingerprint.generate(data);

// Verify data integrity
const isValid = fingerprint.verify(data);
console.log('Data valid:', isValid); // true

QuantumDAG

const { QuantumDAG } = require('@qudag/napi-core');

async function example() {
  const dag = new QuantumDAG();

  // Add messages to the DAG
  const id1 = await dag.addMessage(Buffer.from('First message'));
  const id2 = await dag.addMessage(Buffer.from('Second message'));

  // Get current tips
  const tips = await dag.getTips();
  console.log('DAG tips:', tips);

  // Check vertex count
  const count = await dag.vertexCount();
  console.log('Vertices:', count);
}

example();

API Documentation

ML-DSA Classes

MlDsaKeyPair

  • static generate(): Generate a new key pair
  • publicKey(): Get public key bytes (Uint8Array)
  • publicKeyHex(): Get public key as hex string
  • sign(message: Buffer): Sign a message
  • signDeterministic(message: Buffer): Sign deterministically (testing only)
  • toPublicKey(): Convert to MlDsaPublicKey

MlDsaPublicKey

  • static fromBytes(bytes: Buffer): Create from bytes
  • static fromHex(hex: string): Create from hex string
  • asBytes(): Get public key bytes
  • asHex(): Get public key as hex
  • verify(message: Buffer, signature: Buffer): Verify a signature
  • static batchVerify(messages, signatures, publicKeys): Batch verification

ML-KEM Class

MlKem

  • static keygen(): Generate a key pair
  • static encapsulate(publicKey): Encapsulate a shared secret
  • static decapsulate(secretKey, ciphertext): Decapsulate a shared secret
  • static getInfo(): Get algorithm information

Quantum Fingerprint

QuantumFingerprint

  • static generate(data: Buffer): Generate a fingerprint
  • static fromBytes(bytes: Buffer): Create from bytes
  • asBytes(): Get fingerprint bytes
  • asHex(): Get fingerprint as hex
  • verify(data: Buffer): Verify data

QuantumDAG

QuantumDAG

  • constructor(): Create a new DAG
  • addVertex(vertex): Add a vertex
  • addMessage(payload): Add a message (returns vertex ID)
  • getTips(): Get current tips
  • containsVertex(id): Check if vertex exists
  • vertexCount(): Get number of vertices
  • getVertex(id): Get vertex by ID

Performance

N-API bindings provide near-native performance:

  • ML-DSA signing: ~1.3ms (< 8% overhead vs native Rust)
  • ML-DSA verification: ~0.85ms (< 6% overhead)
  • ML-KEM encapsulation: ~0.19ms (< 6% overhead)
  • ML-KEM decapsulation: ~0.23ms (< 5% overhead)

Platform Support

Pre-built binaries are available for:

  • Linux x64 (glibc, musl)
  • Linux ARM64 (glibc, musl)
  • macOS x64 (Intel)
  • macOS ARM64 (Apple Silicon)
  • Windows x64

Building from Source

# Clone the repository
git clone https://github.com/ruvnet/QuDAG
cd QuDAG/packages/napi-core

# Install dependencies
npm install

# Build the package
npm run build

# Run tests
npm test

Security Considerations

  • Key Management: Store secret keys securely and never expose them
  • Randomness: Uses cryptographically secure random number generation
  • Side-Channel Resistance: Constant-time operations for cryptographic primitives
  • Memory Safety: Automatic zeroization of secret key material
  • Quantum Resistance: All algorithms are NIST-standardized post-quantum cryptography

License

MIT OR Apache-2.0

Contributing

See CONTRIBUTING.md in the main repository.

Links