@dupecom/botcha 0.11.0 → 0.13.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 +82 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -36,6 +36,7 @@ Use cases:
|
|
|
36
36
|
- 📧 Email verification, account recovery, and secret rotation
|
|
37
37
|
- 🤖 Agent-first dashboard auth (challenge-based login + device code handoff)
|
|
38
38
|
- 🆔 Persistent agent identities with registry
|
|
39
|
+
- 🔏 Trusted Agent Protocol (TAP) — cryptographic agent auth with HTTP Message Signatures
|
|
39
40
|
|
|
40
41
|
## Install
|
|
41
42
|
|
|
@@ -122,10 +123,11 @@ BOTCHA uses **OAuth2-style token rotation** with short-lived access tokens and l
|
|
|
122
123
|
### Token Flow
|
|
123
124
|
|
|
124
125
|
```
|
|
125
|
-
1. Solve challenge → receive access_token (5min) + refresh_token (1hr)
|
|
126
|
+
1. Solve challenge → receive access_token (5min) + refresh_token (1hr) + human_link
|
|
126
127
|
2. Use access_token for API calls
|
|
127
|
-
3.
|
|
128
|
-
4. When
|
|
128
|
+
3. Give human_link to your human → they click it → instant browser access via /go/:code
|
|
129
|
+
4. When access_token expires → POST /v1/token/refresh with refresh_token
|
|
130
|
+
5. When compromised → POST /v1/token/revoke to invalidate immediately
|
|
129
131
|
```
|
|
130
132
|
|
|
131
133
|
### Security Features
|
|
@@ -160,7 +162,7 @@ async with BotchaClient(audience="https://api.example.com") as client:
|
|
|
160
162
|
| Endpoint | Description |
|
|
161
163
|
|----------|-------------|
|
|
162
164
|
| `GET /v1/token` | Get challenge for token flow |
|
|
163
|
-
| `POST /v1/token/verify` | Submit solution → receive `access_token` + `refresh_token` |
|
|
165
|
+
| `POST /v1/token/verify` | Submit solution → receive `access_token` + `refresh_token` + `human_link` |
|
|
164
166
|
| `POST /v1/token/refresh` | Exchange `refresh_token` for new `access_token` |
|
|
165
167
|
| `POST /v1/token/revoke` | Invalidate any token immediately |
|
|
166
168
|
|
|
@@ -356,6 +358,81 @@ curl -X POST "https://botcha.ai/v1/agents/register?app_id=app_abc123" \
|
|
|
356
358
|
|
|
357
359
|
> **Note:** Agent Registry is the foundation for future features like delegation chains, capability attestation, and reputation scoring. See [ROADMAP.md](./ROADMAP.md) for details.
|
|
358
360
|
|
|
361
|
+
## 🔏 Trusted Agent Protocol (TAP)
|
|
362
|
+
|
|
363
|
+
BOTCHA v0.12.0 introduces the **Trusted Agent Protocol** — enterprise-grade cryptographic agent authentication using HTTP Message Signatures (RFC 9421).
|
|
364
|
+
|
|
365
|
+
### Why TAP?
|
|
366
|
+
|
|
367
|
+
- **Cryptographic Identity**: Agents register public keys and sign requests — no more shared secrets
|
|
368
|
+
- **Capability Scoping**: Define exactly what an agent can do (`read:invoices`, `write:transfers`)
|
|
369
|
+
- **Intent Verification**: Every session requires a declared intent that's validated against capabilities
|
|
370
|
+
- **Trust Levels**: `basic`, `verified`, `enterprise` — different access tiers for different agents
|
|
371
|
+
|
|
372
|
+
### Registering a TAP Agent
|
|
373
|
+
|
|
374
|
+
```bash
|
|
375
|
+
# Register with public key and capabilities
|
|
376
|
+
curl -X POST "https://botcha.ai/v1/agents/register/tap?app_id=app_abc123" \
|
|
377
|
+
-H "Content-Type: application/json" \
|
|
378
|
+
-d '{
|
|
379
|
+
"name": "enterprise-agent",
|
|
380
|
+
"operator": "Acme Corp",
|
|
381
|
+
"version": "2.0.0",
|
|
382
|
+
"public_key": "-----BEGIN PUBLIC KEY-----\nMFkw...\n-----END PUBLIC KEY-----",
|
|
383
|
+
"signature_algorithm": "ecdsa-p256-sha256",
|
|
384
|
+
"trust_level": "enterprise",
|
|
385
|
+
"capabilities": [
|
|
386
|
+
{"action": "read", "resource": "/api/invoices"},
|
|
387
|
+
{"action": "write", "resource": "/api/orders", "constraints": {"max_amount": 10000}}
|
|
388
|
+
]
|
|
389
|
+
}'
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
### Creating a TAP Session
|
|
393
|
+
|
|
394
|
+
```bash
|
|
395
|
+
# Create session with intent declaration
|
|
396
|
+
curl -X POST https://botcha.ai/v1/sessions/tap \
|
|
397
|
+
-H "Content-Type: application/json" \
|
|
398
|
+
-d '{
|
|
399
|
+
"agent_id": "agent_xyz789",
|
|
400
|
+
"user_context": "user_123",
|
|
401
|
+
"intent": {
|
|
402
|
+
"action": "read",
|
|
403
|
+
"resource": "/api/invoices",
|
|
404
|
+
"purpose": "Monthly billing report"
|
|
405
|
+
}
|
|
406
|
+
}'
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
### TAP Endpoints
|
|
410
|
+
|
|
411
|
+
| Endpoint | Description |
|
|
412
|
+
|----------|-------------|
|
|
413
|
+
| `POST /v1/agents/register/tap` | Register TAP agent with public key + capabilities |
|
|
414
|
+
| `GET /v1/agents/:id/tap` | Get TAP agent details (includes public key) |
|
|
415
|
+
| `GET /v1/agents/tap` | List TAP-enabled agents for app |
|
|
416
|
+
| `POST /v1/sessions/tap` | Create TAP session with intent validation |
|
|
417
|
+
| `GET /v1/sessions/:id/tap` | Get TAP session info |
|
|
418
|
+
|
|
419
|
+
### Express Middleware (Verification Modes)
|
|
420
|
+
|
|
421
|
+
```typescript
|
|
422
|
+
import { createTAPVerifyMiddleware } from '@dupecom/botcha/middleware';
|
|
423
|
+
|
|
424
|
+
// Mode: 'tap' — require TAP signature
|
|
425
|
+
app.use('/api', createTAPVerifyMiddleware({ mode: 'tap', secret: process.env.BOTCHA_SECRET }));
|
|
426
|
+
|
|
427
|
+
// Mode: 'flexible' — accept TAP signature OR challenge token
|
|
428
|
+
app.use('/api', createTAPVerifyMiddleware({ mode: 'flexible', secret: process.env.BOTCHA_SECRET }));
|
|
429
|
+
|
|
430
|
+
// Mode: 'challenge-only' — traditional BOTCHA challenge (backward compatible)
|
|
431
|
+
app.use('/api', createTAPVerifyMiddleware({ mode: 'challenge-only', secret: process.env.BOTCHA_SECRET }));
|
|
432
|
+
```
|
|
433
|
+
|
|
434
|
+
> **Supported algorithms:** `ecdsa-p256-sha256`, `rsa-pss-sha256`. See [ROADMAP.md](./ROADMAP.md) for details.
|
|
435
|
+
|
|
359
436
|
## 🔄 SSE Streaming Flow (AI-Native)
|
|
360
437
|
|
|
361
438
|
For AI agents that prefer a **conversational handshake**, BOTCHA offers **Server-Sent Events (SSE)** streaming:
|
|
@@ -433,7 +510,7 @@ BOTCHA is designed to be auto-discoverable by AI agents through multiple standar
|
|
|
433
510
|
All responses include these headers for agent discovery:
|
|
434
511
|
|
|
435
512
|
```http
|
|
436
|
-
X-Botcha-Version: 0.
|
|
513
|
+
X-Botcha-Version: 0.12.0
|
|
437
514
|
X-Botcha-Enabled: true
|
|
438
515
|
X-Botcha-Methods: hybrid-challenge,speed-challenge,reasoning-challenge,standard-challenge
|
|
439
516
|
X-Botcha-Docs: https://botcha.ai/openapi.json
|