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

@civic/auth-verify

v0.0.4

Published

JWT verification library for Civic Auth

Readme

@civic/auth-verify

JWT verification library for Civic Auth tokens using JWKS endpoint discovery.

Features

  • JWT token verification using JWKS endpoint discovery
  • OIDC configuration discovery (.well-known/openid-configuration)
  • Built-in caching for JWKS data with issuer-based keys
  • Support for multiple cache implementations (InMemory and Bundled)
  • TypeScript support with full type safety

Installation

pnpm add @civic/auth-verify

Usage

Basic Usage

import { verify } from '@civic/auth-verify';

// Verify a token with default settings (uses Civic Auth issuer)
const payload = await verify(token);
console.log(payload);

Using a Custom Cache

By default, the library uses an in-memory cache for JWKS data. You can provide your own cache implementation if needed.

In the in-memory cache, keys are stored in memory and lost when the process restarts. The library uses a shared default instance across all verify calls unless you provide your own.

If you want to control the lifecycle of the cache, provide your own as follows:

import { verify, InMemoryJWKSCache } from '@civic/auth-verify';

// Create a custom cache instance
const cache = new InMemoryJWKSCache();

// Use the cache for verification
const payload = await verify(token, {
  jwksCache: cache
});

Using a "Bundled Cache" (Pre-loaded Civic Auth JWKS)

The Bundled Cache is a key cache pre-populated with Civic Auth JWKS keys, useful for offline verification or reduced latency.

  • Pre-loaded keys: Contains the latest Civic Auth JWKS bundled at build time
  • Offline support: Can verify Civic Auth tokens without any network requests
  • Performance: Eliminates the initial JWKS fetch for Civic Auth tokens
  • Updates: The bundled JWKS is updated when the package is built/published
  • Extensible: Can still fetch and cache JWKS for other issuers dynamically

Note: The bundled JWKS is specific to Civic Auth keys. If using another issuer, you can still use the InMemoryJWKSCache or implement your own cache.

import { verify, BundledJWKSCache } from '@civic/auth-verify';

// Use bundled cache with pre-downloaded Civic Auth JWKS
const cache = new BundledJWKSCache();

const payload = await verify(token, {
  jwksCache: cache
});

API

verify(token: string, options?: VerifyOptions): Promise<JWTPayload>

Verifies a JWT token and returns its payload.

Parameters

  • token - The JWT token to verify
  • options - Optional verification options
    • issuer - The token issuer URL (defaults to Civic Auth)
    • wellKnownConfigurationUrl - Custom OpenID configuration URL
    • jwksCache - Custom JWKS cache implementation
    • aud - Expected audience value for the token (optional)
    • clientId - Expected client ID value for the token (optional). If provided, the JWT must contain this value in either the client_id or tid field

Returns

A promise that resolves to the JWT payload.

Development

# Install dependencies
pnpm install

# Run tests
pnpm test

# Build
pnpm build

# Lint
pnpm lint