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

@ecies/post-quantum

v0.0.1

Published

Post-quantum Cryptography Integrated Encryption Scheme in TypeScript

Readme

@ecies/post-quantum

License NPM Package NPM Downloads Bundle size CI Codecov

Post-quantum Cryptography Integrated Encryption Scheme in TypeScript, replacing "ec" in eciesjs with ML-KEM (Module-Lattice Key Encapsulation Mechanism).

Install

npm install @ecies/post-quantum

Quick start

// example/runtime/main.js
import { DEFAULT_CONFIG, decrypt, encrypt } from "@ecies/post-quantum";

const encoder = new TextEncoder();
const decoder = new TextDecoder();
const msg = encoder.encode("hello world🌍");

const { secretKey, publicKey } = DEFAULT_CONFIG.asymmetricModule.keygen();
const encrypted = encrypt(publicKey, msg);
const decrypted = decrypt(secretKey, encrypted);

console.log(decoder.decode(decrypted));

Or run the example code:

$ pnpm install && pnpm build && cd example/runtime && pnpm install && node main.js
hello world🌍

API

encrypt(receiverPK: Uint8Array, data: Uint8Array, config?: Config): Uint8Array

Parameters:

  • receiverPK - Raw public key of the receiver
  • data - Data to encrypt
  • config - Configuration options, default to DEFAULT_CONFIG

Returns: Uint8Array

decrypt(receiverSK: Uint8Array, data: Uint8Array, config?: Config): Uint8Array

Parameters:

  • receiverSK - Raw private key of the receiver
  • data - Data to decrypt
  • config - Configuration options, default to DEFAULT_CONFIG

Returns: Uint8Array

Configuration

Following configurations are available.

  • Asymmetric key encapsulation algorithm: ML-KEM-512, ML-KEM-768 or ML-KEM-1024
  • Symmetric cipher algorithm: AES-256-GCM or XChaCha20-Poly1305
  • Symmetric nonce length: 12 or 16 bytes (only for AES-256-GCM)
export type AsymmetricAlgorithm = "ml-kem-512" | "ml-kem-768" | "ml-kem-1024";
export type SymmetricAlgorithm = "aes-256-gcm" | "xchacha20";
export type NonceLength = 12 | 16; // aes-256-gcm only

export class Config {
  asymmetricAlgorithm: AsymmetricAlgorithm = "ml-kem-768";
  symmetricAlgorithm: SymmetricAlgorithm = "aes-256-gcm";
  symmetricNonceLength: NonceLength = 16; // aes-256-gcm only
}

export const DEFAULT_CONFIG = new Config();

Which configuration should I choose?

About KEM, because ML-KEM creates a bunch of extra data (respectively 768, 1088, 1568 bytes) in payload, you can just use the NIST recommended default ML-KEM-768 (see FIPS 203, p40). If you need extra security, use ML-KEM-1024.

About symmetric ciphers, if you are running on low-end devices or you are a security paranoid, XChaCha20-Poly1305 is a better choice than AES-256-GCM.

Multi-platform Support

| | Fully Supported | | ------------ | --------------- | | Node | ✅ | | Bun | ✅ | | Deno | ✅ (see below) | | Browser | ✅ | | React Native | ✅ |

Via @ecies/ciphers, node:crypto's native implementation of AES-256-GCM and XChaCha20-Poly1305 is chosen if available.

Browser

This library is browser-friendly, check the example/browser directory for details. You can check the online demo as well.

Bun/Deno

For bun/deno, see example/runtime.

For deno, you may need to run with deno run --conditions deno (>=2.4.0) or deno run --unstable-node-conditions deno (>=2.3.6,<2.4.0).

React Native

You may need to polyfill crypto.getRandomValues for React Native.

Changelog

See CHANGELOG.md.