paygate-mcp 4.0.0 → 4.2.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 +77 -1
- package/dist/audit.d.ts +1 -1
- package/dist/audit.d.ts.map +1 -1
- package/dist/audit.js.map +1 -1
- package/dist/server.d.ts +3 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +163 -0
- package/dist/server.js.map +1 -1
- package/dist/store.d.ts +19 -0
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +76 -0
- package/dist/store.js.map +1 -1
- package/dist/webhook.d.ts +7 -0
- package/dist/webhook.d.ts.map +1 -1
- package/dist/webhook.js +31 -0
- package/dist/webhook.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -54,7 +54,7 @@ Agent → PayGate (auth + billing) → Your MCP Server (stdio or HTTP)
|
|
|
54
54
|
- **Alert Webhooks** — Configurable alerts for spending thresholds, low credits, quota warnings, key expiry, rate limit spikes
|
|
55
55
|
- **Team Management** — Group API keys into teams with shared budgets, quotas, and usage tracking
|
|
56
56
|
- **Horizontal Scaling (Redis)** — Redis-backed state for multi-process deployments with atomic credit deduction, distributed rate limiting, persistent usage audit trail, real-time pub/sub notifications, and admin API sync
|
|
57
|
-
- **Webhook Retry Queue** — Exponential backoff retry (1s, 2s, 4s...) with dead letter queue for permanently failed deliveries, admin API for monitoring and
|
|
57
|
+
- **Webhook Retry Queue** — Exponential backoff retry (1s, 2s, 4s...) with dead letter queue for permanently failed deliveries, admin API for monitoring, clearing, and replaying
|
|
58
58
|
- **Health Check + Graceful Shutdown** — `GET /health` public endpoint with status, uptime, version, in-flight requests, Redis & webhook stats; `gracefulStop()` drains in-flight requests before teardown
|
|
59
59
|
- **Config Validation + Dry Run** — `paygate-mcp validate --config paygate.json` catches misconfigurations before starting; `--dry-run` discovers tools, prints pricing table, then exits
|
|
60
60
|
- **Batch Tool Calls** — `tools/call_batch` method for calling multiple tools in one request with all-or-nothing billing, aggregate credit checks, and parallel execution
|
|
@@ -68,6 +68,7 @@ Agent → PayGate (auth + billing) → Your MCP Server (stdio or HTTP)
|
|
|
68
68
|
- **Refund on Failure** — Automatically refund credits when downstream tool calls fail
|
|
69
69
|
- **Credit Transfers** — Atomically transfer credits between API keys with validation, audit trail, and webhook events
|
|
70
70
|
- **Bulk Key Operations** — Execute multiple key operations (create, topup, revoke) in a single request with per-operation error handling and index tracking
|
|
71
|
+
- **Key Import/Export** — Export all API keys for backup/migration (JSON or CSV) and import with conflict resolution (skip, overwrite, error modes)
|
|
71
72
|
- **Webhook Filters** — Route webhook events to different destinations based on event type and API key prefix with per-filter secrets, independent retry queues, and admin CRUD API
|
|
72
73
|
- **Webhook Events** — POST batched usage events to any URL for external billing/alerting
|
|
73
74
|
- **Config File Mode** — Load all settings from a JSON file (`--config`)
|
|
@@ -284,6 +285,8 @@ A real-time admin UI for managing keys, viewing usage, and monitoring tool calls
|
|
|
284
285
|
| `/topup` | POST | `X-Admin-Key` | Add credits to an existing key |
|
|
285
286
|
| `/keys/transfer` | POST | `X-Admin-Key` | Transfer credits between API keys |
|
|
286
287
|
| `/keys/bulk` | POST | `X-Admin-Key` | Execute multiple key operations (create, topup, revoke) in one request |
|
|
288
|
+
| `/keys/export` | GET | `X-Admin-Key` | Export all API keys for backup/migration (JSON or CSV) |
|
|
289
|
+
| `/keys/import` | POST | `X-Admin-Key` | Import API keys from backup with conflict resolution |
|
|
287
290
|
| `/keys/revoke` | POST | `X-Admin-Key` | Revoke an API key |
|
|
288
291
|
| `/keys/rotate` | POST | `X-Admin-Key` | Rotate key (new key, same credits/ACL/quotas) |
|
|
289
292
|
| `/keys/acl` | POST | `X-Admin-Key` | Set tool ACL (whitelist/blacklist) on a key |
|
|
@@ -338,6 +341,7 @@ A real-time admin UI for managing keys, viewing usage, and monitoring tool calls
|
|
|
338
341
|
| `/webhooks/filters` | POST | `X-Admin-Key` | Create a webhook filter rule |
|
|
339
342
|
| `/webhooks/filters/update` | POST | `X-Admin-Key` | Update a webhook filter rule |
|
|
340
343
|
| `/webhooks/filters/delete` | POST | `X-Admin-Key` | Delete a webhook filter rule |
|
|
344
|
+
| `/webhooks/replay` | POST | `X-Admin-Key` | Replay dead letter webhook events (all or by index) |
|
|
341
345
|
| `/health` | GET | None | Health check (status, uptime, version, in-flight, Redis/webhook status) |
|
|
342
346
|
| `/` | GET | None | Root endpoint (endpoint list) |
|
|
343
347
|
|
|
@@ -548,6 +552,57 @@ Response:
|
|
|
548
552
|
|
|
549
553
|
**Audit trail:** Each successful operation logs an individual audit event with "(bulk)" suffix.
|
|
550
554
|
|
|
555
|
+
### Key Import/Export
|
|
556
|
+
|
|
557
|
+
Export all API keys for backup or migration between PayGate instances:
|
|
558
|
+
|
|
559
|
+
```bash
|
|
560
|
+
# Export as JSON (includes full key secrets)
|
|
561
|
+
curl http://localhost:3402/keys/export \
|
|
562
|
+
-H "X-Admin-Key: $ADMIN_KEY" \
|
|
563
|
+
-o paygate-keys-backup.json
|
|
564
|
+
|
|
565
|
+
# Export as CSV
|
|
566
|
+
curl "http://localhost:3402/keys/export?format=csv" \
|
|
567
|
+
-H "X-Admin-Key: $ADMIN_KEY" \
|
|
568
|
+
-o paygate-keys-backup.csv
|
|
569
|
+
|
|
570
|
+
# Export only active keys in a specific namespace
|
|
571
|
+
curl "http://localhost:3402/keys/export?activeOnly=true&namespace=production" \
|
|
572
|
+
-H "X-Admin-Key: $ADMIN_KEY"
|
|
573
|
+
```
|
|
574
|
+
|
|
575
|
+
Import keys into a PayGate instance:
|
|
576
|
+
|
|
577
|
+
```bash
|
|
578
|
+
curl -X POST http://localhost:3402/keys/import \
|
|
579
|
+
-H "X-Admin-Key: $ADMIN_KEY" \
|
|
580
|
+
-H "Content-Type: application/json" \
|
|
581
|
+
-d '{
|
|
582
|
+
"keys": [{ "key": "pg_abc123...", "name": "my-key", "credits": 500, "active": true, "tags": {} }],
|
|
583
|
+
"mode": "skip"
|
|
584
|
+
}'
|
|
585
|
+
```
|
|
586
|
+
|
|
587
|
+
Response:
|
|
588
|
+
```json
|
|
589
|
+
{
|
|
590
|
+
"total": 1,
|
|
591
|
+
"imported": 1,
|
|
592
|
+
"overwritten": 0,
|
|
593
|
+
"skipped": 0,
|
|
594
|
+
"errors": 0,
|
|
595
|
+
"mode": "skip",
|
|
596
|
+
"results": [{ "key": "pg_abc123...", "name": "my-key", "status": "imported" }]
|
|
597
|
+
}
|
|
598
|
+
```
|
|
599
|
+
|
|
600
|
+
**Conflict modes:** `skip` (default) — skip keys that already exist, `overwrite` — replace existing keys, `error` — fail on duplicate keys.
|
|
601
|
+
|
|
602
|
+
**Limits:** Maximum 1000 keys per import request. Keys must start with `pg_` prefix.
|
|
603
|
+
|
|
604
|
+
**Export formats:** JSON (full records with all fields) or CSV (key subset for spreadsheet use).
|
|
605
|
+
|
|
551
606
|
### Spending Limits
|
|
552
607
|
|
|
553
608
|
Cap the total credits any API key can spend:
|
|
@@ -604,9 +659,28 @@ npx paygate-mcp wrap --server "node server.js" \
|
|
|
604
659
|
| `/webhooks/stats` | GET | Delivery statistics (delivered, failed, pending retries, dead letters) |
|
|
605
660
|
| `/webhooks/dead-letter` | GET | List permanently failed deliveries with error details |
|
|
606
661
|
| `/webhooks/dead-letter` | DELETE | Clear dead letter queue |
|
|
662
|
+
| `/webhooks/replay` | POST | Replay dead letter events (all or by index) |
|
|
607
663
|
|
|
608
664
|
Retry attempts include an `X-PayGate-Retry` header with the attempt number for observability.
|
|
609
665
|
|
|
666
|
+
#### Webhook Event Replay
|
|
667
|
+
|
|
668
|
+
Replay permanently failed webhook events from the dead letter queue:
|
|
669
|
+
|
|
670
|
+
```bash
|
|
671
|
+
# Replay all dead letter entries
|
|
672
|
+
curl -X POST http://localhost:3402/webhooks/replay \
|
|
673
|
+
-H "X-Admin-Key: $ADMIN_KEY"
|
|
674
|
+
|
|
675
|
+
# Replay specific entries by index
|
|
676
|
+
curl -X POST http://localhost:3402/webhooks/replay \
|
|
677
|
+
-H "X-Admin-Key: $ADMIN_KEY" \
|
|
678
|
+
-H "Content-Type: application/json" \
|
|
679
|
+
-d '{ "indices": [0, 2, 5] }'
|
|
680
|
+
```
|
|
681
|
+
|
|
682
|
+
Replayed entries are removed from the dead letter queue and re-queued for fresh delivery (attempt counter resets to 0). If delivery fails again, they follow the normal retry/dead-letter flow.
|
|
683
|
+
|
|
610
684
|
#### Webhook Signatures (HMAC-SHA256)
|
|
611
685
|
|
|
612
686
|
Sign webhook payloads for tamper-proof delivery:
|
|
@@ -2032,6 +2106,8 @@ const result = await client.callTool('search', { query: 'hello' });
|
|
|
2032
2106
|
- [x] Webhook filters — Route events to multiple destinations by event type and key prefix with independent retry queues
|
|
2033
2107
|
- [x] Credit transfers — Atomically transfer credits between API keys with validation and audit trail
|
|
2034
2108
|
- [x] Bulk key operations — Execute multiple create/topup/revoke operations in one request with per-operation error handling
|
|
2109
|
+
- [x] Key import/export — Export keys (JSON/CSV) for backup/migration, import with conflict resolution (skip, overwrite, error modes)
|
|
2110
|
+
- [x] Webhook event replay — Replay dead letter entries (all or by index) with fresh delivery attempt and audit trail
|
|
2035
2111
|
|
|
2036
2112
|
## Requirements
|
|
2037
2113
|
|
package/dist/audit.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* session lifecycle, and admin operations. Ring buffer with configurable
|
|
6
6
|
* max size and age-based retention. Zero external dependencies.
|
|
7
7
|
*/
|
|
8
|
-
export type AuditEventType = 'key.created' | 'key.revoked' | 'key.rotated' | 'key.topup' | 'key.acl_updated' | 'key.expiry_updated' | 'key.quota_updated' | 'key.tags_updated' | 'key.ip_updated' | 'key.limit_updated' | 'gate.allow' | 'gate.deny' | 'session.created' | 'session.destroyed' | 'oauth.client_registered' | 'oauth.token_issued' | 'oauth.token_revoked' | 'team.created' | 'team.updated' | 'team.deleted' | 'team.key_assigned' | 'team.key_removed' | 'admin.auth_failed' | 'admin.alerts_configured' | 'webhook.dead_letter_cleared' | 'token.created' | 'token.revoked' | 'billing.refund' | 'key.auto_topup_configured' | 'key.auto_topped_up' | 'admin_key.created' | 'admin_key.revoked' | 'group.created' | 'group.updated' | 'group.deleted' | 'group.key_assigned' | 'group.key_removed' | 'key.credits_transferred' | 'webhook_filter.created' | 'webhook_filter.updated' | 'webhook_filter.deleted';
|
|
8
|
+
export type AuditEventType = 'key.created' | 'key.revoked' | 'key.rotated' | 'key.topup' | 'key.acl_updated' | 'key.expiry_updated' | 'key.quota_updated' | 'key.tags_updated' | 'key.ip_updated' | 'key.limit_updated' | 'gate.allow' | 'gate.deny' | 'session.created' | 'session.destroyed' | 'oauth.client_registered' | 'oauth.token_issued' | 'oauth.token_revoked' | 'team.created' | 'team.updated' | 'team.deleted' | 'team.key_assigned' | 'team.key_removed' | 'admin.auth_failed' | 'admin.alerts_configured' | 'webhook.dead_letter_cleared' | 'webhook.replayed' | 'token.created' | 'token.revoked' | 'billing.refund' | 'key.auto_topup_configured' | 'key.auto_topped_up' | 'admin_key.created' | 'admin_key.revoked' | 'group.created' | 'group.updated' | 'group.deleted' | 'group.key_assigned' | 'group.key_removed' | 'key.credits_transferred' | 'keys.exported' | 'keys.imported' | 'webhook_filter.created' | 'webhook_filter.updated' | 'webhook_filter.deleted';
|
|
9
9
|
export interface AuditEvent {
|
|
10
10
|
/** Monotonically increasing ID */
|
|
11
11
|
id: number;
|
package/dist/audit.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audit.d.ts","sourceRoot":"","sources":["../src/audit.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,MAAM,MAAM,cAAc,GAEtB,aAAa,GACb,aAAa,GACb,aAAa,GACb,WAAW,GACX,iBAAiB,GACjB,oBAAoB,GACpB,mBAAmB,GACnB,kBAAkB,GAClB,gBAAgB,GAChB,mBAAmB,GAEnB,YAAY,GACZ,WAAW,GAEX,iBAAiB,GACjB,mBAAmB,GAEnB,yBAAyB,GACzB,oBAAoB,GACpB,qBAAqB,GAErB,cA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E,MAAM,CAAC;QACvB,aAAa,EAAE,MAAM,CAAC;KACvB;IA0BD;;OAEG;IACH,SAAS,IAAI,UAAU,EAAE;IAIzB;;OAEG;IACH,SAAS,CAAC,CAAC,GAAE,UAAe,GAAG,MAAM;IASrC;;OAEG;IACH,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED;;OAEG;IACH,gBAAgB,IAAI,MAAM;IAS1B;;OAEG;IACH,KAAK,IAAI,IAAI;IAKb;;OAEG;IACH,OAAO,IAAI,IAAI;CAMhB;AAID,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAGnD"}
|
package/dist/audit.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audit.js","sourceRoot":"","sources":["../src/audit.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;
|
|
1
|
+
{"version":3,"file":"audit.js","sourceRoot":"","sources":["../src/audit.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAoSH,0CAGC;AAxLD,MAAM,oBAAoB,GAAmB;IAC3C,SAAS,EAAE,MAAM;IACjB,WAAW,EAAE,GAAG,EAAE,UAAU;IAC5B,iBAAiB,EAAE,MAAM,EAAE,WAAW;CACvC,CAAC;AAEF,gFAAgF;AAEhF,MAAa,WAAW;IACd,MAAM,GAAiB,EAAE,CAAC;IAC1B,MAAM,GAAG,CAAC,CAAC;IACF,MAAM,CAAiB;IAChC,YAAY,GAA0C,IAAI,CAAC;IAEnE,YAAY,MAAgC;QAC1C,IAAI,CAAC,MAAM,GAAG,EAAE,GAAG,oBAAoB,EAAE,GAAG,MAAM,EAAE,CAAC;QAErD,gCAAgC;QAChC,IAAI,IAAI,CAAC,MAAM,CAAC,iBAAiB,GAAG,CAAC,EAAE,CAAC;YACtC,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,gBAAgB,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,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,MAAM,CAAC,CAAC;QACjF,OAAO,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;IACrC,CAAC;IAED;;OAEG;IACH,KAAK;QACH,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;QACjB,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;IAClB,CAAC;IAED;;OAEG;IACH,OAAO;QACL,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YACtB,aAAa,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YACjC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;QAC3B,CAAC;IACH,CAAC;CACF;AAzKD,kCAyKC;AAED,gFAAgF;AAEhF,SAAgB,eAAe,CAAC,GAAW;IACzC,IAAI,CAAC,GAAG,IAAI,GAAG,CAAC,MAAM,GAAG,EAAE;QAAE,OAAO,KAAK,CAAC;IAC1C,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AACjD,CAAC"}
|
package/dist/server.d.ts
CHANGED
|
@@ -126,6 +126,8 @@ export declare class PayGateServer {
|
|
|
126
126
|
private handleTopUp;
|
|
127
127
|
private handleCreditTransfer;
|
|
128
128
|
private handleBulkOperations;
|
|
129
|
+
private handleKeyExport;
|
|
130
|
+
private handleKeyImport;
|
|
129
131
|
private handleRevokeKey;
|
|
130
132
|
private handleRotateKey;
|
|
131
133
|
private handleSetAcl;
|
|
@@ -160,6 +162,7 @@ export declare class PayGateServer {
|
|
|
160
162
|
private handleConfigureAlerts;
|
|
161
163
|
private handleGetDeadLetters;
|
|
162
164
|
private handleClearDeadLetters;
|
|
165
|
+
private handleWebhookReplay;
|
|
163
166
|
private handleWebhookStats;
|
|
164
167
|
private handleListWebhookFilters;
|
|
165
168
|
private handleCreateWebhookFilter;
|
package/dist/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"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A2CjB,iBAAiB;YAuDjB,iBAAiB;YAyCjB,sBAAsB;YAsDtB,wBAAwB;IAiDtC,OAAO,CAAC,mBAAmB;YAsBb,oBAAoB;YAwDpB,oBAAoB;IAsDlC;;;;OAIG;IACH;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAQxB,OAAO,CAAC,eAAe;IAUvB,OAAO,CAAC,QAAQ;IAkBV,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAqB3B;;;;;;;OAOG;IACG,YAAY,CAAC,SAAS,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;CA4CtD"}
|
package/dist/server.js
CHANGED
|
@@ -337,6 +337,10 @@ class PayGateServer {
|
|
|
337
337
|
return this.handleCreditTransfer(req, res);
|
|
338
338
|
case '/keys/bulk':
|
|
339
339
|
return this.handleBulkOperations(req, res);
|
|
340
|
+
case '/keys/export':
|
|
341
|
+
return this.handleKeyExport(req, res);
|
|
342
|
+
case '/keys/import':
|
|
343
|
+
return this.handleKeyImport(req, res);
|
|
340
344
|
case '/balance':
|
|
341
345
|
return this.handleBalance(req, res);
|
|
342
346
|
case '/limits':
|
|
@@ -375,6 +379,8 @@ class PayGateServer {
|
|
|
375
379
|
if (req.method === 'DELETE')
|
|
376
380
|
return this.handleClearDeadLetters(req, res);
|
|
377
381
|
break;
|
|
382
|
+
case '/webhooks/replay':
|
|
383
|
+
return this.handleWebhookReplay(req, res);
|
|
378
384
|
case '/webhooks/stats':
|
|
379
385
|
return this.handleWebhookStats(req, res);
|
|
380
386
|
case '/webhooks/filters':
|
|
@@ -824,6 +830,8 @@ class PayGateServer {
|
|
|
824
830
|
topUp: 'POST /topup — Add credits (requires X-Admin-Key)',
|
|
825
831
|
transfer: 'POST /keys/transfer — Transfer credits between keys (requires X-Admin-Key)',
|
|
826
832
|
bulk: 'POST /keys/bulk — Bulk key operations: create, topup, revoke (requires X-Admin-Key)',
|
|
833
|
+
keyExport: 'GET /keys/export — Export all API keys for backup/migration (requires X-Admin-Key)',
|
|
834
|
+
keyImport: 'POST /keys/import — Import API keys from backup (requires X-Admin-Key)',
|
|
827
835
|
usage: 'GET /usage — Export usage data (requires X-Admin-Key)',
|
|
828
836
|
limits: 'POST /limits — Set spending limit (requires X-Admin-Key)',
|
|
829
837
|
setQuota: 'POST /keys/quota — Set usage quota (requires X-Admin-Key)',
|
|
@@ -840,6 +848,7 @@ class PayGateServer {
|
|
|
840
848
|
analytics: 'GET /analytics — Usage analytics with time-series data (requires X-Admin-Key)',
|
|
841
849
|
alerts: 'GET /alerts — Get pending alerts + POST /alerts — Configure alert rules (requires X-Admin-Key)',
|
|
842
850
|
webhookDeadLetters: 'GET /webhooks/dead-letter — View failed webhook deliveries + DELETE to clear (requires X-Admin-Key)',
|
|
851
|
+
webhookReplay: 'POST /webhooks/replay — Replay dead letter webhook events (requires X-Admin-Key)',
|
|
843
852
|
webhookStats: 'GET /webhooks/stats — Webhook delivery statistics (requires X-Admin-Key)',
|
|
844
853
|
webhookFilters: 'GET|POST /webhooks/filters — List or create webhook filter rules (requires X-Admin-Key)',
|
|
845
854
|
updateWebhookFilter: 'POST /webhooks/filters/update — Update a webhook filter rule (requires X-Admin-Key)',
|
|
@@ -1302,6 +1311,115 @@ class PayGateServer {
|
|
|
1302
1311
|
results,
|
|
1303
1312
|
}));
|
|
1304
1313
|
}
|
|
1314
|
+
// ─── /keys/export — Export all API keys for backup ────────────────────────
|
|
1315
|
+
handleKeyExport(req, res) {
|
|
1316
|
+
if (req.method !== 'GET') {
|
|
1317
|
+
res.writeHead(405, { 'Content-Type': 'application/json' });
|
|
1318
|
+
res.end(JSON.stringify({ error: 'Method not allowed' }));
|
|
1319
|
+
return;
|
|
1320
|
+
}
|
|
1321
|
+
if (!this.checkAdmin(req, res, 'admin'))
|
|
1322
|
+
return;
|
|
1323
|
+
const urlParts = req.url?.split('?') || [];
|
|
1324
|
+
const params = new URLSearchParams(urlParts[1] || '');
|
|
1325
|
+
const namespace = params.get('namespace') || undefined;
|
|
1326
|
+
const activeOnly = params.get('activeOnly') === 'true';
|
|
1327
|
+
const format = params.get('format') || 'json';
|
|
1328
|
+
const keys = this.gate.store.exportKeys({ namespace, activeOnly });
|
|
1329
|
+
this.audit.log('keys.exported', 'admin', `Exported ${keys.length} keys`, {
|
|
1330
|
+
count: keys.length, namespace: namespace || 'all', activeOnly,
|
|
1331
|
+
});
|
|
1332
|
+
if (format === 'csv') {
|
|
1333
|
+
const headers = ['key', 'name', 'credits', 'totalSpent', 'totalCalls', 'createdAt', 'lastUsedAt', 'active', 'namespace', 'expiresAt', 'spendingLimit'];
|
|
1334
|
+
const rows = keys.map(k => headers.map(h => {
|
|
1335
|
+
const v = k[h];
|
|
1336
|
+
if (v === null || v === undefined)
|
|
1337
|
+
return '';
|
|
1338
|
+
const s = String(v);
|
|
1339
|
+
return s.includes(',') || s.includes('"') || s.includes('\n') ? `"${s.replace(/"/g, '""')}"` : s;
|
|
1340
|
+
}).join(','));
|
|
1341
|
+
const csv = [headers.join(','), ...rows].join('\n');
|
|
1342
|
+
res.writeHead(200, {
|
|
1343
|
+
'Content-Type': 'text/csv',
|
|
1344
|
+
'Content-Disposition': `attachment; filename="paygate-keys-${new Date().toISOString().slice(0, 10)}.csv"`,
|
|
1345
|
+
});
|
|
1346
|
+
res.end(csv);
|
|
1347
|
+
return;
|
|
1348
|
+
}
|
|
1349
|
+
// JSON format
|
|
1350
|
+
res.writeHead(200, {
|
|
1351
|
+
'Content-Type': 'application/json',
|
|
1352
|
+
'Content-Disposition': `attachment; filename="paygate-keys-${new Date().toISOString().slice(0, 10)}.json"`,
|
|
1353
|
+
});
|
|
1354
|
+
res.end(JSON.stringify({
|
|
1355
|
+
version: '1.0',
|
|
1356
|
+
exportedAt: new Date().toISOString(),
|
|
1357
|
+
count: keys.length,
|
|
1358
|
+
keys,
|
|
1359
|
+
}, null, 2));
|
|
1360
|
+
}
|
|
1361
|
+
// ─── /keys/import — Import API keys from backup ───────────────────────────
|
|
1362
|
+
async handleKeyImport(req, res) {
|
|
1363
|
+
if (req.method !== 'POST') {
|
|
1364
|
+
res.writeHead(405, { 'Content-Type': 'application/json' });
|
|
1365
|
+
res.end(JSON.stringify({ error: 'Method not allowed' }));
|
|
1366
|
+
return;
|
|
1367
|
+
}
|
|
1368
|
+
if (!this.checkAdmin(req, res, 'admin'))
|
|
1369
|
+
return;
|
|
1370
|
+
const body = await this.readBody(req);
|
|
1371
|
+
let params;
|
|
1372
|
+
try {
|
|
1373
|
+
params = JSON.parse(body);
|
|
1374
|
+
}
|
|
1375
|
+
catch {
|
|
1376
|
+
res.writeHead(400, { 'Content-Type': 'application/json' });
|
|
1377
|
+
res.end(JSON.stringify({ error: 'Invalid JSON' }));
|
|
1378
|
+
return;
|
|
1379
|
+
}
|
|
1380
|
+
if (!params.keys || !Array.isArray(params.keys) || params.keys.length === 0) {
|
|
1381
|
+
res.writeHead(400, { 'Content-Type': 'application/json' });
|
|
1382
|
+
res.end(JSON.stringify({ error: 'Missing or empty "keys" array' }));
|
|
1383
|
+
return;
|
|
1384
|
+
}
|
|
1385
|
+
if (params.keys.length > 1000) {
|
|
1386
|
+
res.writeHead(400, { 'Content-Type': 'application/json' });
|
|
1387
|
+
res.end(JSON.stringify({ error: 'Maximum 1000 keys per import request' }));
|
|
1388
|
+
return;
|
|
1389
|
+
}
|
|
1390
|
+
const mode = (params.mode === 'overwrite' || params.mode === 'error') ? params.mode : 'skip';
|
|
1391
|
+
const results = this.gate.store.importKeys(params.keys, mode);
|
|
1392
|
+
// Sync imported keys to Redis if available
|
|
1393
|
+
if (this.redisSync) {
|
|
1394
|
+
for (const r of results) {
|
|
1395
|
+
if (r.status === 'imported' || r.status === 'overwritten') {
|
|
1396
|
+
// Find the full key from the store to sync
|
|
1397
|
+
const allKeys = this.gate.store.exportKeys();
|
|
1398
|
+
const full = allKeys.find(k => k.key.slice(0, 10) + '...' === r.key);
|
|
1399
|
+
if (full) {
|
|
1400
|
+
this.redisSync.saveKey(full).catch(() => { });
|
|
1401
|
+
}
|
|
1402
|
+
}
|
|
1403
|
+
}
|
|
1404
|
+
}
|
|
1405
|
+
const imported = results.filter(r => r.status === 'imported').length;
|
|
1406
|
+
const overwritten = results.filter(r => r.status === 'overwritten').length;
|
|
1407
|
+
const skipped = results.filter(r => r.status === 'skipped').length;
|
|
1408
|
+
const errors = results.filter(r => r.status === 'error').length;
|
|
1409
|
+
this.audit.log('keys.imported', 'admin', `Imported ${imported + overwritten} keys (${skipped} skipped, ${errors} errors)`, {
|
|
1410
|
+
imported, overwritten, skipped, errors, mode,
|
|
1411
|
+
});
|
|
1412
|
+
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
1413
|
+
res.end(JSON.stringify({
|
|
1414
|
+
total: results.length,
|
|
1415
|
+
imported,
|
|
1416
|
+
overwritten,
|
|
1417
|
+
skipped,
|
|
1418
|
+
errors,
|
|
1419
|
+
mode,
|
|
1420
|
+
results,
|
|
1421
|
+
}));
|
|
1422
|
+
}
|
|
1305
1423
|
// ─── /keys/revoke — Revoke a key ──────────────────────────────────────────
|
|
1306
1424
|
async handleRevokeKey(req, res) {
|
|
1307
1425
|
if (req.method !== 'POST') {
|
|
@@ -2322,6 +2440,51 @@ class PayGateServer {
|
|
|
2322
2440
|
message: `Cleared ${cleared} dead letter entries`,
|
|
2323
2441
|
}));
|
|
2324
2442
|
}
|
|
2443
|
+
// ─── /webhooks/replay — Replay dead letter events ───────────────────────
|
|
2444
|
+
async handleWebhookReplay(req, res) {
|
|
2445
|
+
if (req.method !== 'POST') {
|
|
2446
|
+
res.writeHead(405, { 'Content-Type': 'application/json' });
|
|
2447
|
+
res.end(JSON.stringify({ error: 'Method not allowed' }));
|
|
2448
|
+
return;
|
|
2449
|
+
}
|
|
2450
|
+
if (!this.checkAdmin(req, res, 'admin'))
|
|
2451
|
+
return;
|
|
2452
|
+
if (!this.gate.webhook) {
|
|
2453
|
+
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
2454
|
+
res.end(JSON.stringify({ replayed: 0, message: 'No webhook configured' }));
|
|
2455
|
+
return;
|
|
2456
|
+
}
|
|
2457
|
+
const body = await this.readBody(req);
|
|
2458
|
+
let params = {};
|
|
2459
|
+
if (body.trim()) {
|
|
2460
|
+
try {
|
|
2461
|
+
params = JSON.parse(body);
|
|
2462
|
+
}
|
|
2463
|
+
catch {
|
|
2464
|
+
res.writeHead(400, { 'Content-Type': 'application/json' });
|
|
2465
|
+
res.end(JSON.stringify({ error: 'Invalid JSON' }));
|
|
2466
|
+
return;
|
|
2467
|
+
}
|
|
2468
|
+
}
|
|
2469
|
+
const indices = Array.isArray(params.indices) ? params.indices.filter(i => typeof i === 'number') : undefined;
|
|
2470
|
+
const deadLetterCount = this.gate.webhook.getDeadLetters().length;
|
|
2471
|
+
if (deadLetterCount === 0) {
|
|
2472
|
+
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
2473
|
+
res.end(JSON.stringify({ replayed: 0, remaining: 0, message: 'Dead letter queue is empty' }));
|
|
2474
|
+
return;
|
|
2475
|
+
}
|
|
2476
|
+
const replayed = this.gate.webhook.replayDeadLetters(indices && indices.length > 0 ? indices : undefined);
|
|
2477
|
+
const remaining = this.gate.webhook.getDeadLetters().length;
|
|
2478
|
+
this.audit.log('webhook.replayed', 'admin', `Replayed ${replayed} dead letter entries`, {
|
|
2479
|
+
replayed, remaining, indices: indices || 'all',
|
|
2480
|
+
});
|
|
2481
|
+
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
2482
|
+
res.end(JSON.stringify({
|
|
2483
|
+
replayed,
|
|
2484
|
+
remaining,
|
|
2485
|
+
message: `Replayed ${replayed} dead letter entries`,
|
|
2486
|
+
}));
|
|
2487
|
+
}
|
|
2325
2488
|
// ─── /webhooks/stats — Webhook delivery statistics ──────────────────────
|
|
2326
2489
|
handleWebhookStats(req, res) {
|
|
2327
2490
|
if (req.method !== 'GET') {
|