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

@polyjose/wasm

v0.2.0

Published

polyjose for Web (WASM): JOSE (JWS, JWE, JWK, JWT) in pure Rust compiled to WebAssembly, for browsers, Node.js and Cloudflare Workers.

Readme

@polyjose/wasm

polyjose for Web (WASM). JSON Object Signing and Encryption (JWS, JWE, JWK, JWT) from the pure-Rust polyjose core, compiled to WebAssembly. The same package runs in browsers, Web Workers, Node.js and Cloudflare Workers.

  • Pure Rust cryptography (RustCrypto and dalek crates). There's no OpenSSL, ring or aws-lc, and the package has no runtime npm dependencies.
  • Misuse-resistant. Verify and decrypt need an explicit allow-list of algorithms, and none is never accepted (RFC 8725).
  • The same API as @polyjose/node. You can switch between them by changing the import.

Install

npm install @polyjose/wasm

Import

The package is ESM, and exports picks the right entry for browsers, Node.js and Cloudflare Workers:

import { jwtSign, jwtVerify } from "@polyjose/wasm";

On Node.js 22.12 or later, CommonJS code can require("@polyjose/wasm") through require(esm). Every function returns a Promise; the WebAssembly module loads on the first call, never at import time.

Quick start

Sign a JWT, then verify it with an explicit algorithm allow-list and the issuer and audience you expect. exp is required and checked, with 60 seconds of leeway (RFC 8725 §3.8 to §3.10).

import { jwkGenerateForAlg, jwkToPublic, jwtSign, jwtVerify, PolyjoseError } from "@polyjose/wasm";

// An ES256 key pair. The verifier needs only the public half.
const privateKey = await jwkGenerateForAlg("ES256");
const publicKey = await jwkToPublic(privateKey);

const now = Math.floor(Date.now() / 1000);
const token = await jwtSign(
  { iss: "https://issuer.example", sub: "user-123", aud: "https://api.example", exp: now + 300 },
  privateKey,
  { alg: "ES256" },
);

try {
  const verified = await jwtVerify(token, publicKey, {
    allowedAlgs: ["ES256"], // never trust the token's own `alg` (RFC 8725 §3.1)
    issuers: ["https://issuer.example"],
    audiences: ["https://api.example"],
  });
  console.log(verified.claims.sub); // "user-123"
} catch (err) {
  if (err instanceof PolyjoseError) console.error(err.code); // e.g. "TokenExpired"
  else throw err;
}

Encrypt to a recipient's public key, then decrypt, naming the algorithms you accept:

import { jweDecryptCompact, jweEncryptCompact, jwkGenerateEc, jwkToPublic } from "@polyjose/wasm";

const recipientKey = await jwkGenerateEc("P-256");
const recipientPublicKey = await jwkToPublic(recipientKey);

const jwe = await jweEncryptCompact(new TextEncoder().encode("top secret"), {
  enc: "A256GCM",
  recipients: [{ alg: "ECDH-ES+A256KW", key: recipientPublicKey }],
});

const decrypted = await jweDecryptCompact(jwe, recipientKey, {
  allowedAlgs: ["ECDH-ES+A256KW"],
  allowedEnc: ["A256GCM"],
});
console.log(new TextDecoder().decode(decrypted.plaintext)); // "top secret"
decrypted.plaintext.fill(0); // results are plain data: wipe secret bytes, and never log them

In a browser, serve polyjose_wasm_bg.wasm byte for byte, and allow script-src 'wasm-unsafe-eval' in a Content Security Policy. Heavy calls, such as PBES2 with a high iteration count, run on the calling thread, so call them from a Web Worker.

Documentation

License

MIT; see LICENSE. THIRD-PARTY-NOTICES.txt lists the Rust crates compiled into polyjose_wasm_bg.wasm, with their licenses.