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

quick-jwt

v1.0.2

Published

Minimal ES256 JWT signer and verifier that pulls public keys from your JWKS endpoint.

Downloads

228

Readme

quick-jwt

Minimal ES256 JWT signer/verifier that pulls public keys from your JWKS endpoint. No custom claims, no middlemen—just subjects, issuers, and keys.

Highlights

  • Opinionated: ES256 only, compact JWTs, subjects-only payloads
  • JWKS native: verification fetches https://<iss>/.well-known/jwks.json
  • Type-safe: bundled TypeScript defs for IntelliSense/IntelliCode
  • Shipping ready: tests + micro-benchmark via npm test

Install

npm install quick-jwt

Requires Node 18+ (for native fetch and WebCrypto).

Quick start

import { generateKeyset } from "zeyra";
import { JWT } from "quick-jwt";

const kid = "2025Q4";
const issuer = "api.example.com";
const subject = "user-123";

// Generate ES256 keys (P-256)
const { privateJwk, publicJwk } = await generateKeyset();

// Create & sign a token (exp is seconds from now or an epoch in ms)
const token = await JWT.sign(
  privateJwk,
  new JWT(kid, issuer, subject, 60) // 60 seconds from now
);

// In production, serve your JWKS at:
//   https://api.example.com/.well-known/jwks.json
// For tests/local dev, mock fetch with your public key:
global.fetch = async () => ({
  ok: true,
  json: async () => ({ keys: [{ kid, ...publicJwk }] }),
});

const verifiedSub = await JWT.verify(token);
console.log(verifiedSub); // "user-123" when valid, otherwise false

API

  • new JWT(kid, iss, sub, exp)
    • kid: key identifier that must match the JWK served in your JWKS
    • iss: issuer domain (no protocol)
    • sub: stable subject identifier
    • exp: either seconds from now (e.g. 60) or an absolute epoch in milliseconds
  • JWT.sign(privateJwk, jwt) -> Promise<string>
    • Signs the JWT with an ES256 private JWK (P-256). kid should be set on the key.
  • JWT.verify(token) -> Promise<string | false>
    • Fetches the issuer JWKS, selects the matching kid, verifies the signature and expiration, and returns the subject when valid.

JWKS example

Serve the public key that matches your kid:

{
  "keys": [
    {
      "kid": "2025Q4",
      "kty": "EC",
      "crv": "P-256",
      "x": "…",
      "y": "…",
      "key_ops": ["verify"]
    }
  ]
}

Tests and benchmarks

  • Run tests + micro-benchmark: npm test
  • Benchmark only: npm run bench
  • Tweak iterations: BENCH_ITERS=500 npm run bench

Example output:

quick-jwt benchmark (lower ms is better)
task     iterations  total (ms)  avg (ms)  ops/sec
sign     150         80.5        0.5368    1863
verify   150         78.3        0.5219    1916

IntelliSense

Type definitions ship with the package (types/index.d.ts), so editors and TypeScript projects get completions, parameter help, and return types out of the box.

Notes

  • Claims other than iss, sub, iat, and exp are intentionally excluded—keep authorization decisions at the resource layer.
  • Make sure your JWKS is cache-friendly and rotates keys by updating both the kid in new tokens and the published key set.