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

@withnen/core-crypto

v0.4.0

Published

Nen core cryptographic engine (ML-KEM + ChaCha20)

Readme

Core Crypto (core-crypto)

The foundation of Nen: the Post-Quantum Cryptography primitives, written in Rust and compiled to WebAssembly via wasm-bindgen. The @withnen/client and @withnen/server packages depend on the generated Wasm in pkg/.

🧠 Primitives (all from the audited RustCrypto crates)

| Crate | Role | | :-- | :-- | | ml-kem | ML-KEM-768 key encapsulation (FIPS 203) | | ml-dsa | ML-DSA-65 identity signatures (FIPS 204) | | chacha20poly1305 | AEAD payload encryption (RFC 8439) | | hmac + sha2 | HMAC-SHA256 per-request authentication (FIPS 198-1) | | base64 | Wire encoding inside the Wasm boundary |

Source files

  • src/kem.rs — ML-KEM keypair generation, encapsulate, decapsulate.
  • src/cipher.rs — ChaCha20-Poly1305 encrypt/decrypt, nonce generation.
  • src/hmac_auth.rs — HMAC-SHA256 sign/verify.
  • src/sig.rs — ML-DSA-65 keygen, sign, verify (optional identity).
  • src/encoding.rs — base64 encode/decode (nen_to_base64 / nen_from_base64).
  • src/utils.rs — shared helpers / error types.
  • src/lib.rs — the Wasm entry point; functions annotated with #[wasm_bindgen].

🛠 Compilation

# From inside packages/core-crypto/
./build.sh

build.sh runs wasm-pack for both targets and writes them to the repo-root pkg/:

  • pkg/node/ — Node.js/serverless target (used by @withnen/server).
  • pkg/bundler/ — ESM bundler target (used by @withnen/client).

Both SDKs depend on these via "core-crypto": "file:../../pkg/bundler". The release profile is size-optimized (opt-level = "z", lto, strip, wasm-opt -Oz).

🧪 Tests

cargo test   # 16 tests: KEM round-trip, AEAD tamper detection, HMAC, signatures, base64

🧑‍💻 Adding a primitive

  1. Add the crate to Cargo.toml.
  2. Implement it in a new src/*.rs module.
  3. Expose it from src/lib.rs with #[wasm_bindgen]:
    #[wasm_bindgen]
    pub fn my_new_hash(data: &[u8]) -> Vec<u8> { /* … */ }
  4. Rebuild with ./build.sh and add a #[test].
  5. Import it from a TypeScript package: import { my_new_hash } from 'core-crypto';

The wire format is specified in ../../PROTOCOL.md — keep changes in sync.