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

@veil_/x402-pqc

v1.0.2

Published

Quantum-resistant x402 payment protocol — ML-DSA-65 signing + ML-KEM-768 encryption + session mode

Downloads

453

Readme

@veil_/x402-pqc

Quantum-resistant x402 payment protocol. Drop-in for AI agents and developers who need post-quantum payment headers without trusting ECDSA.

x402-pqc replaces ECDSA with ML-DSA-65 for payment header signing and adds ML-KEM-768 for optional payment channel encryption. It is a superset of the x402 spec — x402-pqc headers contain all the same semantic fields, just quantum-resistant.

Two modes

| Mode | Handshake | Per-payment | Header size | Best for | |------|-----------|-------------|-------------|----------| | Base | — | ML-DSA-65 sign (≈3.3 KB) | ~14 KB (hex) | One-off payments, auditable | | Session | ML-DSA-65 × 2 + ML-KEM-768 | HMAC-SHA256 (~350 B) | < 500 B | High-frequency agent payments |

The session handshake (one-time cost) establishes a shared 32-byte key via ML-KEM-768. All subsequent payments in that session use HMAC-SHA256 — symmetric throughput comparable to plain HTTP headers.

Performance vs ECDSA (from x402-pqc spec)

| | ECDSA | x402-pqc base | x402-pqc session | |---|---|---|---| | Key size | 32 B | 1952 B (DSA pk) | session key 32 B | | Signature size | 64 B | 3309 B | 32 B (HMAC) | | Sign latency | ~0.1 ms | ~5 ms | <0.1 ms | | Quantum-safe | ✗ | ✓ | ✓ |

Install

npm install @veil_/x402-pqc

Quick start — agent payment in 5 lines

import { generatePQCKeypair } from '@veil_/pqc-wallet';
import { createX402PQCHeader, verifyX402PQCHeader } from '@veil_/x402-pqc';

const keypair = generatePQCKeypair();
const header = createX402PQCHeader({ amount: '0.01', recipient: '0xABCD…', network: 'base' }, keypair);
const result = verifyX402PQCHeader(header);
// result.valid === true, result.payer === keypair.address

Session mode — high-frequency payments

import { generatePQCKeypair } from '@veil_/pqc-wallet';
import { createSession, confirmSession, deriveSessionKey, createSessionPayment, verifySessionPayment } from '@veil_/x402-pqc';

// --- handshake (done once) ---
const payer  = generatePQCKeypair();
const payee  = generatePQCKeypair();

const sessionOpen   = createSession(payer, payee.publicKey.kem);
const confirmation  = confirmSession(sessionOpen, payee);
const sessionKey    = deriveSessionKey(sessionOpen, confirmation, payer.encapsulationKey);

// --- per-payment (HMAC only, < 500 B) ---
const header = createSessionPayment({ amount: '0.001', recipient: payee.address, network: 'base' }, sessionKey, sessionOpen.sessionId);
const result = verifySessionPayment(header, sessionKey);
// result.valid === true

Optional payload encryption

import { generatePQCKeypair } from '@veil_/pqc-wallet';
import { encryptPaymentMetadata, decryptPaymentMetadata } from '@veil_/x402-pqc';

const payee = generatePQCKeypair();
const enc = encryptPaymentMetadata({ invoiceId: 'inv-001', tags: ['api'] }, payee.publicKey.kem);
const dec = decryptPaymentMetadata(enc, payee.encapsulationKey);

Replay prevention

verifyX402PQCHeader checks the timestamp is within ±300 seconds of now.

For session payments, verifySessionPayment maintains an internal NonceStore to reject replays. For base headers you should deploy your own persistent store:

import { NonceStore } from '@veil_/x402-pqc';

const store = new NonceStore(600); // 10-minute TTL
// Before accepting a payment:
if (!store.checkAndStoreNonce(nonce)) throw new Error('replay detected');

Production note: NonceStore is in-memory. Multi-instance deployments must use a shared persistent store (Redis, Postgres) keyed by nonce.

Spec

Full specification: x402-pqc spec v0.1.0