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

@vouchington/oauth-server

v0.7.0

Published

Generic OAuth 2.0 authorization-server building blocks with injected stores (RFC 6749, 7591, 7636, 8414).

Readme

@vouchington/oauth-server

Framework-agnostic OAuth 2.0 authorization-server building blocks: RFC 6749 (code and refresh grants), RFC 7591 (dynamic client registration), RFC 7636 (PKCE, S256 only), RFC 7009 (revocation), RFC 8414 / 9728 (metadata), RFC 8707 (resource indicators), and RFC 9207 (iss on responses).

The package never touches HTTP frameworks or databases. The application injects:

  • ClientStore / ClientRegistry — client lookup (return only active, eligible clients) and creation.
  • GrantStore — authorization-code and refresh-token persistence. redeemAuthorizationCode and redeemRefreshToken run the package's verification callback inside the adapter's own transaction and lock; the adapter persists the returned tokens and spends the secret atomically, flags reuse with replayed: true, and decides what a replay or failed attempt revokes.
  • HashSecret — one-way hash for client secrets, codes, and tokens. Only hashes reach the stores.
  • ScopePolicy — a ScopeCatalog from @vouchington/utils/scopes plus the catalog surface.
  • resolveResource — maps a resource URL to { url, audience } or null.
  • Consent, retention, ownership, rate limiting, and request routing.
import {
  exchangeTokenGrant,
  parseClientAuthentication,
  parseFormBody,
} from '@vouchington/oauth-server'

const form = parseFormBody(contentType, body)
const credentials = parseClientAuthentication(authorizationHeader, form)
const tokens = await exchangeTokenGrant(form, credentials, { clients, grants, scopes, hashSecret })

Errors are OAuthProtocolError; buildOAuthErrorResponse(error) renders the RFC 6749 section 5.2 body, status, and WWW-Authenticate challenge. Redirect URIs match by exact string, except RFC 8252 loopback registrations that omit the port. Secret and PKCE comparisons are timing-safe.

IssuedTokens.scopes are the access-token scopes (narrowed when a refresh request narrows them); persist IssuedTokens.refreshScopes on the rotated refresh token so the grant is never narrowed. Authorization state is capped at 1024 characters; pass maxStateLength to validateAuthorizationRequest and authorizationErrorRedirect to change it. Default metadata endpoints ignore trailing slashes on the issuer. buildOAuthErrorResponse quotes the realm and throws a TypeError when it contains control characters.