@dupecom/botcha-cloudflare 0.18.0 → 0.19.0
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/README.md +1 -1
- package/dist/auth.d.ts +48 -3
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +89 -21
- package/dist/dashboard/docs.d.ts +15 -0
- package/dist/dashboard/docs.d.ts.map +1 -0
- package/dist/dashboard/docs.js +556 -0
- package/dist/dashboard/layout.d.ts.map +1 -1
- package/dist/dashboard/layout.js +1 -1
- package/dist/dashboard/whitepaper.js +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +82 -13
- package/dist/static.d.ts +52 -2
- package/dist/static.d.ts.map +1 -1
- package/dist/static.js +69 -6
- package/dist/tap-jwks.d.ts +2 -1
- package/dist/tap-jwks.d.ts.map +1 -1
- package/dist/tap-jwks.js +31 -7
- package/package.json +1 -1
|
@@ -0,0 +1,556 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "hono/jsx/jsx-runtime";
|
|
2
|
+
import { DASHBOARD_CSS } from './styles';
|
|
3
|
+
import { GlobalFooter, OGMeta } from './layout';
|
|
4
|
+
// ============ DOCS CSS ============
|
|
5
|
+
const DOCS_CSS = `
|
|
6
|
+
/* ============ Docs layout ============ */
|
|
7
|
+
.docs {
|
|
8
|
+
max-width: 860px;
|
|
9
|
+
margin: 0 auto;
|
|
10
|
+
padding: 3rem 2rem 4rem;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/* ---- Header ---- */
|
|
14
|
+
.docs-header {
|
|
15
|
+
text-align: center;
|
|
16
|
+
margin-bottom: 3rem;
|
|
17
|
+
padding-bottom: 2rem;
|
|
18
|
+
border-bottom: 1px solid var(--border);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.docs-badge {
|
|
22
|
+
display: inline-block;
|
|
23
|
+
font-size: 0.625rem;
|
|
24
|
+
font-weight: 700;
|
|
25
|
+
letter-spacing: 0.15em;
|
|
26
|
+
text-transform: uppercase;
|
|
27
|
+
padding: 0.3rem 0.875rem;
|
|
28
|
+
border: 1px solid var(--border);
|
|
29
|
+
color: var(--text-muted);
|
|
30
|
+
margin-bottom: 1.5rem;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.docs-title {
|
|
34
|
+
font-size: 2rem;
|
|
35
|
+
font-weight: 700;
|
|
36
|
+
line-height: 1.15;
|
|
37
|
+
margin: 0 0 0.75rem;
|
|
38
|
+
color: var(--text);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.docs-subtitle {
|
|
42
|
+
font-size: 0.875rem;
|
|
43
|
+
color: var(--text-muted);
|
|
44
|
+
line-height: 1.6;
|
|
45
|
+
margin: 0 0 1rem;
|
|
46
|
+
max-width: 600px;
|
|
47
|
+
margin-left: auto;
|
|
48
|
+
margin-right: auto;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.docs-meta {
|
|
52
|
+
font-size: 0.6875rem;
|
|
53
|
+
color: var(--text-dim);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.docs-meta a {
|
|
57
|
+
color: var(--text-muted);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/* ---- Table of Contents ---- */
|
|
61
|
+
.docs-toc {
|
|
62
|
+
border: 1px solid var(--border);
|
|
63
|
+
padding: 1.5rem 2rem;
|
|
64
|
+
margin-bottom: 3rem;
|
|
65
|
+
background: var(--bg);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.docs-toc-title {
|
|
69
|
+
font-size: 0.6875rem;
|
|
70
|
+
font-weight: 700;
|
|
71
|
+
letter-spacing: 0.1em;
|
|
72
|
+
text-transform: uppercase;
|
|
73
|
+
color: var(--text-dim);
|
|
74
|
+
margin-bottom: 1rem;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.docs-toc-list {
|
|
78
|
+
list-style: none;
|
|
79
|
+
padding: 0;
|
|
80
|
+
margin: 0;
|
|
81
|
+
display: grid;
|
|
82
|
+
grid-template-columns: 1fr 1fr;
|
|
83
|
+
gap: 0.25rem 2rem;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.docs-toc-list li {
|
|
87
|
+
font-size: 0.75rem;
|
|
88
|
+
line-height: 1.8;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.docs-toc-list a {
|
|
92
|
+
color: var(--text);
|
|
93
|
+
text-decoration: none;
|
|
94
|
+
transition: color 0.15s;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.docs-toc-list a:hover {
|
|
98
|
+
color: var(--green);
|
|
99
|
+
opacity: 1;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.docs-toc-list a::before {
|
|
103
|
+
content: "\\2192 ";
|
|
104
|
+
color: var(--text-dim);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/* ---- Sections ---- */
|
|
108
|
+
.docs-section {
|
|
109
|
+
margin-bottom: 3rem;
|
|
110
|
+
padding-top: 1rem;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.docs-section-title {
|
|
114
|
+
font-size: 1.25rem;
|
|
115
|
+
font-weight: 700;
|
|
116
|
+
margin: 0 0 0.5rem;
|
|
117
|
+
color: var(--text);
|
|
118
|
+
padding-bottom: 0.5rem;
|
|
119
|
+
border-bottom: 1px solid var(--border);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.docs-section-desc {
|
|
123
|
+
font-size: 0.8125rem;
|
|
124
|
+
color: var(--text-muted);
|
|
125
|
+
line-height: 1.7;
|
|
126
|
+
margin-bottom: 1.5rem;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/* ---- Endpoint rows ---- */
|
|
130
|
+
.docs-endpoint {
|
|
131
|
+
border: 1px solid var(--border);
|
|
132
|
+
margin-bottom: 1rem;
|
|
133
|
+
background: var(--bg);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.docs-endpoint-header {
|
|
137
|
+
display: flex;
|
|
138
|
+
align-items: center;
|
|
139
|
+
gap: 0.75rem;
|
|
140
|
+
padding: 0.75rem 1rem;
|
|
141
|
+
border-bottom: 1px solid var(--border);
|
|
142
|
+
cursor: pointer;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.docs-endpoint-header:hover {
|
|
146
|
+
background: var(--bg-raised);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.docs-method {
|
|
150
|
+
display: inline-block;
|
|
151
|
+
font-size: 0.625rem;
|
|
152
|
+
font-weight: 700;
|
|
153
|
+
letter-spacing: 0.05em;
|
|
154
|
+
padding: 0.2rem 0.5rem;
|
|
155
|
+
min-width: 3rem;
|
|
156
|
+
text-align: center;
|
|
157
|
+
text-transform: uppercase;
|
|
158
|
+
color: #fff;
|
|
159
|
+
flex-shrink: 0;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.docs-method-get { background: var(--green); }
|
|
163
|
+
.docs-method-post { background: #2563eb; }
|
|
164
|
+
.docs-method-put { background: var(--amber); }
|
|
165
|
+
.docs-method-delete { background: var(--red); }
|
|
166
|
+
|
|
167
|
+
.docs-path {
|
|
168
|
+
font-size: 0.8125rem;
|
|
169
|
+
font-weight: 600;
|
|
170
|
+
color: var(--text);
|
|
171
|
+
font-family: var(--font);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.docs-endpoint-desc {
|
|
175
|
+
font-size: 0.75rem;
|
|
176
|
+
color: var(--text-muted);
|
|
177
|
+
margin-left: auto;
|
|
178
|
+
text-align: right;
|
|
179
|
+
flex-shrink: 0;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.docs-endpoint-body {
|
|
183
|
+
padding: 1rem;
|
|
184
|
+
font-size: 0.75rem;
|
|
185
|
+
line-height: 1.7;
|
|
186
|
+
display: none;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.docs-endpoint.open .docs-endpoint-body {
|
|
190
|
+
display: block;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.docs-endpoint-body p {
|
|
194
|
+
margin-bottom: 0.75rem;
|
|
195
|
+
color: var(--text-muted);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.docs-endpoint-body pre {
|
|
199
|
+
margin-bottom: 0.75rem;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.docs-endpoint-body pre code {
|
|
203
|
+
font-size: 0.6875rem;
|
|
204
|
+
line-height: 1.6;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.docs-param-table {
|
|
208
|
+
width: 100%;
|
|
209
|
+
border-collapse: collapse;
|
|
210
|
+
margin-bottom: 0.75rem;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.docs-param-table th {
|
|
214
|
+
text-align: left;
|
|
215
|
+
font-size: 0.625rem;
|
|
216
|
+
font-weight: 700;
|
|
217
|
+
text-transform: uppercase;
|
|
218
|
+
letter-spacing: 0.08em;
|
|
219
|
+
color: var(--text-dim);
|
|
220
|
+
padding: 0.375rem 0.5rem;
|
|
221
|
+
border-bottom: 1px solid var(--border);
|
|
222
|
+
background: var(--bg-raised);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.docs-param-table td {
|
|
226
|
+
font-size: 0.6875rem;
|
|
227
|
+
padding: 0.375rem 0.5rem;
|
|
228
|
+
border-bottom: 1px solid var(--border);
|
|
229
|
+
vertical-align: top;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
.docs-param-name {
|
|
233
|
+
font-weight: 600;
|
|
234
|
+
color: var(--text);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
.docs-param-type {
|
|
238
|
+
color: var(--text-dim);
|
|
239
|
+
font-style: italic;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
.docs-param-required {
|
|
243
|
+
color: var(--red);
|
|
244
|
+
font-size: 0.5625rem;
|
|
245
|
+
font-weight: 700;
|
|
246
|
+
text-transform: uppercase;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
.docs-label {
|
|
250
|
+
font-size: 0.625rem;
|
|
251
|
+
font-weight: 700;
|
|
252
|
+
text-transform: uppercase;
|
|
253
|
+
letter-spacing: 0.08em;
|
|
254
|
+
color: var(--text-dim);
|
|
255
|
+
margin-bottom: 0.375rem;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/* ---- Install ---- */
|
|
259
|
+
.docs-install-grid {
|
|
260
|
+
display: grid;
|
|
261
|
+
grid-template-columns: 1fr 1fr;
|
|
262
|
+
gap: 1rem;
|
|
263
|
+
margin-bottom: 2rem;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
.docs-install-card {
|
|
267
|
+
border: 1px solid var(--border);
|
|
268
|
+
padding: 1.25rem;
|
|
269
|
+
background: var(--bg);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
.docs-install-card-title {
|
|
273
|
+
font-size: 0.6875rem;
|
|
274
|
+
font-weight: 700;
|
|
275
|
+
text-transform: uppercase;
|
|
276
|
+
letter-spacing: 0.1em;
|
|
277
|
+
color: var(--text-dim);
|
|
278
|
+
margin-bottom: 0.75rem;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
.docs-install-card pre {
|
|
282
|
+
margin: 0;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
.docs-install-card code {
|
|
286
|
+
font-size: 0.75rem;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/* ---- Quick Start ---- */
|
|
290
|
+
.docs-quickstart-step {
|
|
291
|
+
display: flex;
|
|
292
|
+
gap: 1rem;
|
|
293
|
+
margin-bottom: 1.5rem;
|
|
294
|
+
align-items: flex-start;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
.docs-quickstart-num {
|
|
298
|
+
display: inline-flex;
|
|
299
|
+
align-items: center;
|
|
300
|
+
justify-content: center;
|
|
301
|
+
width: 1.75rem;
|
|
302
|
+
height: 1.75rem;
|
|
303
|
+
font-size: 0.75rem;
|
|
304
|
+
font-weight: 700;
|
|
305
|
+
border: 2px solid var(--border-bright);
|
|
306
|
+
color: var(--text);
|
|
307
|
+
flex-shrink: 0;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
.docs-quickstart-content {
|
|
311
|
+
flex: 1;
|
|
312
|
+
min-width: 0;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
.docs-quickstart-content p {
|
|
316
|
+
font-size: 0.8125rem;
|
|
317
|
+
color: var(--text-muted);
|
|
318
|
+
margin-bottom: 0.5rem;
|
|
319
|
+
line-height: 1.6;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
.docs-quickstart-content pre {
|
|
323
|
+
margin: 0;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
/* ---- Auth flow diagram ---- */
|
|
327
|
+
.docs-flow {
|
|
328
|
+
border: 1px solid var(--border);
|
|
329
|
+
padding: 1.5rem;
|
|
330
|
+
background: var(--bg);
|
|
331
|
+
margin-bottom: 2rem;
|
|
332
|
+
font-family: var(--font);
|
|
333
|
+
font-size: 0.75rem;
|
|
334
|
+
line-height: 1.8;
|
|
335
|
+
color: var(--text-muted);
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
.docs-flow-title {
|
|
339
|
+
font-size: 0.6875rem;
|
|
340
|
+
font-weight: 700;
|
|
341
|
+
text-transform: uppercase;
|
|
342
|
+
letter-spacing: 0.1em;
|
|
343
|
+
color: var(--text);
|
|
344
|
+
margin-bottom: 0.75rem;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
.docs-flow-step {
|
|
348
|
+
display: flex;
|
|
349
|
+
gap: 0.75rem;
|
|
350
|
+
margin-bottom: 0.25rem;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
.docs-flow-arrow {
|
|
354
|
+
color: var(--green);
|
|
355
|
+
font-weight: 700;
|
|
356
|
+
flex-shrink: 0;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
/* ---- Rate Limits ---- */
|
|
360
|
+
.docs-rate-limit {
|
|
361
|
+
display: flex;
|
|
362
|
+
gap: 2rem;
|
|
363
|
+
margin-bottom: 1rem;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
.docs-rate-limit-item {
|
|
367
|
+
font-size: 0.75rem;
|
|
368
|
+
color: var(--text-muted);
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
.docs-rate-limit-value {
|
|
372
|
+
font-weight: 700;
|
|
373
|
+
color: var(--text);
|
|
374
|
+
font-size: 1rem;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
/* ---- Toggle script ---- */
|
|
378
|
+
|
|
379
|
+
/* ---- Responsive ---- */
|
|
380
|
+
@media (max-width: 768px) {
|
|
381
|
+
.docs { padding: 2rem 1rem 3rem; }
|
|
382
|
+
.docs-title { font-size: 1.5rem; }
|
|
383
|
+
.docs-toc-list { grid-template-columns: 1fr; }
|
|
384
|
+
.docs-install-grid { grid-template-columns: 1fr; }
|
|
385
|
+
.docs-endpoint-header { flex-wrap: wrap; gap: 0.5rem; }
|
|
386
|
+
.docs-endpoint-desc { margin-left: 0; text-align: left; width: 100%; }
|
|
387
|
+
.docs-rate-limit { flex-direction: column; gap: 0.5rem; }
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
@media (max-width: 480px) {
|
|
391
|
+
.docs { padding: 1.5rem 0.75rem 2rem; }
|
|
392
|
+
.docs-quickstart-step { flex-direction: column; gap: 0.5rem; }
|
|
393
|
+
}
|
|
394
|
+
`;
|
|
395
|
+
// Combined CSS
|
|
396
|
+
const DOCS_PAGE_CSS = DASHBOARD_CSS + DOCS_CSS;
|
|
397
|
+
// Toggle script for endpoint details
|
|
398
|
+
const TOGGLE_SCRIPT = `
|
|
399
|
+
(function() {
|
|
400
|
+
document.querySelectorAll('.docs-endpoint-header').forEach(function(header) {
|
|
401
|
+
header.addEventListener('click', function() {
|
|
402
|
+
this.parentElement.classList.toggle('open');
|
|
403
|
+
});
|
|
404
|
+
});
|
|
405
|
+
})();
|
|
406
|
+
`;
|
|
407
|
+
// ============ HELPER COMPONENTS ============
|
|
408
|
+
const Endpoint = ({ method, path, desc, children }) => {
|
|
409
|
+
const methodClass = `docs-method docs-method-${method.toLowerCase()}`;
|
|
410
|
+
return (_jsxs("div", { class: "docs-endpoint", children: [_jsxs("div", { class: "docs-endpoint-header", children: [_jsx("span", { class: methodClass, children: method }), _jsx("span", { class: "docs-path", children: path }), _jsx("span", { class: "docs-endpoint-desc", children: desc })] }), children && (_jsx("div", { class: "docs-endpoint-body", children: children }))] }));
|
|
411
|
+
};
|
|
412
|
+
// ============ PAGE COMPONENT ============
|
|
413
|
+
export const DocsPage = ({ version }) => {
|
|
414
|
+
return (_jsxs("html", { lang: "en", children: [_jsxs("head", { children: [_jsx("meta", { charset: "utf-8" }), _jsx("meta", { name: "viewport", content: "width=device-width, initial-scale=1" }), _jsx("title", { children: "BOTCHA API Documentation" }), _jsx("meta", { name: "description", content: "Complete API documentation for BOTCHA \u2014 the reverse CAPTCHA for AI agents. Endpoints, SDKs, authentication flows, and code examples." }), _jsx("meta", { name: "keywords", content: "BOTCHA, API documentation, AI agents, reverse CAPTCHA, TAP, Trusted Agent Protocol, SDK" }), _jsx("link", { rel: "alternate", type: "application/json", href: "/openapi.json", title: "OpenAPI Specification" }), _jsx("meta", { name: "ai-agent-welcome", content: "true" }), _jsx(OGMeta, { title: "BOTCHA API Documentation", description: "Complete API reference for BOTCHA \u2014 the identity layer for AI agents. Endpoints, SDKs, and code examples.", url: "https://botcha.ai/docs" }), _jsx("link", { rel: "preconnect", href: "https://fonts.googleapis.com" }), _jsx("link", { href: "https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&display=swap", rel: "stylesheet" }), _jsx("style", { dangerouslySetInnerHTML: { __html: DOCS_PAGE_CSS } })] }), _jsxs("body", { children: [_jsxs("article", { class: "docs", children: [_jsxs("header", { class: "docs-header", children: [_jsxs("div", { class: "docs-badge", children: ["API Reference v", version] }), _jsx("h1", { class: "docs-title", children: "BOTCHA API Documentation" }), _jsx("p", { class: "docs-subtitle", children: "Prove you're a bot. Humans need not apply. Complete endpoint reference, SDK install instructions, and integration guides." }), _jsxs("div", { class: "docs-meta", children: [_jsx("a", { href: "/", children: "Home" }), _jsx("span", { style: "margin: 0 0.375rem;", children: "\u00B7" }), _jsx("a", { href: "/openapi.json", children: "OpenAPI Spec" }), _jsx("span", { style: "margin: 0 0.375rem;", children: "\u00B7" }), _jsx("a", { href: "/whitepaper", children: "Whitepaper" }), _jsx("span", { style: "margin: 0 0.375rem;", children: "\u00B7" }), _jsx("a", { href: "/ai.txt", children: "ai.txt" })] })] }), _jsxs("nav", { class: "docs-toc", children: [_jsx("div", { class: "docs-toc-title", children: "Contents" }), _jsxs("ul", { class: "docs-toc-list", children: [_jsx("li", { children: _jsx("a", { href: "#install", children: "Installation" }) }), _jsx("li", { children: _jsx("a", { href: "#quickstart", children: "Quick Start" }) }), _jsx("li", { children: _jsx("a", { href: "#challenges", children: "Challenges" }) }), _jsx("li", { children: _jsx("a", { href: "#authentication", children: "Authentication (Tokens)" }) }), _jsx("li", { children: _jsx("a", { href: "#apps", children: "Apps (Multi-Tenant)" }) }), _jsx("li", { children: _jsx("a", { href: "#agents", children: "Agent Registry" }) }), _jsx("li", { children: _jsx("a", { href: "#tap", children: "TAP (Trusted Agent Protocol)" }) }), _jsx("li", { children: _jsx("a", { href: "#delegation", children: "Delegation Chains" }) }), _jsx("li", { children: _jsx("a", { href: "#attestation", children: "Capability Attestation" }) }), _jsx("li", { children: _jsx("a", { href: "#reputation", children: "Agent Reputation" }) }), _jsx("li", { children: _jsx("a", { href: "#invoices", children: "Invoices (402 Micropayments)" }) }), _jsx("li", { children: _jsx("a", { href: "#verification", children: "Verification" }) }), _jsx("li", { children: _jsx("a", { href: "#discovery", children: "Discovery & Keys" }) }), _jsx("li", { children: _jsx("a", { href: "#ratelimits", children: "Rate Limits" }) })] })] }), _jsxs("section", { id: "install", class: "docs-section", children: [_jsx("h2", { class: "docs-section-title", children: "Installation" }), _jsx("p", { class: "docs-section-desc", children: "Client SDKs for TypeScript and Python. Server-side verification middleware available separately." }), _jsxs("div", { class: "docs-install-grid", children: [_jsxs("div", { class: "docs-install-card", children: [_jsx("div", { class: "docs-install-card-title", children: "npm (TypeScript)" }), _jsx("pre", { children: _jsx("code", { children: "npm install @dupecom/botcha" }) })] }), _jsxs("div", { class: "docs-install-card", children: [_jsx("div", { class: "docs-install-card-title", children: "PyPI (Python)" }), _jsx("pre", { children: _jsx("code", { children: "pip install botcha" }) })] }), _jsxs("div", { class: "docs-install-card", children: [_jsx("div", { class: "docs-install-card-title", children: "Verify Middleware (TS)" }), _jsx("pre", { children: _jsx("code", { children: "npm install @dupecom/botcha-verify" }) })] }), _jsxs("div", { class: "docs-install-card", children: [_jsx("div", { class: "docs-install-card-title", children: "Verify Middleware (Python)" }), _jsx("pre", { children: _jsx("code", { children: "pip install botcha-verify" }) })] }), _jsxs("div", { class: "docs-install-card", children: [_jsx("div", { class: "docs-install-card-title", children: "CLI" }), _jsx("pre", { children: _jsx("code", { children: "npm install -g @dupecom/botcha-cli" }) })] }), _jsxs("div", { class: "docs-install-card", children: [_jsx("div", { class: "docs-install-card-title", children: "Base URL" }), _jsx("pre", { children: _jsx("code", { children: "https://botcha.ai" }) })] })] })] }), _jsxs("section", { id: "quickstart", class: "docs-section", children: [_jsx("h2", { class: "docs-section-title", children: "Quick Start" }), _jsx("p", { class: "docs-section-desc", children: "Verify yourself as an AI agent in four steps. No registration required." }), _jsxs("div", { class: "docs-quickstart-step", children: [_jsx("span", { class: "docs-quickstart-num", children: "1" }), _jsxs("div", { class: "docs-quickstart-content", children: [_jsx("p", { children: "Get a challenge (hybrid by default \u2014 speed + reasoning)" }), _jsx("pre", { children: _jsx("code", { children: "curl https://botcha.ai/v1/challenges" }) })] })] }), _jsxs("div", { class: "docs-quickstart-step", children: [_jsx("span", { class: "docs-quickstart-num", children: "2" }), _jsxs("div", { class: "docs-quickstart-content", children: [_jsx("p", { children: "Solve the speed component: compute SHA-256 of each number, return first 8 hex chars" }), _jsx("pre", { children: _jsx("code", { children: `# For each problem.num, compute:
|
|
415
|
+
echo -n "42" | sha256sum | cut -c1-8
|
|
416
|
+
# => "73475cb4"` }) })] })] }), _jsxs("div", { class: "docs-quickstart-step", children: [_jsx("span", { class: "docs-quickstart-num", children: "3" }), _jsxs("div", { class: "docs-quickstart-content", children: [_jsx("p", { children: "Submit your solution" }), _jsx("pre", { children: _jsx("code", { children: `curl -X POST https://botcha.ai/v1/challenges/{id}/verify \\
|
|
417
|
+
-H "Content-Type: application/json" \\
|
|
418
|
+
-d '{
|
|
419
|
+
"type": "hybrid",
|
|
420
|
+
"speed_answers": ["73475cb4", "..."],
|
|
421
|
+
"reasoning_answers": {"q-id": "answer"}
|
|
422
|
+
}'` }) })] })] }), _jsxs("div", { class: "docs-quickstart-step", children: [_jsx("span", { class: "docs-quickstart-num", children: "4" }), _jsxs("div", { class: "docs-quickstart-content", children: [_jsx("p", { children: "Or use the token flow for JWT access:" }), _jsx("pre", { children: _jsx("code", { children: `# Get challenge
|
|
423
|
+
curl https://botcha.ai/v1/token
|
|
424
|
+
|
|
425
|
+
# Verify and receive JWT
|
|
426
|
+
curl -X POST https://botcha.ai/v1/token/verify \\
|
|
427
|
+
-H "Content-Type: application/json" \\
|
|
428
|
+
-d '{"id": "<challenge_id>", "answers": ["hash1", ...]}'
|
|
429
|
+
|
|
430
|
+
# Access protected resources
|
|
431
|
+
curl https://botcha.ai/agent-only \\
|
|
432
|
+
-H "Authorization: Bearer <access_token>"` }) })] })] }), _jsxs("div", { class: "docs-flow", children: [_jsx("div", { class: "docs-flow-title", children: "SDK Usage (TypeScript)" }), _jsx("pre", { children: _jsx("code", { children: `import { BotchaClient } from '@dupecom/botcha';
|
|
433
|
+
|
|
434
|
+
const client = new BotchaClient();
|
|
435
|
+
const response = await client.fetch('https://api.example.com/products');
|
|
436
|
+
// Challenges are solved automatically` }) })] }), _jsxs("div", { class: "docs-flow", children: [_jsx("div", { class: "docs-flow-title", children: "SDK Usage (Python)" }), _jsx("pre", { children: _jsx("code", { children: `from botcha import BotchaClient
|
|
437
|
+
|
|
438
|
+
async with BotchaClient() as client:
|
|
439
|
+
response = await client.fetch("https://api.example.com/products")
|
|
440
|
+
# Challenges are solved automatically` }) })] })] }), _jsxs("section", { id: "challenges", class: "docs-section", children: [_jsx("h2", { class: "docs-section-title", children: "Challenges" }), _jsx("p", { class: "docs-section-desc", children: "Computational challenges only AI agents can solve. Three types: hybrid (default), speed-only, and standard. Supports RTT-aware timeout adjustment for fair treatment across different network conditions." }), _jsxs(Endpoint, { method: "GET", path: "/v1/challenges", desc: "Generate a challenge", children: [_jsxs("p", { children: ["Returns a hybrid challenge by default (speed + reasoning). Use ", _jsx("code", { children: "?type=speed" }), " or ", _jsx("code", { children: "?type=standard" }), " for specific types."] }), _jsx("div", { class: "docs-label", children: "Query Parameters" }), _jsxs("table", { class: "docs-param-table", children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: "Name" }), _jsx("th", { children: "Type" }), _jsx("th", { children: "Description" })] }) }), _jsxs("tbody", { children: [_jsxs("tr", { children: [_jsx("td", { children: _jsx("span", { class: "docs-param-name", children: "type" }) }), _jsx("td", { children: _jsx("span", { class: "docs-param-type", children: "string" }) }), _jsxs("td", { children: [_jsx("code", { children: "hybrid" }), " (default), ", _jsx("code", { children: "speed" }), ", or ", _jsx("code", { children: "standard" })] })] }), _jsxs("tr", { children: [_jsx("td", { children: _jsx("span", { class: "docs-param-name", children: "ts" }) }), _jsx("td", { children: _jsx("span", { class: "docs-param-type", children: "integer" }) }), _jsx("td", { children: "Client timestamp (ms) for RTT-aware timeout. Formula: 500ms + (2 x RTT) + 100ms" })] }), _jsxs("tr", { children: [_jsx("td", { children: _jsx("span", { class: "docs-param-name", children: "app_id" }) }), _jsx("td", { children: _jsx("span", { class: "docs-param-type", children: "string" }) }), _jsx("td", { children: "Multi-tenant app ID for per-app isolation" })] })] })] }), _jsx("div", { class: "docs-label", children: "Response Example" }), _jsx("pre", { children: _jsx("code", { children: `{
|
|
441
|
+
"success": true,
|
|
442
|
+
"type": "hybrid",
|
|
443
|
+
"challenge": {
|
|
444
|
+
"id": "abc123",
|
|
445
|
+
"speed": {
|
|
446
|
+
"problems": [{"num": 42}, {"num": 7}, ...],
|
|
447
|
+
"timeLimit": "500ms"
|
|
448
|
+
},
|
|
449
|
+
"reasoning": {
|
|
450
|
+
"questions": [...],
|
|
451
|
+
"timeLimit": "30s"
|
|
452
|
+
}
|
|
453
|
+
},
|
|
454
|
+
"verify_endpoint": "/v1/challenges/abc123/verify"
|
|
455
|
+
}` }) })] }), _jsxs(Endpoint, { method: "POST", path: "/v1/challenges/:id/verify", desc: "Verify a challenge solution", children: [_jsxs("p", { children: ["Submit answers for any challenge type. Include ", _jsx("code", { children: "type" }), " in the body to disambiguate."] }), _jsx("div", { class: "docs-label", children: "Request Body (Hybrid)" }), _jsx("pre", { children: _jsx("code", { children: `{
|
|
456
|
+
"type": "hybrid",
|
|
457
|
+
"speed_answers": ["73475cb4", "ef2d127d", ...],
|
|
458
|
+
"reasoning_answers": {"q-id-1": "answer1", "q-id-2": "answer2"}
|
|
459
|
+
}` }) }), _jsx("div", { class: "docs-label", children: "Request Body (Speed)" }), _jsx("pre", { children: _jsx("code", { children: `{
|
|
460
|
+
"type": "speed",
|
|
461
|
+
"answers": ["73475cb4", "ef2d127d", "e7f6c011", ...]
|
|
462
|
+
}` }) }), _jsx("div", { class: "docs-label", children: "Response" }), _jsx("pre", { children: _jsx("code", { children: `{
|
|
463
|
+
"success": true,
|
|
464
|
+
"message": "HYBRID TEST PASSED! Speed: 47ms, Reasoning: 3/3",
|
|
465
|
+
"speed": { "valid": true, "solveTimeMs": 47 },
|
|
466
|
+
"reasoning": { "valid": true, "score": "3/3" }
|
|
467
|
+
}` }) })] }), _jsx(Endpoint, { method: "GET", path: "/v1/reasoning", desc: "Get a reasoning-only challenge" }), _jsx(Endpoint, { method: "POST", path: "/v1/reasoning", desc: "Verify reasoning challenge" }), _jsx(Endpoint, { method: "GET", path: "/v1/hybrid", desc: "Get a hybrid challenge (alternate endpoint)" }), _jsx(Endpoint, { method: "POST", path: "/v1/hybrid", desc: "Verify hybrid challenge" })] }), _jsxs("section", { id: "authentication", class: "docs-section", children: [_jsx("h2", { class: "docs-section-title", children: "Authentication (Tokens)" }), _jsxs("p", { class: "docs-section-desc", children: ["JWT token flow for accessing protected endpoints. Solve a speed challenge to receive an access token (5 min) and refresh token (1 hr). Tokens are signed with ES256 (ECDSA P-256) for asymmetric verification via JWKS. HS256 still supported for backward compatibility. Use ", _jsx("code", { children: "POST /v1/token/validate" }), " for remote validation without a shared secret."] }), _jsxs("div", { class: "docs-flow", children: [_jsx("div", { class: "docs-flow-title", children: "Token Flow" }), _jsxs("div", { class: "docs-flow-step", children: [_jsx("span", { class: "docs-flow-arrow", children: "1." }), _jsxs("span", { children: [_jsx("code", { children: "GET /v1/token" }), " \u2014 receive a speed challenge"] })] }), _jsxs("div", { class: "docs-flow-step", children: [_jsx("span", { class: "docs-flow-arrow", children: "2." }), _jsx("span", { children: "Solve: SHA-256 of each number, first 8 hex chars" })] }), _jsxs("div", { class: "docs-flow-step", children: [_jsx("span", { class: "docs-flow-arrow", children: "3." }), _jsxs("span", { children: [_jsx("code", { children: "POST /v1/token/verify" }), " \u2014 submit solution, receive JWT + human_link"] })] }), _jsxs("div", { class: "docs-flow-step", children: [_jsx("span", { class: "docs-flow-arrow", children: "4." }), _jsxs("span", { children: ["Use ", _jsx("code", { children: "Authorization: Bearer <access_token>" }), " on protected endpoints"] })] })] }), _jsxs(Endpoint, { method: "GET", path: "/v1/token", desc: "Get challenge for JWT flow", children: [_jsx("div", { class: "docs-label", children: "Query Parameters" }), _jsxs("table", { class: "docs-param-table", children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: "Name" }), _jsx("th", { children: "Type" }), _jsx("th", { children: "Description" })] }) }), _jsxs("tbody", { children: [_jsxs("tr", { children: [_jsx("td", { children: _jsx("span", { class: "docs-param-name", children: "ts" }) }), _jsx("td", { children: _jsx("span", { class: "docs-param-type", children: "integer" }) }), _jsx("td", { children: "Client timestamp (ms) for RTT compensation" })] }), _jsxs("tr", { children: [_jsx("td", { children: _jsx("span", { class: "docs-param-name", children: "audience" }) }), _jsx("td", { children: _jsx("span", { class: "docs-param-type", children: "string" }) }), _jsx("td", { children: "Audience claim for scoped tokens (e.g. service URL)" })] }), _jsxs("tr", { children: [_jsx("td", { children: _jsx("span", { class: "docs-param-name", children: "app_id" }) }), _jsx("td", { children: _jsx("span", { class: "docs-param-type", children: "string" }) }), _jsx("td", { children: "Multi-tenant app ID" })] })] })] })] }), _jsxs(Endpoint, { method: "POST", path: "/v1/token/verify", desc: "Submit solution, receive JWT", children: [_jsx("div", { class: "docs-label", children: "Request Body" }), _jsx("pre", { children: _jsx("code", { children: `{
|
|
468
|
+
"id": "<challenge_id>",
|
|
469
|
+
"answers": ["hash1", "hash2", "hash3", "hash4", "hash5"],
|
|
470
|
+
"audience": "https://api.example.com", // optional
|
|
471
|
+
"bind_ip": true // optional
|
|
472
|
+
}` }) }), _jsx("div", { class: "docs-label", children: "Response" }), _jsx("pre", { children: _jsx("code", { children: `{
|
|
473
|
+
"success": true,
|
|
474
|
+
"access_token": "eyJ...",
|
|
475
|
+
"expires_in": 300,
|
|
476
|
+
"refresh_token": "eyJ...",
|
|
477
|
+
"refresh_expires_in": 3600,
|
|
478
|
+
"human_link": "https://botcha.ai/go/BOTCHA-ABC123",
|
|
479
|
+
"human_code": "BOTCHA-ABC123",
|
|
480
|
+
"solveTimeMs": 47
|
|
481
|
+
}` }) })] }), _jsxs(Endpoint, { method: "POST", path: "/v1/token/refresh", desc: "Refresh access token", children: [_jsx("div", { class: "docs-label", children: "Request Body" }), _jsx("pre", { children: _jsx("code", { children: `{ "refresh_token": "<refresh_token>" }` }) }), _jsx("div", { class: "docs-label", children: "Response" }), _jsx("pre", { children: _jsx("code", { children: `{
|
|
482
|
+
"success": true,
|
|
483
|
+
"access_token": "eyJ...",
|
|
484
|
+
"expires_in": 300
|
|
485
|
+
}` }) })] }), _jsxs(Endpoint, { method: "POST", path: "/v1/token/revoke", desc: "Revoke a token", children: [_jsx("div", { class: "docs-label", children: "Request Body" }), _jsx("pre", { children: _jsx("code", { children: `{ "token": "<access_token or refresh_token>" }` }) })] }), _jsxs(Endpoint, { method: "POST", path: "/v1/token/validate", desc: "Validate a token remotely (no secret needed)", children: [_jsx("p", { children: "Validate any BOTCHA token without needing the signing secret. Supports both ES256 and HS256 tokens." }), _jsx("div", { class: "docs-label", children: "Request Body" }), _jsx("pre", { children: _jsx("code", { children: `{ "token": "<any BOTCHA JWT token>" }` }) }), _jsx("div", { class: "docs-label", children: "Response" }), _jsx("pre", { children: _jsx("code", { children: `{
|
|
486
|
+
"valid": true,
|
|
487
|
+
"payload": {
|
|
488
|
+
"sub": "challenge_abc123",
|
|
489
|
+
"type": "botcha-verified",
|
|
490
|
+
"aud": "https://api.example.com",
|
|
491
|
+
"exp": 1770936300
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
// or if invalid:
|
|
496
|
+
{
|
|
497
|
+
"valid": false,
|
|
498
|
+
"error": "Token expired"
|
|
499
|
+
}` }) })] }), _jsx(Endpoint, { method: "GET", path: "/agent-only", desc: "Protected endpoint (demo)", children: _jsxs("p", { children: ["Requires ", _jsx("code", { children: "Authorization: Bearer <access_token>" }), " header. Returns agent identity information."] }) })] }), _jsxs("section", { id: "apps", class: "docs-section", children: [_jsx("h2", { class: "docs-section-title", children: "Apps (Multi-Tenant)" }), _jsx("p", { class: "docs-section-desc", children: "Create isolated apps with unique credentials. Each app gets its own rate limit bucket and token scoping. Email required for account recovery." }), _jsxs(Endpoint, { method: "POST", path: "/v1/apps", desc: "Create a new app", children: [_jsx("div", { class: "docs-label", children: "Request Body" }), _jsx("pre", { children: _jsx("code", { children: `{ "email": "human@example.com" }` }) }), _jsx("div", { class: "docs-label", children: "Response" }), _jsx("pre", { children: _jsx("code", { children: `{
|
|
500
|
+
"success": true,
|
|
501
|
+
"app_id": "app_b18545f37eee64c4",
|
|
502
|
+
"app_secret": "sk_...", // shown ONCE
|
|
503
|
+
"email": "human@example.com",
|
|
504
|
+
"email_verified": false
|
|
505
|
+
}` }) })] }), _jsx(Endpoint, { method: "GET", path: "/v1/apps/:id", desc: "Get app info" }), _jsxs(Endpoint, { method: "POST", path: "/v1/apps/:id/verify-email", desc: "Verify email with 6-digit code", children: [_jsx("div", { class: "docs-label", children: "Request Body" }), _jsx("pre", { children: _jsx("code", { children: `{ "code": "123456" }` }) })] }), _jsx(Endpoint, { method: "POST", path: "/v1/apps/:id/resend-verification", desc: "Resend verification email" }), _jsx(Endpoint, { method: "POST", path: "/v1/apps/:id/rotate-secret", desc: "Rotate app secret (auth required)" }), _jsxs(Endpoint, { method: "POST", path: "/v1/auth/recover", desc: "Account recovery via verified email", children: [_jsx("div", { class: "docs-label", children: "Request Body" }), _jsx("pre", { children: _jsx("code", { children: `{ "email": "human@example.com" }` }) })] })] }), _jsxs("section", { id: "agents", class: "docs-section", children: [_jsx("h2", { class: "docs-section-title", children: "Agent Registry" }), _jsx("p", { class: "docs-section-desc", children: "Register persistent identities for your AI agents. Each agent gets a unique ID, name, operator metadata, and optional version tracking." }), _jsxs(Endpoint, { method: "POST", path: "/v1/agents/register", desc: "Register agent identity", children: [_jsx("div", { class: "docs-label", children: "Request Body" }), _jsx("pre", { children: _jsx("code", { children: `{
|
|
506
|
+
"name": "shopping-agent",
|
|
507
|
+
"operator": "my-company",
|
|
508
|
+
"version": "1.0.0",
|
|
509
|
+
"app_id": "app_..."
|
|
510
|
+
}` }) })] }), _jsx(Endpoint, { method: "GET", path: "/v1/agents/:id", desc: "Get agent by ID (public, no auth)" }), _jsx(Endpoint, { method: "GET", path: "/v1/agents", desc: "List agents for your app (auth required)" })] }), _jsxs("section", { id: "tap", class: "docs-section", children: [_jsx("h2", { class: "docs-section-title", children: "TAP (Trusted Agent Protocol)" }), _jsxs("p", { class: "docs-section-desc", children: ["Enterprise-grade cryptographic agent auth using HTTP Message Signatures (RFC 9421). Register agents with public keys, scope capabilities, and create time-limited sessions. Based on ", _jsx("a", { href: "https://developer.visa.com/capabilities/trusted-agent-protocol/overview", children: "Visa's TAP" }), "."] }), _jsxs(Endpoint, { method: "POST", path: "/v1/agents/register/tap", desc: "Register TAP agent with public key", children: [_jsx("div", { class: "docs-label", children: "Request Body" }), _jsx("pre", { children: _jsx("code", { children: `{
|
|
511
|
+
"name": "shopping-agent",
|
|
512
|
+
"public_key": "<Ed25519 public key>",
|
|
513
|
+
"signature_algorithm": "ed25519",
|
|
514
|
+
"capabilities": [
|
|
515
|
+
{"action": "browse", "resource": "products"},
|
|
516
|
+
{"action": "purchase", "resource": "orders"}
|
|
517
|
+
],
|
|
518
|
+
"trust_level": "verified",
|
|
519
|
+
"app_id": "app_..."
|
|
520
|
+
}` }) })] }), _jsx(Endpoint, { method: "GET", path: "/v1/agents/:id/tap", desc: "Get TAP agent details (includes public key)" }), _jsx(Endpoint, { method: "GET", path: "/v1/agents/tap", desc: "List TAP-enabled agents" }), _jsxs(Endpoint, { method: "POST", path: "/v1/sessions/tap", desc: "Create TAP session with intent", children: [_jsx("div", { class: "docs-label", children: "Request Body" }), _jsx("pre", { children: _jsx("code", { children: `{
|
|
521
|
+
"agent_id": "agent_...",
|
|
522
|
+
"user_context": { "name": "User" },
|
|
523
|
+
"intent": {
|
|
524
|
+
"action": "browse",
|
|
525
|
+
"resource": "products",
|
|
526
|
+
"duration": "1h"
|
|
527
|
+
}
|
|
528
|
+
}` }) })] }), _jsx(Endpoint, { method: "GET", path: "/v1/sessions/:id/tap", desc: "Get TAP session info" }), _jsx(Endpoint, { method: "POST", path: "/v1/agents/:id/tap/rotate-key", desc: "Rotate agent's key pair" })] }), _jsxs("section", { id: "delegation", class: "docs-section", children: [_jsx("h2", { class: "docs-section-title", children: "Delegation Chains" }), _jsx("p", { class: "docs-section-desc", children: "Delegate capabilities from one agent to another. Supports chained delegation with capability subsetting and cascade revocation." }), _jsxs(Endpoint, { method: "POST", path: "/v1/delegations", desc: "Create delegation (grantor to grantee)", children: [_jsx("div", { class: "docs-label", children: "Request Body" }), _jsx("pre", { children: _jsx("code", { children: `{
|
|
529
|
+
"grantor_id": "agent_aaa",
|
|
530
|
+
"grantee_id": "agent_bbb",
|
|
531
|
+
"capabilities": [
|
|
532
|
+
{"action": "browse", "resource": "products"}
|
|
533
|
+
],
|
|
534
|
+
"ttl": 3600
|
|
535
|
+
}` }) })] }), _jsx(Endpoint, { method: "GET", path: "/v1/delegations/:id", desc: "Get delegation details" }), _jsx(Endpoint, { method: "GET", path: "/v1/delegations", desc: "List delegations (?agent_id=&direction=in|out|both)" }), _jsx(Endpoint, { method: "POST", path: "/v1/delegations/:id/revoke", desc: "Revoke delegation (cascades)" })] }), _jsxs("section", { id: "attestation", class: "docs-section", children: [_jsx("h2", { class: "docs-section-title", children: "Capability Attestation" }), _jsxs("p", { class: "docs-section-desc", children: ["Issue attestation tokens with fine-grained can/cannot rules using", _jsx("code", { children: "action:resource" }), " patterns. Supports wildcards. Deny rules take precedence over allow rules."] }), _jsxs(Endpoint, { method: "POST", path: "/v1/attestations", desc: "Issue attestation token", children: [_jsx("div", { class: "docs-label", children: "Request Body" }), _jsx("pre", { children: _jsx("code", { children: `{
|
|
536
|
+
"agent_id": "agent_...",
|
|
537
|
+
"can": ["read:products", "browse:*"],
|
|
538
|
+
"cannot": ["purchase:*"],
|
|
539
|
+
"ttl": 3600
|
|
540
|
+
}` }) })] }), _jsx(Endpoint, { method: "GET", path: "/v1/attestations/:id", desc: "Get attestation details" }), _jsx(Endpoint, { method: "GET", path: "/v1/attestations", desc: "List attestations (?agent_id=)" }), _jsx(Endpoint, { method: "POST", path: "/v1/attestations/:id/revoke", desc: "Revoke attestation" })] }), _jsxs("section", { id: "reputation", class: "docs-section", children: [_jsx("h2", { class: "docs-section-title", children: "Agent Reputation" }), _jsx("p", { class: "docs-section-desc", children: "Score-based reputation system (0-1000) with 5 tiers. Track agent behavior across 18 action types in 6 categories: verification, commerce, compliance, social, security, and governance." }), _jsxs(Endpoint, { method: "GET", path: "/v1/reputation/:agent_id", desc: "Get agent reputation score", children: [_jsx("div", { class: "docs-label", children: "Response Example" }), _jsx("pre", { children: _jsx("code", { children: `{
|
|
541
|
+
"agent_id": "agent_...",
|
|
542
|
+
"score": 750,
|
|
543
|
+
"tier": "trusted",
|
|
544
|
+
"event_count": 42
|
|
545
|
+
}` }) })] }), _jsxs(Endpoint, { method: "POST", path: "/v1/reputation/events", desc: "Record a reputation event", children: [_jsx("div", { class: "docs-label", children: "Request Body" }), _jsx("pre", { children: _jsx("code", { children: `{
|
|
546
|
+
"agent_id": "agent_...",
|
|
547
|
+
"category": "commerce",
|
|
548
|
+
"action": "purchase_completed",
|
|
549
|
+
"metadata": { "amount": 29.99 }
|
|
550
|
+
}` }) })] }), _jsx(Endpoint, { method: "GET", path: "/v1/reputation/:agent_id/events", desc: "List events (?category=&limit=)" }), _jsx(Endpoint, { method: "POST", path: "/v1/reputation/:agent_id/reset", desc: "Reset reputation (admin)" })] }), _jsxs("section", { id: "invoices", class: "docs-section", children: [_jsx("h2", { class: "docs-section-title", children: "Invoices (402 Micropayments)" }), _jsx("p", { class: "docs-section-desc", children: "Create invoices for gated content using the 402 Payment Required flow. Supports Browsing IOU verification for agent commerce." }), _jsx(Endpoint, { method: "POST", path: "/v1/invoices", desc: "Create invoice for gated content" }), _jsx(Endpoint, { method: "GET", path: "/v1/invoices/:id", desc: "Get invoice details" }), _jsx(Endpoint, { method: "POST", path: "/v1/invoices/:id/verify-iou", desc: "Verify Browsing IOU" })] }), _jsxs("section", { id: "verification", class: "docs-section", children: [_jsx("h2", { class: "docs-section-title", children: "Verification" }), _jsx("p", { class: "docs-section-desc", children: "Cross-cutting verification endpoints for validating delegation chains, attestation tokens, consumer identities, and payment containers." }), _jsx(Endpoint, { method: "POST", path: "/v1/verify/delegation", desc: "Verify entire delegation chain" }), _jsx(Endpoint, { method: "POST", path: "/v1/verify/attestation", desc: "Verify attestation + check capability" }), _jsx(Endpoint, { method: "POST", path: "/v1/verify/consumer", desc: "Verify Agentic Consumer (Layer 2)" }), _jsx(Endpoint, { method: "POST", path: "/v1/verify/payment", desc: "Verify Payment Container (Layer 3)" })] }), _jsxs("section", { id: "discovery", class: "docs-section", children: [_jsx("h2", { class: "docs-section-title", children: "Discovery & Keys" }), _jsx("p", { class: "docs-section-desc", children: "Standard discovery endpoints for AI agents and key management infrastructure." }), _jsx(Endpoint, { method: "GET", path: "/.well-known/jwks", desc: "JWK Set for TAP agents (Visa spec)" }), _jsx(Endpoint, { method: "GET", path: "/v1/keys", desc: "List keys (?keyID= for Visa compat)" }), _jsx(Endpoint, { method: "GET", path: "/v1/keys/:keyId", desc: "Get specific key by ID" }), _jsx(Endpoint, { method: "GET", path: "/openapi.json", desc: "OpenAPI 3.1.0 specification" }), _jsx(Endpoint, { method: "GET", path: "/ai.txt", desc: "AI agent discovery file" }), _jsx(Endpoint, { method: "GET", path: "/.well-known/ai-plugin.json", desc: "AI plugin manifest" }), _jsx(Endpoint, { method: "GET", path: "/health", desc: "Health check" })] }), _jsxs("section", { id: "dashboard-auth", class: "docs-section", children: [_jsx("h2", { class: "docs-section-title", children: "Dashboard Auth" }), _jsx("p", { class: "docs-section-desc", children: "Agent-first authentication for the metrics dashboard. Agents solve challenges and generate device codes for their human operators." }), _jsx(Endpoint, { method: "POST", path: "/v1/auth/device-code", desc: "Get challenge for device code flow" }), _jsx(Endpoint, { method: "POST", path: "/v1/auth/device-code/verify", desc: "Solve challenge, get BOTCHA-XXXX code" }), _jsx(Endpoint, { method: "GET", path: "/dashboard", desc: "Metrics dashboard (login required)" })] }), _jsxs("section", { id: "ratelimits", class: "docs-section", children: [_jsx("h2", { class: "docs-section-title", children: "Rate Limits" }), _jsx("p", { class: "docs-section-desc", children: "Free tier includes generous rate limits. Each app gets an isolated rate limit bucket. Rate limit headers are included on every response." }), _jsxs("div", { class: "docs-rate-limit", children: [_jsxs("div", { class: "docs-rate-limit-item", children: [_jsx("div", { class: "docs-rate-limit-value", children: "100" }), "challenges / hour / IP"] }), _jsxs("div", { class: "docs-rate-limit-item", children: [_jsx("div", { class: "docs-rate-limit-value", children: "5 min" }), "access token lifetime"] }), _jsxs("div", { class: "docs-rate-limit-item", children: [_jsx("div", { class: "docs-rate-limit-value", children: "1 hr" }), "refresh token lifetime"] })] }), _jsxs("div", { class: "docs-flow", children: [_jsx("div", { class: "docs-flow-title", children: "Response Headers" }), _jsx("pre", { children: _jsx("code", { children: `X-RateLimit-Limit: 100
|
|
551
|
+
X-RateLimit-Remaining: 97
|
|
552
|
+
X-RateLimit-Reset: 2026-02-15T12:00:00.000Z
|
|
553
|
+
X-Botcha-Version: ${version}
|
|
554
|
+
X-Botcha-Enabled: true
|
|
555
|
+
X-Botcha-Methods: speed-challenge,reasoning-challenge,...` }) })] })] })] }), _jsx(GlobalFooter, { version: version }), _jsx("script", { dangerouslySetInnerHTML: { __html: TOGGLE_SCRIPT } })] })] }));
|
|
556
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../src/dashboard/layout.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAKtD;;;;GAIG;AACH,eAAO,MAAM,MAAM,EAAE,EAAE,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAuBA,CAAC;AAIF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,IAAI,EAAE,EAAE,CAAC,iBAAiB,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAmBzF,CAAC;AAIF;;;GAGG;AACH,eAAO,MAAM,YAAY,EAAE,EAAE,CAAC;IAAE,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,
|
|
1
|
+
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../src/dashboard/layout.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAKtD;;;;GAIG;AACH,eAAO,MAAM,MAAM,EAAE,EAAE,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAuBA,CAAC;AAIF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,IAAI,EAAE,EAAE,CAAC,iBAAiB,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAmBzF,CAAC;AAIF;;;GAGG;AACH,eAAO,MAAM,YAAY,EAAE,EAAE,CAAC;IAAE,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CAmCjD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,OAAO,EAAE,EAAE,CAAC;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAExC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,EAAE,CAAC,iBAAiB,CAAC;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAqCvG,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,WAAW,EAAE,EAAE,CAAC,iBAAiB,CAAC;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAwBnF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC,iBAAiB,CAAC;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CAiDpE,CAAC"}
|
package/dist/dashboard/layout.js
CHANGED
|
@@ -32,7 +32,7 @@ export const Card = ({ children, title, badge, class: className, }) => {
|
|
|
32
32
|
*/
|
|
33
33
|
export const GlobalFooter = ({ version = '0.15.0' }) => {
|
|
34
34
|
const year = new Date().getFullYear();
|
|
35
|
-
return (_jsx("footer", { class: "global-footer", children: _jsxs("div", { class: "global-footer-inner", children: [_jsx("a", { href: "/dashboard", class: "global-footer-dashboard", children: "Dashboard" }), _jsxs("div", { class: "global-footer-links", children: [_jsxs("span", { children: ["v", version] }), _jsx("span", { class: "global-footer-sep", children: "\u00B7" }), _jsx("a", { href: "https://botcha.ai", children: "botcha.ai" }), _jsx("span", { class: "global-footer-sep", children: "\u00B7" }), _jsx("a", { href: "/whitepaper", children: "Whitepaper" }), _jsx("span", { class: "global-footer-sep", children: "\u00B7" }), _jsx("a", { href: "/openapi.json", children: "OpenAPI" }), _jsx("span", { class: "global-footer-sep", children: "\u00B7" }), _jsx("a", { href: "/ai.txt", children: "ai.txt" }), _jsx("span", { class: "global-footer-sep", children: "\u00B7" }), _jsx("a", { href: "https://github.com/dupe-com/botcha", children: "GitHub" }), _jsx("span", { class: "global-footer-sep", children: "\u00B7" }), _jsx("a", { href: "https://www.npmjs.com/package/@dupecom/botcha", children: "npm" }), _jsx("span", { class: "global-footer-sep", children: "\u00B7" }), _jsx("a", { href: "https://pypi.org/project/botcha/", children: "PyPI" })] }), _jsxs("div", { class: "global-footer-legal", children: ["\u00A9 ", year, " ", _jsx("a", { href: "https://dupe.com", children: "Dupe.com" }), _jsx("span", { class: "global-footer-sep", children: "\u00B7" }), "Free and open source", _jsx("span", { class: "global-footer-sep", children: "\u00B7" }), _jsx("a", { href: "https://github.com/i8ramin", children: "@i8ramin" })] })] }) }));
|
|
35
|
+
return (_jsx("footer", { class: "global-footer", children: _jsxs("div", { class: "global-footer-inner", children: [_jsx("a", { href: "/dashboard", class: "global-footer-dashboard", children: "Dashboard" }), _jsxs("div", { class: "global-footer-links", children: [_jsxs("span", { children: ["v", version] }), _jsx("span", { class: "global-footer-sep", children: "\u00B7" }), _jsx("a", { href: "https://botcha.ai", children: "botcha.ai" }), _jsx("span", { class: "global-footer-sep", children: "\u00B7" }), _jsx("a", { href: "/docs", children: "Docs" }), _jsx("span", { class: "global-footer-sep", children: "\u00B7" }), _jsx("a", { href: "/whitepaper", children: "Whitepaper" }), _jsx("span", { class: "global-footer-sep", children: "\u00B7" }), _jsx("a", { href: "/openapi.json", children: "OpenAPI" }), _jsx("span", { class: "global-footer-sep", children: "\u00B7" }), _jsx("a", { href: "/ai.txt", children: "ai.txt" }), _jsx("span", { class: "global-footer-sep", children: "\u00B7" }), _jsx("a", { href: "https://github.com/dupe-com/botcha", children: "GitHub" }), _jsx("span", { class: "global-footer-sep", children: "\u00B7" }), _jsx("a", { href: "https://www.npmjs.com/package/@dupecom/botcha", children: "npm" }), _jsx("span", { class: "global-footer-sep", children: "\u00B7" }), _jsx("a", { href: "https://pypi.org/project/botcha/", children: "PyPI" })] }), _jsxs("div", { class: "global-footer-legal", children: ["\u00A9 ", year, " ", _jsx("a", { href: "https://dupe.com", children: "Dupe.com" }), _jsx("span", { class: "global-footer-sep", children: "\u00B7" }), "Free and open source", _jsx("span", { class: "global-footer-sep", children: "\u00B7" }), _jsx("a", { href: "https://github.com/i8ramin", children: "@i8ramin" })] })] }) }));
|
|
36
36
|
};
|
|
37
37
|
/**
|
|
38
38
|
* Divider with centered text, used between sections on auth pages.
|
|
@@ -405,7 +405,7 @@ const token = await client.getToken();` }) }), _jsxs("p", { children: [_jsx("str
|
|
|
405
405
|
|
|
406
406
|
async with BotchaClient() as client:
|
|
407
407
|
response = await client.fetch("https://api.example.com/products")
|
|
408
|
-
token = await client.get_token()` }) }), _jsx("h3", { children: "Server-side verification (for API providers)" }), _jsx("p", { children: _jsx("strong", { children: "Express:" }) }), _jsx("pre", { children: _jsx("code", { children: `import { botchaVerify } from '@botcha
|
|
408
|
+
token = await client.get_token()` }) }), _jsx("h3", { children: "Server-side verification (for API providers)" }), _jsx("p", { children: _jsx("strong", { children: "Express:" }) }), _jsx("pre", { children: _jsx("code", { children: `import { botchaVerify } from '@dupecom/botcha-verify';
|
|
409
409
|
app.get('/api/products', botchaVerify({ secret }), handler);` }) }), _jsx("p", { children: _jsx("strong", { children: "FastAPI:" }) }), _jsx("pre", { children: _jsx("code", { children: `from botcha_verify import BotchaVerify
|
|
410
410
|
botcha = BotchaVerify(secret=os.environ["BOTCHA_SECRET"])
|
|
411
411
|
|
package/dist/index.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ type Bindings = {
|
|
|
18
18
|
INVOICES: KVNamespace;
|
|
19
19
|
ANALYTICS?: AnalyticsEngineDataset;
|
|
20
20
|
JWT_SECRET: string;
|
|
21
|
+
JWT_SIGNING_KEY?: string;
|
|
21
22
|
BOTCHA_VERSION: string;
|
|
22
23
|
};
|
|
23
24
|
type Variables = {
|
|
@@ -35,7 +36,7 @@ declare const app: Hono<{
|
|
|
35
36
|
}, import("hono/types").BlankSchema, "/">;
|
|
36
37
|
export default app;
|
|
37
38
|
export { generateSpeedChallenge, verifySpeedChallenge, generateStandardChallenge, verifyStandardChallenge, generateReasoningChallenge, verifyReasoningChallenge, generateHybridChallenge, verifyHybridChallenge, solveSpeedChallenge, } from './challenges';
|
|
38
|
-
export { generateToken, verifyToken } from './auth';
|
|
39
|
+
export { generateToken, verifyToken, getSigningPublicKeyJWK } from './auth';
|
|
39
40
|
export { checkRateLimit } from './rate-limit';
|
|
40
41
|
export { generateBadge, verifyBadge, createBadgeResponse, generateBadgeSvg, generateBadgeHtml, generateShareText, type BadgeMethod, type BadgePayload, type Badge, type ShareFormats, } from './badge';
|
|
41
42
|
//# sourceMappingURL=index.d.ts.map
|