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

easy-pqc-wrapper

v0.1.0

Published

A user-friendly wrapper for Post-Quantum Cryptography (ML-KEM/Kyber)

Readme

easy-pqc-wrapper

Build Status License: MIT

A simple, user-friendly wrapper for Post-Quantum Cryptography (PQC), specifically targeting the ML-KEM (Kyber) key encapsulation mechanism. Powered by the reliable @noble/post-quantum library.

Features

  • Easy to use: Intuitive API for generating key pairs, encapsulating secrets, and decapsulating secrets.
  • Post-Quantum Secure: Uses ML-KEM-768 (standardized to FIPS 203).
  • Flexible Encodings: Built-in support for Buffer / Uint8Array, base64, and hex strings so you can easily send data over the network.
  • Modern TypeScript: Fully typed for a great DX.

Installation

You need to install this wrapper along with its peer/underlying library.

npm install easy-pqc-wrapper

Quick Start (Alice & Bob)

The Key Encapsulation Mechanism (KEM) is designed to let two parties (Alice and Bob) exchange a secure Shared Secret over a public network.

import { EasyPQC } from 'easy-pqc-wrapper';

// ---------------------------------------------------------
// 1. ALICE
// ---------------------------------------------------------
// Alice generates her key pair (automatically on instantiation)
const alice = new EasyPQC();

// She exports her public key to send to Bob. 
// Options: 'buffer' (default), 'base64', or 'hex'
const alicePublicKey = alice.getPublicKey('base64');


// ---------------------------------------------------------
// 2. BOB
// ---------------------------------------------------------
// Bob receives Alice's public key. 
// He uses it to generate a shared secret AND a ciphertext.
const bob = new EasyPQC();

// We must tell the encapsulate method what encoding the public key uses.
const { ciphertext, sharedSecret: bobSecret } = bob.encapsulate(alicePublicKey, 'base64');

// Bob sends the `ciphertext` back to Alice over the network...


// ---------------------------------------------------------
// 3. ALICE
// ---------------------------------------------------------
// Alice receives the ciphertext from Bob.
// She uses her private key to decapsulate it and recover the exact same secret.
// Because the ciphertext returned by encapsulate is a Uint8Array, we don't need
// to provide an encoding parameter to decapsulate here unless we encode it first.
const aliceSecret = alice.decapsulate(ciphertext);

// Proof that the secrets match:
console.log(Buffer.from(aliceSecret).equals(Buffer.from(bobSecret))); // true

API Reference

new EasyPQC(keys?: KeyPair)

Creates a new instance. If you don't supply a KeyPair, it automatically generates one for you using ML-KEM-768.

getPublicKey(format: 'buffer' | 'base64' | 'hex' = 'buffer')

Returns the generated public key in your desired format. Note: 'buffer' actually returns a Uint8Array.

encapsulate(publicKey: string | Uint8Array, encoding?: 'base64' | 'hex')

Generate a newly encapsulated shared secret using someone else's public key. Returns an object: { ciphertext: Uint8Array, sharedSecret: Uint8Array }.

decapsulate(ciphertext: string | Uint8Array, encoding?: 'base64' | 'hex')

Decapsulate a received ciphertext using your own private key. Returns the sharedSecret: Uint8Array.

EasyPQC.encapsulate(publicKey, encoding?)

A static helper method if you just want to act like "Bob" (generating the shared secret from a public key) without needing to instantiate a full object for yourself.

License

MIT