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

@zanii/broker

v0.1.0

Published

The credential broker that closes Zanii's stated custody hole: the agent never holds raw API keys - the broker does, and it injects them ONLY into calls that produced a receipt first. Receipt-or-nothing, fail-closed (ledger unreachable = no call), credent

Readme

@zanii/broker

The credential broker that closes Zanii's stated custody hole. Every package's limits section ends the same way: "an agent still holding raw credentials can act off the rails." This replaces detection with one invariant:

The agent never holds the credential. The broker does — and it injects it ONLY into calls that produced a receipt first.

npm install @zanii/broker @zanii/core
import { createBroker } from '@zanii/broker';

const broker = createBroker({
  credentials: {
    openai: { inject: 'bearer', secret: process.env.OPENAI_KEY!, allow: ['https://api.openai.com/v1'] },
    maps:   { inject: 'query', name: 'key', secret: process.env.MAPS_KEY!, allow: ['https://maps.googleapis.com/'] },
  },
  // MUST reject unless the receipt is durably accepted — record + flush + check:
  record: async (f) => {
    await agent.record({ target: f.target, payload: f.payload });
    const results = await agent.flush();
    if (results.some((r) => !r.ok)) throw new Error('receipt not accepted');
  },
  gate: (req) => policy.evaluate(req).decision !== 'deny',   // optional @zanii/policy hook
});

// the agent asks; it never sees the key:
const res = await broker.execute({
  credential: 'openai', method: 'POST',
  url: 'https://api.openai.com/v1/chat/completions', body: JSON.stringify(payload),
});

Python: from zanii.broker import create_broker — same semantics.

Fail-closed by construction (none of this is configurable)

  1. Allow-list first — each credential is bound to explicit https origins + path prefixes. Origins compare exactly (api.openai.com.evil.com cannot masquerade), path prefixes respect segment boundaries (/v1 allows /v1/chat, not /v1abc). A prompt-injected agent cannot exfiltrate the key to an attacker-chosen URL.
  2. Receipt BEFORE callrecord must succeed before the upstream is contacted. Ledger unreachable = no call. Over-recording is safe; under-recording is the hole.
  3. The secret never enters the receipt — the payload is hashed from the request as the agent submitted it, before injection.
  4. Responses are scrubbedset-cookie (configurable) stripped before the agent sees them.

The limit, stated up front

Isolation is only real when the broker runs in a separate process/host from the agent (the @zanii/gateway deployment shape) — in-process, a compromised agent can read the broker's memory. And receipt-or-nothing governs calls made through the broker: it removes the agent's need to hold credentials; it cannot stop an operator who hands the agent raw keys anyway. Adopt the broker AND delete the keys from the agent's environment — the second half is yours.