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

clearcrypt

v1.0.0

Published

Client-side, zero-knowledge file encryption core. This repository provides an auditable cryptographic core for encrypting and decrypting files locally using a password-based model. No plaintext, secrets, or keys are ever stored or transmitted. Includes a

Downloads

10

Readme

clearcrypt

Client-side, zero-knowledge file encryption core. This repository provides an auditable cryptographic core for encrypting and decrypting files locally using a password-based model. No plaintext, secrets, or keys are ever stored or transmitted. Includes a versioned, self-describing file format.

Requirements

  • Node.js 24 or newer.

Public API (stable)

The stable API surface is:

  • encryptBytesV1(plaintext, password, options?)
  • decryptBytesV1(data, password)

All other modules are internal and may change.

Install

Published package:

npm install clearcrypt

Local dev (from repo):

npm install
npm run build

Usage

Encrypt and decrypt bytes:

import { encryptBytesV1, decryptBytesV1 } from "clearcrypt";

const plaintext = new TextEncoder().encode("hello");
const password = "secret";

const encrypted = await encryptBytesV1(plaintext, password);
const decrypted = await decryptBytesV1(encrypted, password);

console.log(new TextDecoder().decode(decrypted));

Encrypt and decrypt a file (Node):

import { readFileSync, writeFileSync } from "node:fs";
import { encryptBytesV1, decryptBytesV1 } from "clearcrypt";

const input = readFileSync("input.txt");
const encrypted = await encryptBytesV1(new Uint8Array(input), "secret");
writeFileSync("input.txt.cc", encrypted);

const decrypted = await decryptBytesV1(encrypted, "secret");
writeFileSync("decrypted.txt", decrypted);

Web integration constraints

  • Current API is buffer-based (Uint8Array in / Uint8Array out). It is not a streaming API.
  • For browser UI apps (Angular, React, etc.), run crypto operations in a Web Worker to avoid blocking the main thread.
  • For very large files, enforce UI size limits until a streaming API is introduced.

API reference

encryptBytesV1(
  plaintext: Uint8Array,
  password: Uint8Array | string,
  options?: V1EncryptOptions
): Promise<Uint8Array>

decryptBytesV1(
  data: Uint8Array,
  password: Uint8Array | string
): Promise<Uint8Array>

Options

encryptBytesV1 accepts optional overrides:

  • nonce: 12 bytes (AES-GCM nonce)
  • salt: 16 bytes (KDF salt)
  • wrapNonce: 12 bytes (wrap nonce for DEK)
  • kdf: { timeCost, memoryCost, parallelism }

If not provided, secure random values are generated.

Errors

API functions throw ClearcryptError with a short message and a code. Codes:

  • INVALID_PARAMS: input sizes are wrong (nonce/salt/wrapNonce).
  • INVALID_FORMAT: data is not a valid or supported V1 format.
  • AUTH_FAILED: wrong password or data was tampered with.
  • CRYPTO_FAILED: encryption failed for an unexpected reason.

Example:

import { decryptBytesV1, ClearcryptError } from "clearcrypt";

try {
  const plaintext = await decryptBytesV1(encrypted, "password");
} catch (err) {
  if (err instanceof ClearcryptError) {
    console.error(err.code, err.message);
  } else {
    throw err;
  }
}

Format note

The V1 file format is self-describing. Header/AAD fields are stored in cleartext but authenticated. The payload remains encrypted.

Compatibility

The API uses WebCrypto-compatible primitives and runs in modern browsers and Node.js 24+.

Release process

Run these steps on Node.js 24+ before publishing:

npm run release:check
npm run release:publish

release:check runs tests, build, and npm pack --dry-run to verify the package contents.