pwnbotdetect
v0.1.7
Published
PwnBot / Aegis server SDK: protect() writes with single-use leases, plus the browser client.
Readme
pwnbotdetect
Stop fake accounts where they cost you money (sign-ups, invites, referral rewards, promo codes, API keys) without CAPTCHAs, browser fingerprinting or IP blocklists. PwnBot ties each scarce write to a verified device (App Attest, Play Integrity) or passkey, holds each one to a daily limit, and re-checks it on the write itself with a single-use pass.
A bot score guesses about anonymous traffic. PwnBot knows who did each write, on what verified hardware, and how often, so it can also tell you:
- What a fake account costs an attacker, per route, before you ship:
npx pwnbotdetect price policy.json. - What a user has left today:
client.allowance(), so the app says "2 invites left" instead of surprising anyone. - Why it said no, in plain words:
explainRefusal(), with a support reference your team can use to give the day back. - Limits that grow with trust: more room for stronger evidence and for older accounts, so a burst of fresh farm accounts meets the base limit.
- Your users' own AI agents are welcome:
client.delegate()lets a person's agent act on part of their allowance. It never adds capacity, and your server sees which writes it made. - Canary first: see what enforce would have refused before it refuses anyone.
import { protect, WRITE_HASH_HEADER } from "pwnbotdetect";
export const POST = protect({ route: "POST /v1/keys", grade: "G3" })(async (req, { lease }) => {
const key = await createKey(lease?.principal_site);
return Response.json({ key }, { headers: { [WRITE_HASH_HEADER]: key.id } });
});npx pwnbotdetect recipes # ready-made policies for common farm targets
npx pwnbotdetect recipe referral-reward > policy.json
npx pwnbotdetect price policy.json # the fake-account price per route
npx pwnbotdetect keys # signing keys and tokens for a deploymentEntry points: pwnbotdetect (server: protect, configureAegis, the engine),
pwnbotdetect/client (browser client), pwnbotdetect/express (the middleware for a server that isn't this app: verify, settle, release, forget, and a "follow" mode that takes the console's per-route switch), pwnbotdetect/crypto (key helpers),
pwnbotdetect/redis (shared state; install ioredis).
The full guide is INTEGRATION.md in this package; PRIVACY.md says what is stored about your users and gives privacy-policy and app-store wording. Licensed FSL-1.1 with an Apache 2.0 future license (see LICENSE).
