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

@xignet/core

v0.1.0

Published

Framework-independent Xignet JWT, OAuth and OIDC integration.

Readme

@xignet/core

Framework-independent Xignet verification and authorization code + PKCE login for Node.js 22.22+ and 24. The Payload adapter and website integration are tracked in the implementation plan.

import { createTokenVerifier, hasAllScopes } from '@xignet/core';

const verifier = createTokenVerifier({
  issuer: 'https://xignet.marxbio.tech',
  audience: 'https://cms.example.com/api/mcp',
  jwksUri: process.env.XIGNET_JWKS_URI!,
});
const result = await verifier.verifyAccessToken(accessToken);
if (!result.ok) {
  // invalid_token: reject the credential. verification_unavailable: fail
  // closed and report service availability separately. Do not echo reasons.
} else if (hasAllScopes(result.identity, ['cms:access', 'cms:read'])) {
  // Resolve a local principal by (issuer, subject), then apply local access.
}

Create one verifier per process/resource. Configuration is trusted, fixed server configuration; issuer and JWKS must never come from an unverified token. HTTPS is required. allowInsecureLoopback: true permits HTTP only on loopback hosts for local fixtures/development. Clock tolerance defaults to 60 seconds and must be an integer from 0 to 300.

VerifiedIdentity contains issuer, subject, clientId, deduplicated scopes, expiresAt (Unix seconds) and verified claims. The same verifier exposes verifyIdToken(token, clientId) with the same failure categories and a successful claims result; it shares the JWKS cache but checks the ID-token client audience. No local role is inferred. The identity and parsed scopes are frozen. Claims are shallowly frozen; consumers must not mutate nested application claims or use them as a substitute for local authorization.

The legacy JwtVerifier, result types and createScopeVocabulary are exported for Nest compatibility. Their existing contracts remain unchanged, including the caller's responsibility for configuration validation. New consumers should use createTokenVerifier. The existing vocabulary's configurable default actions are not an admission rule: check admission scopes separately.

OAuth metadata and challenges

@xignet/core/oauth exports createProtectedResourceMetadata, protectedResourceMetadataUrl, createBearerChallenge and their types. Configure the canonical resource; do not derive it from an untrusted Host header. For https://cms.example.com/api/mcp, discovery is at https://cms.example.com/.well-known/oauth-protected-resource/api/mcp.

createBearerChallenge accepts a resource, requiredScopes and optional invalid_token or insufficient_scope error. Scope values are checked against the OAuth scope-token grammar. A local authorization refusal should not advertise missing OAuth scopes when the token already has them.

Interactive OIDC

import { createOidcClient } from '@xignet/core/oidc';

const client = createOidcClient({
  issuer, audience, jwksUri,
  clientId: 'cms-web',
  redirectUri: 'https://cms.example.com/auth/xignet/callback',
  scopes: ['openid', 'email'],
  admissionScopes: ['cms:access'],
});
const { authorizationUrl, transaction } = await client.begin();
// Server adapter: encrypt and authenticate the entire transaction in a
// short-lived HttpOnly browser-bound cookie, then redirect to authorizationUrl.
const result = await client.complete({ callbackUrl, transaction });
// Resolve result.identity to a local user. ID-token claims accompany it.
// Clear the transaction cookie on success AND failure; create a local session.

The transaction contains the secret PKCE verifier and must never be sent to application JavaScript, URL query parameters, plaintext/signed-only cookies or logs. complete assumes its adapter obtained the entire transaction from authenticated encrypted storage, not from callback query/body. It validates state, expiry, callback, client/issuer/resource binding, both token signatures and audiences, the access-token client and admission scopes, and matching token subjects. It returns verified identity and ID-token claims, without retaining or exposing the token response. The authorization server's single-use code prevents successful callback replay; clearing a stateless cookie alone is not server-side replay storage.

This public-client flow requires openid, excludes offline_access, uses S256 PKCE and has no nonce parameter. Network calls do not follow redirects. OidcError separates protocol refusals from verification_unavailable; its optional detail carries only machine-readable verification diagnostics, never tokens or response bodies. discovery/transport errors use the separately exported LoginDiscoveryError and LoginTransportError. Unexpected process defects propagate. Endpoint discovery is cached until restart after success and retried after failure.

The login-state helpers exported from /oidc preserve the existing Nest wire format and are low-level compatibility primitives. Their LoginState payload is NOT the full LoginTransaction; Payload adapters must not attempt to serialize a transaction with sealLoginState.

Packaging and release

CommonJS require and ESM imports are supported, including TypeScript consumers with legacy Node resolution via typesVersions. The repository builds core before checking dependent packages. Publish core before a Nest release that depends on it. Configure npm trusted publishing for core-publish.yml before pushing the first release tag; no publication is triggered by this implementation PR.

Run pnpm --filter @xignet/core test for real local HTTP JWKS/OIDC tests. pnpm test also exercises existing Nest and client consumers.