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

@sigid/react

v0.1.0

Published

React hooks for SigID authentication

Readme

@sigid/react

React primitives for SigID browser authentication.

Install

npm install @sigid/client @sigid/react

Provider

Create a browser client with @sigid/client, then inject it into SigIdProvider:

"use client";

import { createSigIdClient } from "@sigid/client";
import { SigIdProvider } from "@sigid/react";

const sigid = createSigIdClient({
  baseURL: "https://auth.example.com",
  oauth: {
    clientId: "public-client-id",
    redirectUri: `${window.location.origin}/oauth/callback`,
    scopes: ["openid", "profile", "email"],
  },
});

export function Providers({ children }: { children: React.ReactNode }) {
  return <SigIdProvider client={sigid}>{children}</SigIdProvider>;
}

UI State

import {
  SignedIn,
  SignedOut,
  SignInButton,
  SignOutButton,
  useSession,
  useUser,
} from "@sigid/react";

export function AccountPanel() {
  const { session, isLoading, error, refresh } = useSession();
  const { user } = useUser();

  if (error) return <p>{error.message}</p>;

  return (
    <>
      <span>{isLoading ? "Checking session" : session ? "Signed in" : "Signed out"}</span>
      <SignedOut>
        <SignInButton returnTo="/protected">Start hosted login</SignInButton>
      </SignedOut>
      <SignedIn>
        <pre>{JSON.stringify({ user, session: session?.session }, null, 2)}</pre>
        <button onClick={() => void refresh()} disabled={isLoading}>
          Refresh session
        </button>
        <SignOutButton>Logout</SignOutButton>
      </SignedIn>
    </>
  );
}

Callback

Keep the callback page explicit so setup and OAuth errors are visible:

"use client";

import { useEffect } from "react";
import { useSigId } from "@sigid/react";

export function CallbackPage() {
  const { handleCallback } = useSigId();

  useEffect(() => {
    void handleCallback();
  }, [handleCallback]);

  return <p>Completing callback</p>;
}

Protected UI And API Calls

Protected is a client-side UX guard. It does not replace backend authorization. Protected API routes still need server-side access-token validation.

import { Protected, SignInButton, useSigId } from "@sigid/react";

function ProtectedContent() {
  const { fetchWithAuth } = useSigId();

  return (
    <button onClick={() => void fetchWithAuth("/api/protected")}>
      Call protected API
    </button>
  );
}

export function ProtectedPage() {
  return (
    <Protected
      signedOut={<SignInButton returnTo="/protected">Start hosted login</SignInButton>}
      returnTo="/protected"
    >
      <ProtectedContent />
    </Protected>
  );
}

Security Boundary

SigIdProvider exposes safe user/session state, loading flags, errors, and imperative helpers. It does not put access tokens, refresh tokens, ID tokens, client secrets, admin/service tokens, webhook secrets, or SCIM tokens into React state.

Use fetchWithAuth() for API transport. It attaches Bearer or DPoP authorization headers according to the configured SigIdClient. Do not render, stringify, log, or store raw tokens in UI state.