agent402-tollbooth 0.4.0 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +2 -2
- package/index.js +7 -1
- package/package.json +2 -2
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Havok Holdings LLC
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -8,11 +8,11 @@ proof-of-work. No Cloudflare, no Stripe, no Merchant-of-Record, no signup.
|
|
|
8
8
|
The big platforms are converging on the same model: Cloudflare's
|
|
9
9
|
[pay-per-crawl](https://stackoverflow.blog/2026/02/26/how-pay-per-crawl-is-reshaping-data-monetization/)
|
|
10
10
|
and now its [Monetization Gateway](https://blog.cloudflare.com/monetization-gateway/)
|
|
11
|
-
(
|
|
11
|
+
(announced 2026 — x402 charging for anything behind Cloudflare, waitlist at the time of writing) confirm that
|
|
12
12
|
pay-per-request is the business model of the agentic web. Tollbooth is the
|
|
13
13
|
**open-source monetization gateway**: the same idea, live today, MIT-licensed,
|
|
14
14
|
running in front of *any* origin (even a Cloudflare Worker), with a proof-of-work
|
|
15
|
-
free tier
|
|
15
|
+
free tier the platform gateways don't offer — built on the same hardened 402 + proof-of-work
|
|
16
16
|
machinery as [Agent402](https://github.com/MikeyPetrillo/Agent402).
|
|
17
17
|
|
|
18
18
|
## See it work (one command)
|
package/index.js
CHANGED
|
@@ -258,8 +258,11 @@ function readBody(req, cap = 10 * 1024 * 1024) {
|
|
|
258
258
|
async function startCli() {
|
|
259
259
|
const upstream = process.env.TOLLBOOTH_UPSTREAM;
|
|
260
260
|
const port = Number(process.env.PORT) || 4021;
|
|
261
|
-
|
|
261
|
+
const _secret = process.env.TOLLBOOTH_SECRET;
|
|
262
|
+
if (!_secret) {
|
|
262
263
|
console.warn("⚠ TOLLBOOTH_SECRET not set — proof-of-work tokens use a random per-process secret: they won't survive a restart and will be rejected across multiple workers/instances. Set a stable TOLLBOOTH_SECRET in production.");
|
|
264
|
+
} else if (/^change-me/i.test(_secret) || _secret === "change-me-to-a-long-random-string") {
|
|
265
|
+
console.warn("⚠ TOLLBOOTH_SECRET is the public placeholder from the deploy template — it's readable by anyone, so proof-of-work tokens can be FORGED to bypass your gate for free. Set a real random secret: `openssl rand -hex 32`.");
|
|
263
266
|
}
|
|
264
267
|
const { default: express } = await import("express");
|
|
265
268
|
const app = express();
|
|
@@ -274,6 +277,9 @@ async function startCli() {
|
|
|
274
277
|
const { timingSafeEqual } = await import("node:crypto");
|
|
275
278
|
const ADMIN_TOKEN = process.env.TOLLBOOTH_ADMIN_TOKEN || "";
|
|
276
279
|
const STATS_TOKEN = process.env.TOLLBOOTH_STATS_TOKEN || "";
|
|
280
|
+
if (!ADMIN_TOKEN) {
|
|
281
|
+
console.warn("⚠ TOLLBOOTH_ADMIN_TOKEN not set — the /__tollbooth analytics dashboard is publicly reachable (aggregate counts only, no per-request/payer data). Set TOLLBOOTH_ADMIN_TOKEN to require a token.");
|
|
282
|
+
}
|
|
277
283
|
const presented = (req) => {
|
|
278
284
|
const auth = req.headers["authorization"];
|
|
279
285
|
if (typeof auth === "string" && auth.startsWith("Bearer ")) return auth.slice(7);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent402-tollbooth",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"description": "Open-source, self-hostable x402 pay-per-crawl tollbooth: charge AI bots per request (USDC via x402 — or USDG on Robinhood Chain — or free proof-of-work) while humans browse free. Drop-in Express middleware or reverse proxy — no Cloudflare, no Stripe, no signup.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"robinhood-chain",
|
|
64
64
|
"usdg"
|
|
65
65
|
],
|
|
66
|
-
"author": "
|
|
66
|
+
"author": "Havok Holdings LLC <mike@agent402.tools> (https://agent402.tools)",
|
|
67
67
|
"license": "MIT",
|
|
68
68
|
"repository": {
|
|
69
69
|
"type": "git",
|