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

@agnostic-cloud/identity

v0.1.0

Published

Unified JWT/OIDC token verification with automatic JWKS caching for Google Identity Platform, AWS Cognito, Azure Entra ID, and Okta

Readme

@agnostic-cloud/identity

Unified Cloud Identity, JWT & OIDC Token Verification (Data Plane), and User Management & Administration (Control Plane) across AWS Cognito, Google Cloud / Firebase Auth, Microsoft Entra ID (Azure AD), Okta, and Generic OIDC providers.

Features

  • 🚀 Sub-Millisecond Token Verification: Zero cloud SDK dependencies for runtime token verification, powered by the lightweight jose standard library and WebCrypto.
  • ⚡ In-Memory JWKS Key Caching: Automatic key rotation, single-flight request coalescing, and 5-second cooldown throttling to protect against cache thrashing/DoS.
  • 👥 Full User Management (identity.admin): Agnostic user creation, profile updates, password resets, suspension, activation, and directory listing across AWS, GCP, Azure, and Okta.
  • 🛡️ Hardened Security (RFC 8725): Immune to alg: none, Asymmetric-to-Symmetric Key Confusion, jku/x5u injection, multi-tenant issuer spoofing, and claim prototype pollution.
  • 🌐 Universal HTTP Middleware: First-class support for Node.js HTTP (IncomingMessage), Web API (Request), Express, Next.js, and Cloudflare Workers.
  • 🔄 Zero-Code-Change Cloud Migration: Switch identity providers seamlessly by simply modifying the configuration.

Installation

npm install @agnostic-cloud/identity

Quick Start

1. Data Plane: Token Verification & HTTP Authentication

import { createIdentity } from '@agnostic-cloud/identity'

// Initialize identity strategy (AWS Cognito example)
const identity = createIdentity({
  cloud: 'aws',
  userPoolId: 'us-east-1_example123',
  region: 'us-east-1',
  clientId: 'my-app-client-id',
})

// Verify raw JWT string
const user = await identity.verifyToken(token)
console.log('User:', user.id, user.email, user.roles)

// Authenticate incoming HTTP request
export async function GET(request: Request) {
  const user = await identity.authenticateRequest(request, {
    requiredRoles: ['admin'],
  })
  return Response.json({ message: `Hello ${user.displayName || user.email}` })
}

2. Control Plane: User Administration (identity.admin)

// Create a new user
const newUser = await identity.admin.createUser({
  email: '[email protected]',
  password: 'StrongPassword123!',
  displayName: 'Dev User',
  roles: ['engineer', 'operator'],
})

// Look up user
const user = await identity.admin.getUserByEmail('[email protected]')

// Update password
await identity.admin.updateUserPassword(user.id, 'NewStrongPassword456!')

// Suspend / Disable account
await identity.admin.disableUser(user.id)

// Delete account
await identity.admin.deleteUser(user.id)

Providers Configuration

AWS Cognito

const identity = createIdentity({
  cloud: 'aws',
  userPoolId: 'us-east-1_xyz123',
  region: 'us-east-1',
  clientId: 'app-client-id',
  adminConfig: {
    credentials: { accessKeyId: '...', secretAccessKey: '...' },
  },
})

Google Cloud / Firebase Auth

const identity = createIdentity({
  cloud: 'gcp',
  projectId: 'my-firebase-project',
  flavor: 'firebase', // or 'google-oidc'
  adminConfig: {
    apiKey: '...', // or bearerToken
  },
})

Microsoft Entra ID (Azure AD)

const identity = createIdentity({
  cloud: 'azure',
  tenantId: '00000000-0000-0000-0000-000000000000', // or 'common' for multi-tenant
  clientId: 'api://my-api-audience',
  adminConfig: {
    bearerToken: '...',
  },
})

Okta

const identity = createIdentity({
  cloud: 'okta',
  domain: 'dev-12345.okta.com',
  audience: 'api://default',
  adminConfig: {
    apiToken: '...',
  },
})

Error Handling

All errors extend CloudError:

import {
  TokenExpiredError,
  UnauthorizedError,
  UserAlreadyExistsError,
  UserNotFoundError,
} from '@agnostic-cloud/identity'

try {
  await identity.admin.createUser({ email: '[email protected]', password: '...' })
} catch (err) {
  if (err instanceof UserAlreadyExistsError) {
    console.error('Email already registered')
  }
}

License

MIT