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

@botparty/sdk

v0.0.78

Published

Client SDK for BotParty — federated bot identity, authentication, and payments

Readme

@botparty/sdk

Client SDK for BotParty — federated bot identity, authentication, and payments.

Zero config. One function. Your bot gets an identity, rotates its keys, and authenticates on any BotParty-compatible server automatically.

Install

npm install @botparty/sdk

Quick Start

import { botpartyFetch } from '@botparty/sdk';

// That's it. First call auto-registers a namespace and generates a keypair.
const res = await botpartyFetch('https://api.example.com/data');
const data = await res.json();

On first run, the SDK:

  1. Generates an Ed25519 keypair
  2. Registers a namespace like brave-fox-a3f2 on the BotParty server
  3. Stores the identity in ~/.botparty/

On every call, it:

  1. Checks if the key is about to go stale → auto-rotates
  2. Signs a JWT with the namespace identity
  3. Sends the request with Authorization: Bearer <jwt>

Error Handling

BotParty-compatible servers return typed errors that the SDK catches and throws as specific error classes. Each error has a code, message, and optional actionUrl for human intervention.

import {
  botpartyFetch,
  NamespaceLockedError,
  PaymentRequiredError,
  InsufficientPermissionError,
  LinkRequiredError,
} from '@botparty/sdk';

try {
  const res = await botpartyFetch('https://api.example.com/data');
} catch (err) {
  if (err instanceof NamespaceLockedError) {
    console.log('Namespace locked! Human must unlock at:', err.actionUrl);
  }
  if (err instanceof PaymentRequiredError) {
    console.log('Payment needed:', err.message, err.actionUrl);
  }
  if (err instanceof InsufficientPermissionError) {
    console.log('Missing scopes:', err.missingScopes);
  }
  if (err instanceof LinkRequiredError) {
    console.log('Link a human account at:', err.actionUrl);
  }
}

Advanced Usage

Use BotPartyClient for full control over registration, key management, and namespace operations.

import { BotPartyClient } from '@botparty/sdk';

const client = new BotPartyClient({
  serverUrl: 'https://id.botparty.club',  // default
  algorithm: 'EdDSA',                  // default (also supports ES256)
  rotationTTL: 15,                     // minutes, default
});

// Register with a custom name
await client.register('my-cool-bot', 'My Cool Bot');

// Or let it auto-register
await client.ensureRegistered();

// Generate a JWT token (handles registration + rotation automatically)
const token = await client.generateToken();

// Authenticated fetch
const res = await client.fetch('https://api.example.com/data');

// Check identity
const me = client.whoami();
// { namespace: 'my-cool-bot', keyId: 'key_...', staleAt: '...', ... }

Key Management

// List all keys
const keys = await client.keys.list();

// Add a delegated key
await client.keys.add({
  publicKey: '-----BEGIN PUBLIC KEY-----\n...',
  scopes: ['mongo://production/*:read'],
  rotationTTL: 60,
});

// Rotate the current machine's key
await client.keys.rotateCurrent();

// Fluent key operations
const key = client.key('key_abc123');
await key.info();
await key.update({ label: 'Updated label' });
await key.invalidate('Suspected compromise');
await key.delete();

Namespace Operations

// Get namespace info from server
const info = await client.info();
// { namespace: '...', status: 'active', linked: true, activeKeys: 2, ... }

// Generate a link URL for a human to claim ownership
const { url } = await client.link();
console.log('Share this with your human:', url);

// Destroy namespace (irreversible)
await client.destroy();

// Clear local state only
client.reset();

Configuration

| Option | Env Variable | Default | Description | |--------|-------------|---------|-------------| | serverUrl | BOTPARTY_SERVER_URL | https://id.botparty.club | BotParty server URL | | stateDir | BOTPARTY_STATE_DIR | ~/.botparty | Local state directory | | algorithm | — | EdDSA | Key algorithm (EdDSA or ES256) | | rotationTTL | — | 15 | Key rotation TTL in minutes |

State Files

The SDK stores identity and keys in ~/.botparty/:

~/.botparty/
├── identity.json    # namespace, keyId, algorithm, rotatedAt, etc.
└── private.pem      # Ed25519/EC private key (mode 0600)

Error Classes

| Class | Code | HTTP | Description | |-------|------|------|-------------| | BotPartyError | varies | varies | Base error class | | NamespaceLockedError | NAMESPACE_LOCKED | 423 | Namespace locked, human must unlock | | PaymentRequiredError | PAYMENT_REQUIRED | 402 | Payment needed for this action | | InsufficientPermissionError | INSUFFICIENT_PERMISSION | 403 | Missing required scopes | | LinkRequiredError | LINK_REQUIRED | 403 | Must link a human account |

All errors have .code, .message, .statusCode, and .actionUrl (when applicable).

License

MIT