Skip to content

Commit 23dc7cb

Browse files
committed
feat: add bot authentication endpoint with JWT token support
1 parent a5dc57b commit 23dc7cb

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

src/pages/api/v1/README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,24 @@ A comprehensive REST API implementation for the multisig wallet application, pro
264264
- **Response**: JWT token object
265265
- **Error Handling**: 400 (validation), 401 (signature), 500 (server)
266266

267+
#### `botAuth.ts` - POST `/api/v1/botAuth`
268+
269+
- **Purpose**: Authenticate a bot key and return a bot-scoped JWT bearer token
270+
- **Authentication**: Not required (public endpoint; credentials in request body)
271+
- **Features**:
272+
- Bot key secret verification against stored hash
273+
- Minimum scope enforcement (`multisig:read`)
274+
- BotUser upsert with payment and optional stake address
275+
- Address uniqueness enforcement across bot keys (409 on conflict)
276+
- Strict rate limiting (15 requests per window) and 2 KB body size cap
277+
- **Request Body**:
278+
- `botKeyId`: Bot key identifier (required)
279+
- `secret`: Bot key secret (required)
280+
- `paymentAddress`: Bot's Cardano payment address (required, min 20 chars)
281+
- `stakeAddress`: Bot's stake address (optional)
282+
- **Response**: `{ token, botId }` — JWT payload contains `{ address, botId, type: "bot" }`
283+
- **Error Handling**: 400 (validation), 401 (invalid key/secret), 403 (insufficient scope), 405 (method), 409 (address conflict), 429 (rate limit), 500 (server)
284+
267285
### Utility Endpoints
268286

269287
#### `og.ts` - GET `/api/v1/og`

0 commit comments

Comments
 (0)