@botpoison/browser

中文文档
1.2.0发布于 2026/11/05TypeScriptESM + CJS零依赖近 30 天下载 9803

Botpoison Challenge for the browser: an invisible CAPTCHA alternative that solves a proof-of-work puzzle when a form is sent. No cookies, no widget.

原始使用文档
文档目录4 节
  1. A plain HTML form
  2. A form sent with JavaScript
  3. On your server
  4. Documentation

@botpoison/browser

The browser library for Botpoison Challenge, an invisible alternative to CAPTCHAs for web forms. When a visitor presses Send, the library fetches a signed proof-of-work puzzle, solves it in the browser and attaches the answer to the form. The visitor sees no puzzle, no checkbox and no widget. Your server then checks the answer with one call, for example with @botpoison/node.

  • No dependencies. Load it async.
  • Sets no cookies and stores nothing in the browser.
  • Needs BigInt and Web Crypto, so the page must be served over HTTPS (or from localhost).

You need a project's public key (pk_...). Create a project for free at botpoison.com.

A plain HTML form

No JavaScript to write. Add the script and put your public key on the form:

<script
  src="https://unpkg.com/@botpoison/[email protected]/dist/index.js"
  integrity="sha384-Coq4yXcH6P37EoKbvbmZZj3UpsLwU5Ir/tth7Fgf24Q5JUj2I4hcwqtj3zKi7+PA"
  crossorigin="anonymous"
  async
></script>

<form action="/contact" method="POST" data-botpoison-public-key="pk_xxxxxxxx">
  <!-- your fields -->
  <button type="submit">Send</button>
</form>

On submit the library solves the puzzle, adds a hidden _botpoison field and sends the form. It fires botpoison-challenge-start, botpoison-challenge-success and botpoison-challenge-error on the form. On an error the form is not sent: listen for botpoison-challenge-error to tell the visitor what happened.

A form sent before the script loads has no _botpoison. To prevent that, keep Send disabled until the script fires botpoison-ready (example).

A form sent with JavaScript

npm install @botpoison/browser
import Botpoison from "@botpoison/browser";

const botpoison = new Botpoison({ publicKey: "pk_xxxxxxxx" });

form.addEventListener("submit", async (event) => {
  event.preventDefault();
  const { solution } = await botpoison.challenge();
  await fetch("/contact", {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({ ...fields, _botpoison: solution }),
  });
});

challenge() rejects when the puzzle cannot be fetched or solved, for example when the API is out of reach. challenge({ onProgress }) reports progress from 0 to 1 while it solves.

On your server

Send the _botpoison value to /verify with your secret key, and accept the submission only when it answers ok: true. See verifying it on your server for Node.js, PHP, Python, Go, Rust, Java and plain HTTP.

Documentation

版本与发布记录

@botpoison/browser 共发布 40 个版本,首次发布于 2021/01/23;过去 12 个月发布了 11 个版本。

版本发布日期距今
1.2.0latest2026/11/053 天前
1.1.02026/10/1326 天前
1.0.02026/08/262 个月前
0.4.02026/08/112 个月前
0.3.12026/08/073 个月前
0.3.02026/08/013 个月前

关于 @botpoison/browser 的常见问题

@botpoison/browser 是什么?

Botpoison Challenge for the browser: an invisible CAPTCHA alternative that solves a proof-of-work puzzle when a form is sent. No cookies, no widget.

如何安装 @botpoison/browser?

在项目目录运行 npm install @botpoison/browser,或使用 pnpm add / yarn add / bun add。

@botpoison/browser 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@botpoison/browser 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@botpoison/browser 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=18。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@botpoison/browser 可以商用吗?

@botpoison/browser 使用 未声明 许可。package.json 没有声明许可证。没有许可证的代码默认保留全部权利,商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括,不构成法律意见,请以许可原文为准。

@botpoison/browser 的下载量有多少?

根据 npm 官方下载统计,@botpoison/browser 在 2026/10/09 – 2026/11/07 这 30 天内被下载 9,803 次,日均约 327 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@botpoison/browser 还在维护吗?

最新版本 1.2.0 发布于 2026/11/05(3 天前);至今共发布 40 个版本,其中过去 12 个月发布了 11 个;首次发布于 2021/01/23。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。