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

@santi020k/auth-machine

v0.6.0

Published

Scoped bearer credentials for non-interactive machine clients.

Readme

@santi020k/auth-machine

Scoped bearer credentials for non-interactive agents, MCP clients, scheduled jobs, and server-to-server API calls. This package does not replace browser sessions or OAuth. It gives a consuming application a small resource-server primitive for private automation clients that can supply a bearer token from a secret store.

import { parseMachineCredentials, resolveMachineBearer } from "@santi020k/auth-machine";

const credentials = parseMachineCredentials(env.MACHINE_AUTH_CREDENTIALS);
const principal = await resolveMachineBearer(request, credentials);

Applications with a database or secret service can resolve exactly one validated identifier asynchronously instead of loading an entire credential inventory:

const principal = await resolveMachineBearer(request, async (credentialId) => {
  return credentialStore.findByCredentialId(credentialId);
});

The authorization header, token, and 80-character credential identifier are bounded before the resolver or security event listener runs. Resolver errors and invalid stored records fail closed as credential_resolution_failed events; raw authorization values and provider error details are never forwarded.

Generate a credential once with createMachineCredential, including a required expiry and at least one explicit scope. Store only its returned record in the server's secret configuration. Deliver the raw token once to the client's secret manager or environment-variable injection path. Never place the raw token in source, plugin archives, logs, screenshots, or reusable agent definitions.

Every credential has a stable ID, opaque subject, display name, creation time, required expiry, explicit scopes, and a SHA-256 token digest. Optional notBefore and revokedAt timestamps support bounded activation and immediate or scheduled revocation. Pass onSecurityEvent to resolveMachineBearer for redacted success and rejection events; listener failures never alter authentication behavior.

revokeMachineCredential() is idempotent and retains audit metadata. rotateMachineCredential() requires an explicit retirePreviousAt, creates a cryptographically random replacement token, and returns the old record with its scheduled retirement. Use an overlap only when the consumer's rollout requires it. listMachineCredentialInventory() omits token digests for operator surfaces. An injectable entropy source exists for deterministic tests; production code should use the default crypto.getRandomValues implementation.

Consumers remain responsible for persistence, choosing scopes, limiting which routes accept machine authentication, delivering raw tokens through a secret manager such as Infisical, authorizing rotation, and storing audit events. Never log, commit, or place a raw token in screenshots or reusable agent definitions.