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

@browserid-ng/nextauth

v0.2.1

Published

Drop-in 'Sign in with BrowserID' for Auth.js / NextAuth: a Credentials provider that verifies a BrowserID presentation server-side, plus browser helpers to drive the login dialog.

Readme

@browserid-ng/nextauth

Drop-in "Sign in with BrowserID" for Auth.js / NextAuth. A Credentials provider whose authorize() verifies a BrowserID presentation server-side at the hosted verifier (/verify, via @browserid-ng/verify) — no crypto in JS, fail-closed — plus tiny browser helpers that drive the login dialog. Works with Auth.js v5 (primary) and v4 (the provider is a plain options object, version-agnostic).

Server: add the provider

// auth.ts (Auth.js v5)
import NextAuth from "next-auth";
import Credentials from "next-auth/providers/credentials";
import { BrowserID } from "@browserid-ng/nextauth";

export const { handlers, signIn, signOut, auth } = NextAuth({
  providers: [
    Credentials(
      BrowserID({
        // REQUIRED: pin to your canonical origin. The presentation is
        // audience-bound; this is the confused-deputy guard. Never accept a
        // client-supplied audience.
        audience: "https://app.example.com",
      })
    ),
  ],
  callbacks: {
    // Carry the BrowserID claims (incl. statusRefs) onto the session so you
    // can re-check revocation later (see below).
    async jwt({ token, user }) {
      if (user?.browserid) token.browserid = user.browserid;
      return token;
    },
    async session({ session, token }) {
      session.browserid = token.browserid;
      return session;
    },
  },
});

Auth.js v4: providers: [CredentialsProvider(BrowserID({ audience }))] with import CredentialsProvider from "next-auth/providers/credentials". The BrowserID({...}) object is identical across versions.

Client: a sign-in button

"use client";
import { signIn } from "next-auth/react";
import { signInWithBrowserID } from "@browserid-ng/nextauth/client";

export function SignInButton() {
  async function login() {
    const presentation = await signInWithBrowserID({ siteName: "My App" });
    await signIn("browserid", { presentation, redirectTo: "/" });
  }
  return <button onClick={login}>Sign in with BrowserID</button>;
}

Prefer the observer style? Call watchBrowserID({ onlogin }) once at page init and requestBrowserID() on click — both from @browserid-ng/nextauth/client.

Revocation-aware sessions (recommended)

A NextAuth session outlives the ~5-minute presentation, but a BrowserID warrant/cert is revocable. Re-check on session activity and sign out if revoked:

import { browseridSessionValid } from "@browserid-ng/nextauth";

// in a middleware / server action, on activity:
const { ok } = await browseridSessionValid(session.browserid.statusRefs);
if (!ok) await signOut(); // fail-closed: revoked OR unverifiable => out

API

  • BrowserID(config) → Auth.js Credentials-provider options.
  • browseridAuthorize(config) → the standalone authorize function (for custom wiring / testing).
  • browseridSessionValid(statusRefs, opts?) → { ok, revoked }, fail-closed.
  • Client (@browserid-ng/nextauth/client): loadBrowserID, watchBrowserID, requestBrowserID, logoutBrowserID, signInWithBrowserID.

config: audience (required), broker (default https://browserid.me), verifierUrl (default ${broker}/verify), acceptedFallbacks. The user's browserid.grantee is the actor of record — it differs from email when a named agent acted on the user's behalf; compare them for delegation policy. There is no human/agent flag (see the @browserid-ng/verify README).

Reference app: examples/nextauth-app/. Design: docs/plans/2026-08-10-nextauth-adapter-build-spec.md. MPL-2.0.