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

@haneinfo/m2m-api-key

v8.1.47

Published

Readme

Machine-to-machine API keys

Scope catalog

The grantable catalog comes from mounted REST @Scopes() declarations and App-provided M2M_SCOPE_SOURCES (ScopeSource[]). Concrete scopes use <resource>:<action>, split at the last colon. Each resource segment and the action must contain only [a-z0-9_-], with at least one character per segment. For example, users:read, haneinfo-reports:definition:read and haneinfo-reports:reports:data:read are valid when declared. Empty segments, whitespace, uppercase characters and embedded wildcards are rejected. Actions are not limited to read/write.

New grants must be declared concrete scopes, * (the existing global grant), or <resource>:* for a resource with at least one concrete catalog entry. A wildcard declaration alone does not establish a resource. Resource matching is exact: haneinfo-reports:definition:* matches haneinfo-reports:definition:read, whereas haneinfo-reports:* does not. The latter cannot be issued unless a concrete scope with resource exactly haneinfo-reports is declared.

list() returns sorted concrete scopes; describe() and groupOf() use the entire resource for App M2M_SCOPE_GROUPS display grouping. Key creation validates all grants; updates validate only newly added grants, preserving existing legacy scopes through unrelated edits. ScopeGuard and the SCOPE_MATCHER capability are for Web M2M REST API-key matching and delegate to plugin-api matchScope. MCP 4.x endpoints reject API keys (401 m2m_not_allowed) and enforce exact OAuth scope matching.

See the agent guide for App wiring and verification.

Acting user binding

Every API key must have an active bound service account (actingUserId pointing to a user with isActive === true and isServiceAccount === true) in addition to a valid key role. Both ApiKeyMachineStrategy and ApiKeyGuard reject keys with no bound user, an inactive bound user, or a non-service-account user with HTTP 401 Unauthorized (UnauthorizedException). Creating an API key requires actingUserId pointing to an active service account (400 Bad Request otherwise), and updating a key cannot clear actingUserId to null.

Authentication observation

Successful API key authentication records lastUsedAt asynchronously. Writes are throttled per key across processes using a conditional database update. The default interval is 60 seconds; set M2M_API_KEY_LAST_USED_INTERVAL_SECONDS to an integer from 0 to 86400 to change it (0 disables throttling). Invalid or absent values use 60 seconds. The timestamp can lag the latest successful authentication by up to the configured interval, plus asynchronous database delay; write failures are logged and retried on a later request. This timestamp is observational and does not determine authentication or authorization.