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

@botwall/sdk

v1.1.1

Published

BotWall SDK for site protection and bot crawling

Readme

BotWall SDK

The BotWall SDK allows bot developers to interact with pay-per-crawl protected APIs.

Example Usage

import { signRequest, sendCrawlRequest } from '@botwall/sdk';

const headers = {
  'crawler-id': 'YOUR_BOT_ID',
  'crawler-max-price': '0.05',
  'signature-input': 'crawler-id crawler-max-price',
};

headers['signature'] = signRequest(headers, 'YOUR_PRIVATE_KEY_BASE64');

await sendCrawlRequest('https://target-site.com/api/protected', headers);

Usage Summary

| Usage Style | How to Pass Backend URL | Example | |----------------------------|----------------------------------------|-----------------------------------------| | SDK Client (recommended) | Constructor param | new BotWallClient('https://.../api') | | Single-call helper | Option param { apiUrl: ... } | sendCrawlRequest(..., { apiUrl: ... })| | .env (fallback) | BACKEND_URL in .env | |

Notes

  • Passing the backend API URL explicitly is recommended for production and when deploying to multiple environments.
  • If you do not pass a URL, the SDK will use process.env.BACKEND_URL if available.
  • For local development, set BACKEND_URL=http://localhost:3001/api in your .env file.

Installation

npm install @botwall/sdk

Quick Start

For Site Owners

Protect your routes and monetize bot access:

For Bot Developers (Ed25519 Signature Flow)

Bot developers can use the SDK to:

  • Generate an Ed25519 keypair (public/private key)
  • Sign requests to protected endpoints using their private key
  • (Optionally) Send signed crawl requests with fetch

API Reference

Bot Developer Functions

generateKeypair()

Generates a new Ed25519 keypair.

  • Returns: { publicKey: string, privateKey: string } (both base64-encoded)

signRequest(headers, privateKey)

Signs a canonical message (per signature-input) using Ed25519.

  • headers: Object of headers (header names are case-insensitive)
  • privateKey: base64-encoded Ed25519 private key
  • Returns: base64-encoded signature string

sendCrawlRequest(url, headers, privateKey, options?)

Sends a crawl request, auto-signing the headers using Ed25519.

  • url: The URL to fetch
  • headers: Headers object (must include signature-input and required headers)
  • privateKey: base64-encoded Ed25519 private key
  • options: Optional fetch options (method, body, etc.)
  • Returns: The fetch Response object

Ed25519 Signature Flow

  • No API keys are used for bot authentication.
  • Each bot signs requests with their private key.
  • The public key is stored in the BotWall database during onboarding.
  • The middleware on the publisher site verifies the signature using the public key.

Required Headers for Protected Endpoints:

  • crawler-id: Bot's domain name (e.g., gptbot.com)
  • crawler-max-price: Max price the bot is willing to pay
  • signature-input: Space-separated list of header names to sign (e.g., host path)
  • signature: Ed25519 signature (base64) of the canonical message

Canonical Message:

  • Concatenate the values of the headers listed in signature-input, separated by spaces.
  • Sign this string using Ed25519 and the bot's private key.

Site Owner Functions

(See above for middleware usage)


Error Handling

The SDK provides specific error classes for different scenarios:

const { 
  InvalidCredentialsError, 
  InsufficientCreditsError, 
  NetworkError 
} = require('@botwall/sdk');

try {
  // ...
} catch (error) {
  if (error instanceof InvalidCredentialsError) {
    console.log('Invalid credentials');
  } else if (error instanceof InsufficientCreditsError) {
    console.log('Need to buy more credits');
  } else if (error instanceof NetworkError) {
    console.log('Network or server error');
  }
}

Troubleshooting

Common Issues

  1. "Invalid signature" error

    • Ensure you are signing the correct canonical message (per signature-input)
    • Make sure header names are lowercased and match exactly
    • Use the correct private key (base64-encoded)
  2. "Missing signature-input header" error

    • Always include signature-input in your headers and sign the listed headers

License

MIT


👤 Maintainer