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

@hanzo/iam

v0.6.1

Published

TypeScript SDK for Hanzo IAM — OIDC auth, JWT validation, OAuth2 PKCE, user/org/project APIs

Downloads

3,295

Readme

@hanzo/iam

TypeScript SDK for Hanzo IAM — identity & access management built on Casdoor.

Features

  • JWT Validation — OIDC discovery + JWKS-based signature verification via jose
  • OAuth2 PKCE — Browser-side login flows (redirect, popup, silent signin)
  • API Client — Users, organizations, OIDC discovery, token exchange
  • Billing — Subscriptions, plans, pricing, payments, orders
  • TypeScript — Full type safety with exported interfaces
  • Zero Config — Auto-discovers endpoints via .well-known/openid-configuration

Install

npm install @hanzo/iam
# or
pnpm add @hanzo/iam

Server-Side Usage

Validate a JWT

import { validateToken } from "@hanzo/iam";

const result = await validateToken(accessToken, {
  serverUrl: "https://iam.hanzo.ai",
  clientId: "my-app",
});

if (result.ok) {
  console.log(result.userId, result.email, result.owner);
} else {
  console.error(result.reason);
}

API Client

import { IamClient } from "@hanzo/iam";

const client = new IamClient({
  serverUrl: "https://iam.hanzo.ai",
  clientId: "my-app",
  clientSecret: process.env.IAM_CLIENT_SECRET,
});

// OAuth2 authorization URL
const authUrl = await client.getAuthorizationUrl({
  redirectUri: "https://myapp.com/callback",
  state: "random-state",
});

// Exchange code for tokens
const tokens = await client.exchangeCode({
  code: "auth-code",
  redirectUri: "https://myapp.com/callback",
});

// Get user info
const user = await client.getUserInfo(tokens.access_token);

Billing

import { IamBillingClient } from "@hanzo/iam";

const billing = new IamBillingClient({
  serverUrl: "https://iam.hanzo.ai",
  clientId: "my-app",
  clientSecret: process.env.IAM_CLIENT_SECRET,
  orgName: "my-org",
});

const { active, subscription, plan } = await billing.isSubscriptionActive("my-org");

Browser Usage (SPA)

import { BrowserIamSdk } from "@hanzo/iam";

const iam = new BrowserIamSdk({
  serverUrl: "https://iam.hanzo.ai",
  clientId: "my-spa",
  redirectUri: "https://myapp.com/auth/callback",
});

// Start login
await iam.signinRedirect();

// On callback page
const tokens = await iam.handleCallback();

// Get a valid token (auto-refreshes if expired)
const token = await iam.getValidAccessToken();

// Fetch user info
const user = await iam.getUserInfo();

// Logout
iam.clearTokens();

Sub-path Imports

// Server-side JWT validation only (lighter import)
import { validateToken } from "@hanzo/iam/auth";

// Browser PKCE flows only
import { BrowserIamSdk } from "@hanzo/iam/browser";

// Billing only
import { IamBillingClient } from "@hanzo/iam/billing";

// Types only
import type { IamConfig, IamUser } from "@hanzo/iam/types";

Configuration

| Option | Required | Description | |--------|----------|-------------| | serverUrl | Yes | IAM server URL (e.g. https://iam.hanzo.ai) | | clientId | Yes | OAuth2 client ID | | clientSecret | No | Client secret (server-side confidential clients) | | orgName | No | Organization name for scoped queries | | appName | No | Application name |

Documentation

Full docs: docs.hanzo.ai/services/iam/sdk

License

MIT — Hanzo AI