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

@customyai/server

v0.4.1

Published

Customy identity verification for any server: JWKS with rotation, machine and user token verifiers, BFF actor assertions and request verification over the standard Request, with a Node IncomingMessage adapter. Server only.

Readme

@customyai/server

Verificación de identidad de Customy para cualquier servidor, sobre Request estándar y con adaptador para el IncomingMessage de Node. Es el mismo verificador que usan los productos de Customy. Solo servidor: la condición browser del paquete no exporta nada, así que importarlo desde un bundle de navegador rompe el build.

npm install @customyai/server
  • createRemoteJwks(uri): JWKS en caché con rotación — refresca al caducar la caché y cuando llega un kid desconocido (con cooldown), y aguanta una caída breve del issuer con las claves conocidas.
  • createMachineTokenVerifier({ issuer, audience }): tokens de máquina (client_credentials y token exchange con actor). Devuelve el principal con el tenant firmado o null.
  • createAccessTokenVerifier({ issuer, audience, organizationId, environmentId, requiredScopes, introspection }): tokens de usuario emitidos para una aplicación; la introspección opcional da revocación inmediata.
  • signActorAssertion / verifyActorAssertion: assertion HMAC de vida corta del BFF a la API, ligada a método, ruta y audiencia; la cookie del navegador nunca sale de la web.
  • verifyRequest(request, { bearer, assertion, requiredScopes }): exactamente una credencial por petición (Bearer o assertion); verifyIncomingMessage y requestFromIncomingMessage para Node. createRequestVerifier(options) comprueba la configuración al arrancar (un secreto de assertion ausente o de menos de 32 bytes lanza SDK_ASSERTION_SECRET_INVALID ahí, no en cada petición); createActorAssertionVerifier hace lo mismo para la assertion sola.
  • 401 frente a 503: un verificador devuelve null si el token no vale (→ 401) y lanza CustomySdkError con code: "ACCESS_UNAVAILABLE" (status: 503) si no puede decidir porque Access no responde: JWKS inalcanzable o sin claves utilizables pasado maxStaleMs, o introspección caída, 429 o 5xx. verifyRequest y verifyMachineRequest lo dejan pasar; isAccessUnavailable(error) lo reconoce.
  • Reloj: exp/nbf con clockToleranceSeconds (30 s); un iat en el futuro más allá de issuedAtSkewSeconds (60 s) se rechaza.
  • JWKS: cada clave se importa al cargar; una malformada no cuenta en kids ni se usa, y un JWKS sin ninguna utilizable es SDK_JWKS_INVALID.
import { createMachineTokenVerifier, isAccessUnavailable, verifyRequest } from "@customyai/server";

const bearer = createMachineTokenVerifier({ issuer: process.env.CUSTOMY_ISSUER!, audience: "customy-data" });

export async function handler(request: Request) {
  let auth;
  try {
    auth = await verifyRequest(request, { bearer, requiredScopes: ["data:collect"] });
  } catch (error) {
    if (isAccessUnavailable(error)) return new Response(null, { status: 503, headers: { "retry-after": "5" } });
    throw error;
  }
  if (!auth) return new Response(null, { status: 401 });
  // auth.kind === "bearer": auth.principal.organizationId, environmentId, scopes…
}