paygate-mcp 4.9.0 → 5.0.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 +41 -0
- 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 +1 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +115 -46
- package/dist/server.js.map +1 -1
- package/dist/store.d.ts +25 -0
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +84 -0
- package/dist/store.js.map +1 -1
- package/dist/types.d.ts +2 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -76,6 +76,7 @@ Agent → PayGate (auth + billing) → Your MCP Server (stdio or HTTP)
|
|
|
76
76
|
- **Webhook Test** — `POST /webhooks/test` sends a test event to your configured webhook URL with synchronous response including status code, response time, and delivery success/failure — verifies webhook connectivity without generating real events
|
|
77
77
|
- **Webhook Delivery Log** — `GET /webhooks/log` returns a queryable log of all webhook delivery attempts with timestamps, HTTP status codes, response times, success/failure, retry attempts, event counts, and event types — filter by success status, time range, and limit
|
|
78
78
|
- **Webhook Pause/Resume** — `POST /webhooks/pause` and `POST /webhooks/resume` temporarily halt webhook delivery during maintenance — events are buffered (not lost) and flushed on resume, with pause state visible in `/webhooks/stats`
|
|
79
|
+
- **Key Aliases** — `POST /keys/alias` assigns human-readable aliases (e.g. `my-service`, `prod-backend`) to API keys — use aliases in any admin endpoint (topup, revoke, suspend, resume, clone, transfer, usage) instead of opaque key IDs, with uniqueness enforcement, format validation, state file persistence, and audit trail
|
|
79
80
|
- **Config Hot Reload** — `POST /config/reload` reloads pricing, rate limits, webhooks, quotas, and behavior flags from config file without server restart
|
|
80
81
|
- **Webhook Events** — POST batched usage events to any URL for external billing/alerting
|
|
81
82
|
- **Config File Mode** — Load all settings from a JSON file (`--config`)
|
|
@@ -357,6 +358,7 @@ A real-time admin UI for managing keys, viewing usage, and monitoring tool calls
|
|
|
357
358
|
| `/webhooks/log` | GET | `X-Admin-Key` | Webhook delivery log with status, timing, and filters |
|
|
358
359
|
| `/webhooks/pause` | POST | `X-Admin-Key` | Pause webhook delivery (events buffered until resumed) |
|
|
359
360
|
| `/webhooks/resume` | POST | `X-Admin-Key` | Resume webhook delivery and flush buffered events |
|
|
361
|
+
| `/keys/alias` | POST | `X-Admin-Key` | Set or clear a human-readable alias for an API key |
|
|
360
362
|
| `/config/reload` | POST | `X-Admin-Key` | Hot-reload config file (pricing, rate limits, webhooks, quotas) |
|
|
361
363
|
| `/health` | GET | None | Health check (status, uptime, version, in-flight, Redis/webhook status) |
|
|
362
364
|
| `/` | GET | None | Root endpoint (endpoint list) |
|
|
@@ -1196,6 +1198,45 @@ curl -X POST http://localhost:3402/webhooks/resume \
|
|
|
1196
1198
|
|
|
1197
1199
|
While paused, events continue to accumulate in the buffer. On resume, all buffered events are flushed immediately. The pause state and buffered event count are visible in `/webhooks/stats`. Creates audit trail entries (`webhook.pause`, `webhook.resume`).
|
|
1198
1200
|
|
|
1201
|
+
### Key Aliases
|
|
1202
|
+
|
|
1203
|
+
Assign human-readable aliases to API keys so you can reference them by name instead of opaque key IDs in admin endpoints:
|
|
1204
|
+
|
|
1205
|
+
```bash
|
|
1206
|
+
# Set an alias
|
|
1207
|
+
curl -X POST http://localhost:3402/keys/alias \
|
|
1208
|
+
-H "X-Admin-Key: YOUR_ADMIN_KEY" \
|
|
1209
|
+
-d '{"key": "pg_abc123...", "alias": "prod-backend"}'
|
|
1210
|
+
# → { "key": "pg_abc12...", "alias": "prod-backend", "message": "Alias set to \"prod-backend\"" }
|
|
1211
|
+
|
|
1212
|
+
# Use the alias in any admin endpoint
|
|
1213
|
+
curl -X POST http://localhost:3402/topup \
|
|
1214
|
+
-H "X-Admin-Key: YOUR_ADMIN_KEY" \
|
|
1215
|
+
-d '{"key": "prod-backend", "credits": 500}'
|
|
1216
|
+
|
|
1217
|
+
curl -X POST http://localhost:3402/keys/suspend \
|
|
1218
|
+
-H "X-Admin-Key: YOUR_ADMIN_KEY" \
|
|
1219
|
+
-d '{"key": "prod-backend", "reason": "maintenance"}'
|
|
1220
|
+
|
|
1221
|
+
curl -X POST http://localhost:3402/keys/transfer \
|
|
1222
|
+
-H "X-Admin-Key: YOUR_ADMIN_KEY" \
|
|
1223
|
+
-d '{"from": "prod-backend", "to": "staging-api", "credits": 100}'
|
|
1224
|
+
|
|
1225
|
+
# Clear an alias
|
|
1226
|
+
curl -X POST http://localhost:3402/keys/alias \
|
|
1227
|
+
-H "X-Admin-Key: YOUR_ADMIN_KEY" \
|
|
1228
|
+
-d '{"key": "prod-backend", "alias": null}'
|
|
1229
|
+
```
|
|
1230
|
+
|
|
1231
|
+
| Field | Description |
|
|
1232
|
+
|-------|-------------|
|
|
1233
|
+
| `alias` | 1-100 chars, alphanumeric + hyphens + underscores only |
|
|
1234
|
+
| Uniqueness | Aliases must be unique across all keys and cannot collide with existing key IDs |
|
|
1235
|
+
| Scope | Aliases work in all admin endpoints (topup, revoke, suspend, resume, clone, transfer, usage) — they do **not** work for API key authentication on `/mcp` |
|
|
1236
|
+
| Persistence | Aliases are saved to the state file and survive server restarts |
|
|
1237
|
+
| Clone | Cloned keys do **not** inherit the source key's alias |
|
|
1238
|
+
| Audit | `key.alias_set` event logged for every set/clear operation |
|
|
1239
|
+
|
|
1199
1240
|
### IP Allowlisting
|
|
1200
1241
|
|
|
1201
1242
|
Restrict API keys to specific IP addresses or CIDR ranges:
|
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.suspended' | 'key.resumed' | 'key.cloned' | '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' | 'webhook.test' | 'webhook.pause' | 'webhook.resume' | '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' | 'config.reloaded';
|
|
8
|
+
export type AuditEventType = 'key.created' | 'key.revoked' | 'key.suspended' | 'key.resumed' | 'key.cloned' | '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' | 'webhook.test' | 'webhook.pause' | 'webhook.resume' | 'key.alias_set' | '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' | 'config.reloaded';
|
|
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,eAAe,GACf,aAAa,GACb,YAAY,GACZ,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,cAAc,GACd,cAAc,GACd,cAAc,GACd,mBAAmB,GACnB,kBAAkB,GAElB,mBAAmB,GACnB,yBAAyB,GAEzB,6BAA6B,GAC7B,kBAAkB,GAClB,cAAc,GACd,eAAe,GACf,gBAAgB,GAEhB,eAAe,GACf,eAAe,GAEf,gBAAgB,GAEhB,2BAA2B,GAC3B,oBAAoB,GAEpB,mBAAmB,GACnB,mBAAmB,GAEnB,eAAe,GACf,eAAe,GACf,eAAe,GACf,oBAAoB,GACpB,mBAAmB,GAEnB,yBAAyB,GAEzB,eAAe,GACf,eAAe,GAEf,wBAAwB,GACxB,wBAAwB,GACxB,wBAAwB,GAExB,iBAAiB,CAAC;AAEtB,MAAM,WAAW,UAAU;IACzB,kCAAkC;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,yBAAyB;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,iDAAiD;IACjD,IAAI,EAAE,cAAc,CAAC;IACrB,sDAAsD;IACtD,KAAK,EAAE,MAAM,CAAC;IACd,iCAAiC;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,iDAAiD;IACjD,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED,MAAM,WAAW,cAAc;IAC7B,0DAA0D;IAC1D,SAAS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,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GAAG,UAAU;IAoB7G;;OAEG;IACH,KAAK,CAAC,CAAC,GAAE,UAAe,GAAG,gBAAgB;IAoC3C;;OAEG;IACH,KAAK,IAAI;QACP,WAAW,EAAE,MAAM,CAAC;QACpB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;QAC3B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;QAC3B,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACrC,cAAc,EAAE,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;;;AA8SH,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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BnB,OAAO,CAAC,iBAAiB;IAgCzB,OAAO,CAAC,gBAAgB;IAcxB,OAAO,CAAC,UAAU;IAiClB,OAAO,CAAC,eAAe;YAiBT,gBAAgB;YA4ChB,gBAAgB;YA6ChB,gBAAgB;YAsChB,mBAAmB;YAsDnB,mBAAmB;IA8CjC,OAAO,CAAC,eAAe;IA8BvB,OAAO,CAAC,oBAAoB;YAgBd,iBAAiB;YAyDjB,iBAAiB;IAiE/B,OAAO,CAAC,uBAAuB;IAyB/B,OAAO,CAAC,iBAAiB;IAezB,OAAO,CAAC,gBAAgB;YAOV,iBAAiB;YA2CjB,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
|
@@ -364,6 +364,8 @@ class PayGateServer {
|
|
|
364
364
|
return this.handleResumeKey(req, res);
|
|
365
365
|
case '/keys/clone':
|
|
366
366
|
return this.handleCloneKey(req, res);
|
|
367
|
+
case '/keys/alias':
|
|
368
|
+
return this.handleSetAlias(req, res);
|
|
367
369
|
case '/keys/rotate':
|
|
368
370
|
return this.handleRotateKey(req, res);
|
|
369
371
|
case '/keys/acl':
|
|
@@ -889,6 +891,7 @@ class PayGateServer {
|
|
|
889
891
|
suspendKey: 'POST /keys/suspend — Temporarily suspend a key (requires X-Admin-Key)',
|
|
890
892
|
resumeKey: 'POST /keys/resume — Resume a suspended key (requires X-Admin-Key)',
|
|
891
893
|
cloneKey: 'POST /keys/clone — Clone a key with same config (requires X-Admin-Key)',
|
|
894
|
+
keyAlias: 'POST /keys/alias — Set or clear a human-readable alias for a key (requires X-Admin-Key)',
|
|
892
895
|
rotateKey: 'POST /keys/rotate — Rotate a key (requires X-Admin-Key)',
|
|
893
896
|
setAcl: 'POST /keys/acl — Set tool ACL (requires X-Admin-Key)',
|
|
894
897
|
setExpiry: 'POST /keys/expiry — Set key expiry (requires X-Admin-Key)',
|
|
@@ -1120,20 +1123,23 @@ class PayGateServer {
|
|
|
1120
1123
|
res.end(JSON.stringify({ error: 'Credits must be a positive integer' }));
|
|
1121
1124
|
return;
|
|
1122
1125
|
}
|
|
1126
|
+
// Resolve alias to actual key
|
|
1127
|
+
const resolved = this.gate.store.resolveKey(params.key);
|
|
1128
|
+
const actualKey = resolved ? resolved.key : params.key;
|
|
1123
1129
|
// Use Redis atomic topup when available, fall back to local store
|
|
1124
1130
|
let success;
|
|
1125
1131
|
if (this.redisSync) {
|
|
1126
|
-
success = await this.redisSync.atomicTopup(
|
|
1132
|
+
success = await this.redisSync.atomicTopup(actualKey, credits);
|
|
1127
1133
|
}
|
|
1128
1134
|
else {
|
|
1129
|
-
success = this.gate.store.addCredits(
|
|
1135
|
+
success = this.gate.store.addCredits(actualKey, credits);
|
|
1130
1136
|
}
|
|
1131
1137
|
if (!success) {
|
|
1132
1138
|
res.writeHead(404, { 'Content-Type': 'application/json' });
|
|
1133
1139
|
res.end(JSON.stringify({ error: 'Key not found or inactive' }));
|
|
1134
1140
|
return;
|
|
1135
1141
|
}
|
|
1136
|
-
const record = this.gate.store.getKey(
|
|
1142
|
+
const record = this.gate.store.getKey(actualKey);
|
|
1137
1143
|
this.audit.log('key.topup', 'admin', `Added ${credits} credits`, {
|
|
1138
1144
|
keyMasked: (0, audit_1.maskKeyForAudit)(params.key),
|
|
1139
1145
|
creditsAdded: credits,
|
|
@@ -1181,7 +1187,7 @@ class PayGateServer {
|
|
|
1181
1187
|
return;
|
|
1182
1188
|
}
|
|
1183
1189
|
// Validate source key exists and has enough credits
|
|
1184
|
-
const sourceRecord = this.gate.store.
|
|
1190
|
+
const sourceRecord = this.gate.store.resolveKey(params.from);
|
|
1185
1191
|
if (!sourceRecord) {
|
|
1186
1192
|
res.writeHead(404, { 'Content-Type': 'application/json' });
|
|
1187
1193
|
res.end(JSON.stringify({ error: 'Source key not found' }));
|
|
@@ -1195,7 +1201,7 @@ class PayGateServer {
|
|
|
1195
1201
|
return;
|
|
1196
1202
|
}
|
|
1197
1203
|
// Validate destination key exists (getKey returns null for revoked/expired keys)
|
|
1198
|
-
const destRecord = this.gate.store.
|
|
1204
|
+
const destRecord = this.gate.store.resolveKey(params.to);
|
|
1199
1205
|
if (!destRecord) {
|
|
1200
1206
|
res.writeHead(404, { 'Content-Type': 'application/json' });
|
|
1201
1207
|
res.end(JSON.stringify({ error: 'Destination key not found' }));
|
|
@@ -1204,13 +1210,13 @@ class PayGateServer {
|
|
|
1204
1210
|
// Perform transfer atomically (deduct from source, add to destination)
|
|
1205
1211
|
if (this.redisSync) {
|
|
1206
1212
|
// Redis atomic transfer: deduct first, then add
|
|
1207
|
-
const deducted = await this.redisSync.atomicDeduct(
|
|
1213
|
+
const deducted = await this.redisSync.atomicDeduct(sourceRecord.key, credits);
|
|
1208
1214
|
if (!deducted) {
|
|
1209
1215
|
res.writeHead(400, { 'Content-Type': 'application/json' });
|
|
1210
1216
|
res.end(JSON.stringify({ error: 'Redis deduction failed (insufficient credits or key not found)' }));
|
|
1211
1217
|
return;
|
|
1212
1218
|
}
|
|
1213
|
-
await this.redisSync.atomicTopup(
|
|
1219
|
+
await this.redisSync.atomicTopup(destRecord.key, credits);
|
|
1214
1220
|
}
|
|
1215
1221
|
else {
|
|
1216
1222
|
// Local store: deduct and add
|
|
@@ -1218,20 +1224,20 @@ class PayGateServer {
|
|
|
1218
1224
|
destRecord.credits += credits;
|
|
1219
1225
|
this.gate.store.save();
|
|
1220
1226
|
}
|
|
1221
|
-
const fromBalance =
|
|
1222
|
-
const toBalance =
|
|
1227
|
+
const fromBalance = sourceRecord.credits;
|
|
1228
|
+
const toBalance = destRecord.credits;
|
|
1223
1229
|
const memo = params.memo || '';
|
|
1224
1230
|
this.audit.log('key.credits_transferred', 'admin', `Transferred ${credits} credits`, {
|
|
1225
|
-
fromKeyMasked: (0, audit_1.maskKeyForAudit)(
|
|
1226
|
-
toKeyMasked: (0, audit_1.maskKeyForAudit)(
|
|
1231
|
+
fromKeyMasked: (0, audit_1.maskKeyForAudit)(sourceRecord.key),
|
|
1232
|
+
toKeyMasked: (0, audit_1.maskKeyForAudit)(destRecord.key),
|
|
1227
1233
|
credits,
|
|
1228
1234
|
fromBalance,
|
|
1229
1235
|
toBalance,
|
|
1230
1236
|
memo,
|
|
1231
1237
|
});
|
|
1232
1238
|
this.emitWebhookAdmin('key.credits_transferred', 'admin', {
|
|
1233
|
-
fromKeyMasked: (0, audit_1.maskKeyForAudit)(
|
|
1234
|
-
toKeyMasked: (0, audit_1.maskKeyForAudit)(
|
|
1239
|
+
fromKeyMasked: (0, audit_1.maskKeyForAudit)(sourceRecord.key),
|
|
1240
|
+
toKeyMasked: (0, audit_1.maskKeyForAudit)(destRecord.key),
|
|
1235
1241
|
credits,
|
|
1236
1242
|
fromBalance,
|
|
1237
1243
|
toBalance,
|
|
@@ -1240,8 +1246,8 @@ class PayGateServer {
|
|
|
1240
1246
|
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
1241
1247
|
res.end(JSON.stringify({
|
|
1242
1248
|
transferred: credits,
|
|
1243
|
-
from: { keyMasked: (0, audit_1.maskKeyForAudit)(
|
|
1244
|
-
to: { keyMasked: (0, audit_1.maskKeyForAudit)(
|
|
1249
|
+
from: { keyMasked: (0, audit_1.maskKeyForAudit)(sourceRecord.key), balance: fromBalance, credits: fromBalance },
|
|
1250
|
+
to: { keyMasked: (0, audit_1.maskKeyForAudit)(destRecord.key), balance: toBalance, credits: toBalance },
|
|
1245
1251
|
memo: memo || undefined,
|
|
1246
1252
|
message: `Transferred ${credits} credits`,
|
|
1247
1253
|
}));
|
|
@@ -1515,13 +1521,16 @@ class PayGateServer {
|
|
|
1515
1521
|
res.end(JSON.stringify({ error: 'Missing key' }));
|
|
1516
1522
|
return;
|
|
1517
1523
|
}
|
|
1524
|
+
// Resolve alias to actual key
|
|
1525
|
+
const resolved = this.gate.store.resolveKeyRaw(params.key);
|
|
1526
|
+
const actualKey = resolved ? resolved.key : params.key;
|
|
1518
1527
|
// Use Redis-backed revoke when available (broadcasts to other instances)
|
|
1519
1528
|
let success;
|
|
1520
1529
|
if (this.redisSync) {
|
|
1521
|
-
success = await this.redisSync.revokeKey(
|
|
1530
|
+
success = await this.redisSync.revokeKey(actualKey);
|
|
1522
1531
|
}
|
|
1523
1532
|
else {
|
|
1524
|
-
success = this.gate.store.revokeKey(
|
|
1533
|
+
success = this.gate.store.revokeKey(actualKey);
|
|
1525
1534
|
}
|
|
1526
1535
|
if (!success) {
|
|
1527
1536
|
res.writeHead(404, { 'Content-Type': 'application/json' });
|
|
@@ -1529,13 +1538,13 @@ class PayGateServer {
|
|
|
1529
1538
|
return;
|
|
1530
1539
|
}
|
|
1531
1540
|
this.audit.log('key.revoked', 'admin', `Key revoked`, {
|
|
1532
|
-
keyMasked: (0, audit_1.maskKeyForAudit)(
|
|
1541
|
+
keyMasked: (0, audit_1.maskKeyForAudit)(actualKey),
|
|
1533
1542
|
});
|
|
1534
1543
|
this.emitWebhookAdmin('key.revoked', 'admin', {
|
|
1535
|
-
keyMasked: (0, audit_1.maskKeyForAudit)(
|
|
1544
|
+
keyMasked: (0, audit_1.maskKeyForAudit)(actualKey),
|
|
1536
1545
|
});
|
|
1537
1546
|
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
1538
|
-
res.end(JSON.stringify({ message: 'Key revoked' }));
|
|
1547
|
+
res.end(JSON.stringify({ message: 'Key revoked', revoked: true }));
|
|
1539
1548
|
}
|
|
1540
1549
|
// ─── /keys/suspend — Temporarily suspend a key ─────────────────────────────
|
|
1541
1550
|
async handleSuspendKey(req, res) {
|
|
@@ -1561,7 +1570,7 @@ class PayGateServer {
|
|
|
1561
1570
|
res.end(JSON.stringify({ error: 'Missing key' }));
|
|
1562
1571
|
return;
|
|
1563
1572
|
}
|
|
1564
|
-
const record = this.gate.store.
|
|
1573
|
+
const record = this.gate.store.resolveKeyRaw(params.key);
|
|
1565
1574
|
if (!record) {
|
|
1566
1575
|
res.writeHead(404, { 'Content-Type': 'application/json' });
|
|
1567
1576
|
res.end(JSON.stringify({ error: 'Key not found' }));
|
|
@@ -1577,19 +1586,19 @@ class PayGateServer {
|
|
|
1577
1586
|
res.end(JSON.stringify({ error: 'Key is already suspended' }));
|
|
1578
1587
|
return;
|
|
1579
1588
|
}
|
|
1580
|
-
const success = this.gate.store.suspendKey(
|
|
1589
|
+
const success = this.gate.store.suspendKey(record.key);
|
|
1581
1590
|
if (!success) {
|
|
1582
1591
|
res.writeHead(500, { 'Content-Type': 'application/json' });
|
|
1583
1592
|
res.end(JSON.stringify({ error: 'Failed to suspend key' }));
|
|
1584
1593
|
return;
|
|
1585
1594
|
}
|
|
1586
|
-
this.syncKeyMutation(
|
|
1595
|
+
this.syncKeyMutation(record.key);
|
|
1587
1596
|
this.audit.log('key.suspended', 'admin', `Key suspended${params.reason ? ': ' + params.reason : ''}`, {
|
|
1588
|
-
keyMasked: (0, audit_1.maskKeyForAudit)(
|
|
1597
|
+
keyMasked: (0, audit_1.maskKeyForAudit)(record.key),
|
|
1589
1598
|
reason: params.reason || null,
|
|
1590
1599
|
});
|
|
1591
1600
|
this.emitWebhookAdmin('key.suspended', 'admin', {
|
|
1592
|
-
keyMasked: (0, audit_1.maskKeyForAudit)(
|
|
1601
|
+
keyMasked: (0, audit_1.maskKeyForAudit)(record.key),
|
|
1593
1602
|
reason: params.reason || null,
|
|
1594
1603
|
});
|
|
1595
1604
|
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
@@ -1619,7 +1628,7 @@ class PayGateServer {
|
|
|
1619
1628
|
res.end(JSON.stringify({ error: 'Missing key' }));
|
|
1620
1629
|
return;
|
|
1621
1630
|
}
|
|
1622
|
-
const record = this.gate.store.
|
|
1631
|
+
const record = this.gate.store.resolveKeyRaw(params.key);
|
|
1623
1632
|
if (!record) {
|
|
1624
1633
|
res.writeHead(404, { 'Content-Type': 'application/json' });
|
|
1625
1634
|
res.end(JSON.stringify({ error: 'Key not found' }));
|
|
@@ -1635,18 +1644,18 @@ class PayGateServer {
|
|
|
1635
1644
|
res.end(JSON.stringify({ error: 'Key is not suspended' }));
|
|
1636
1645
|
return;
|
|
1637
1646
|
}
|
|
1638
|
-
const success = this.gate.store.resumeKey(
|
|
1647
|
+
const success = this.gate.store.resumeKey(record.key);
|
|
1639
1648
|
if (!success) {
|
|
1640
1649
|
res.writeHead(500, { 'Content-Type': 'application/json' });
|
|
1641
1650
|
res.end(JSON.stringify({ error: 'Failed to resume key' }));
|
|
1642
1651
|
return;
|
|
1643
1652
|
}
|
|
1644
|
-
this.syncKeyMutation(
|
|
1653
|
+
this.syncKeyMutation(record.key);
|
|
1645
1654
|
this.audit.log('key.resumed', 'admin', 'Key resumed', {
|
|
1646
|
-
keyMasked: (0, audit_1.maskKeyForAudit)(
|
|
1655
|
+
keyMasked: (0, audit_1.maskKeyForAudit)(record.key),
|
|
1647
1656
|
});
|
|
1648
1657
|
this.emitWebhookAdmin('key.resumed', 'admin', {
|
|
1649
|
-
keyMasked: (0, audit_1.maskKeyForAudit)(
|
|
1658
|
+
keyMasked: (0, audit_1.maskKeyForAudit)(record.key),
|
|
1650
1659
|
});
|
|
1651
1660
|
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
1652
1661
|
res.end(JSON.stringify({ message: 'Key resumed', suspended: false }));
|
|
@@ -1676,7 +1685,7 @@ class PayGateServer {
|
|
|
1676
1685
|
return;
|
|
1677
1686
|
}
|
|
1678
1687
|
// Use getKeyRaw to allow cloning suspended/expired keys (but not revoked)
|
|
1679
|
-
const source = this.gate.store.
|
|
1688
|
+
const source = this.gate.store.resolveKeyRaw(params.key);
|
|
1680
1689
|
if (!source) {
|
|
1681
1690
|
res.writeHead(404, { 'Content-Type': 'application/json' });
|
|
1682
1691
|
res.end(JSON.stringify({ error: 'Source key not found' }));
|
|
@@ -1687,7 +1696,7 @@ class PayGateServer {
|
|
|
1687
1696
|
res.end(JSON.stringify({ error: 'Cannot clone a revoked key' }));
|
|
1688
1697
|
return;
|
|
1689
1698
|
}
|
|
1690
|
-
const cloned = this.gate.store.cloneKey(
|
|
1699
|
+
const cloned = this.gate.store.cloneKey(source.key, {
|
|
1691
1700
|
name: params.name,
|
|
1692
1701
|
credits: params.credits,
|
|
1693
1702
|
tags: params.tags,
|
|
@@ -1700,14 +1709,14 @@ class PayGateServer {
|
|
|
1700
1709
|
}
|
|
1701
1710
|
// Sync new key to Redis
|
|
1702
1711
|
this.syncKeyMutation(cloned.key);
|
|
1703
|
-
this.audit.log('key.cloned', 'admin', `Key cloned from ${(0, audit_1.maskKeyForAudit)(
|
|
1704
|
-
sourceKeyMasked: (0, audit_1.maskKeyForAudit)(
|
|
1712
|
+
this.audit.log('key.cloned', 'admin', `Key cloned from ${(0, audit_1.maskKeyForAudit)(source.key)}`, {
|
|
1713
|
+
sourceKeyMasked: (0, audit_1.maskKeyForAudit)(source.key),
|
|
1705
1714
|
newKeyMasked: (0, audit_1.maskKeyForAudit)(cloned.key),
|
|
1706
1715
|
name: cloned.name,
|
|
1707
1716
|
credits: cloned.credits,
|
|
1708
1717
|
});
|
|
1709
1718
|
this.emitWebhookAdmin('key.cloned', 'admin', {
|
|
1710
|
-
sourceKeyMasked: (0, audit_1.maskKeyForAudit)(
|
|
1719
|
+
sourceKeyMasked: (0, audit_1.maskKeyForAudit)(source.key),
|
|
1711
1720
|
newKeyMasked: (0, audit_1.maskKeyForAudit)(cloned.key),
|
|
1712
1721
|
name: cloned.name,
|
|
1713
1722
|
credits: cloned.credits,
|
|
@@ -1718,6 +1727,7 @@ class PayGateServer {
|
|
|
1718
1727
|
key: cloned.key,
|
|
1719
1728
|
name: cloned.name,
|
|
1720
1729
|
credits: cloned.credits,
|
|
1730
|
+
clonedFrom: source.key.slice(0, 10) + '...',
|
|
1721
1731
|
sourceName: source.name,
|
|
1722
1732
|
allowedTools: cloned.allowedTools,
|
|
1723
1733
|
deniedTools: cloned.deniedTools,
|
|
@@ -1730,6 +1740,65 @@ class PayGateServer {
|
|
|
1730
1740
|
spendingLimit: cloned.spendingLimit,
|
|
1731
1741
|
}));
|
|
1732
1742
|
}
|
|
1743
|
+
// ─── /keys/alias — Set or clear key alias ──────────────────────────────────
|
|
1744
|
+
async handleSetAlias(req, res) {
|
|
1745
|
+
if (req.method !== 'POST') {
|
|
1746
|
+
res.writeHead(405, { 'Content-Type': 'application/json' });
|
|
1747
|
+
res.end(JSON.stringify({ error: 'Method not allowed' }));
|
|
1748
|
+
return;
|
|
1749
|
+
}
|
|
1750
|
+
if (!this.checkAdmin(req, res))
|
|
1751
|
+
return;
|
|
1752
|
+
const raw = await this.readBody(req);
|
|
1753
|
+
const params = JSON.parse(raw);
|
|
1754
|
+
if (!params.key) {
|
|
1755
|
+
res.writeHead(400, { 'Content-Type': 'application/json' });
|
|
1756
|
+
res.end(JSON.stringify({ error: 'Missing "key" parameter' }));
|
|
1757
|
+
return;
|
|
1758
|
+
}
|
|
1759
|
+
// Resolve the key (support existing aliases for the source key)
|
|
1760
|
+
const record = this.gate.store.resolveKeyRaw(params.key);
|
|
1761
|
+
if (!record) {
|
|
1762
|
+
res.writeHead(404, { 'Content-Type': 'application/json' });
|
|
1763
|
+
res.end(JSON.stringify({ error: 'Key not found' }));
|
|
1764
|
+
return;
|
|
1765
|
+
}
|
|
1766
|
+
const alias = params.alias !== undefined ? (params.alias === null || params.alias === '' ? null : String(params.alias)) : undefined;
|
|
1767
|
+
if (alias === undefined) {
|
|
1768
|
+
res.writeHead(400, { 'Content-Type': 'application/json' });
|
|
1769
|
+
res.end(JSON.stringify({ error: 'Missing "alias" parameter (string to set, null to clear)' }));
|
|
1770
|
+
return;
|
|
1771
|
+
}
|
|
1772
|
+
const result = this.gate.store.setAlias(record.key, alias);
|
|
1773
|
+
if (!result.success) {
|
|
1774
|
+
res.writeHead(400, { 'Content-Type': 'application/json' });
|
|
1775
|
+
res.end(JSON.stringify({ error: result.error }));
|
|
1776
|
+
return;
|
|
1777
|
+
}
|
|
1778
|
+
const action = alias ? `set to "${alias}"` : 'cleared';
|
|
1779
|
+
this.audit.log('key.alias_set', 'admin', `Key alias ${action} for ${record.key.slice(0, 10)}...`, {
|
|
1780
|
+
key: record.key.slice(0, 10),
|
|
1781
|
+
alias: alias || null,
|
|
1782
|
+
});
|
|
1783
|
+
// Sync to Redis if configured
|
|
1784
|
+
if (typeof this.syncKeyMutation === 'function') {
|
|
1785
|
+
this.syncKeyMutation(record.key);
|
|
1786
|
+
}
|
|
1787
|
+
// Webhook event
|
|
1788
|
+
if (this.gate.webhook) {
|
|
1789
|
+
this.gate.webhook.emitAdmin('key.created', 'admin', {
|
|
1790
|
+
key: record.key.slice(0, 10),
|
|
1791
|
+
alias: alias || null,
|
|
1792
|
+
event: 'alias_set',
|
|
1793
|
+
});
|
|
1794
|
+
}
|
|
1795
|
+
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
1796
|
+
res.end(JSON.stringify({
|
|
1797
|
+
key: record.key.slice(0, 10) + '...',
|
|
1798
|
+
alias: record.alias || null,
|
|
1799
|
+
message: `Alias ${action}`,
|
|
1800
|
+
}));
|
|
1801
|
+
}
|
|
1733
1802
|
// ─── /keys/rotate — Rotate API key ─────────────────────────────────────────
|
|
1734
1803
|
async handleRotateKey(req, res) {
|
|
1735
1804
|
if (req.method !== 'POST') {
|
|
@@ -1813,7 +1882,7 @@ class PayGateServer {
|
|
|
1813
1882
|
return;
|
|
1814
1883
|
}
|
|
1815
1884
|
this.syncKeyMutation(params.key);
|
|
1816
|
-
const record = this.gate.store.
|
|
1885
|
+
const record = this.gate.store.resolveKey(params.key);
|
|
1817
1886
|
this.audit.log('key.acl_updated', 'admin', `ACL updated`, {
|
|
1818
1887
|
keyMasked: (0, audit_1.maskKeyForAudit)(params.key),
|
|
1819
1888
|
allowedTools: record?.allowedTools || [],
|
|
@@ -1865,7 +1934,7 @@ class PayGateServer {
|
|
|
1865
1934
|
return;
|
|
1866
1935
|
}
|
|
1867
1936
|
this.syncKeyMutation(params.key);
|
|
1868
|
-
const record = this.gate.store.
|
|
1937
|
+
const record = this.gate.store.resolveKeyRaw(params.key);
|
|
1869
1938
|
this.audit.log('key.expiry_updated', 'admin', expiresAt ? `Key expiry set to ${expiresAt}` : 'Key expiry removed', {
|
|
1870
1939
|
keyMasked: (0, audit_1.maskKeyForAudit)(params.key),
|
|
1871
1940
|
expiresAt: record?.expiresAt || null,
|
|
@@ -1968,7 +2037,7 @@ class PayGateServer {
|
|
|
1968
2037
|
return;
|
|
1969
2038
|
}
|
|
1970
2039
|
this.syncKeyMutation(params.key);
|
|
1971
|
-
const record = this.gate.store.
|
|
2040
|
+
const record = this.gate.store.resolveKey(params.key);
|
|
1972
2041
|
this.audit.log('key.tags_updated', 'admin', `Tags updated`, {
|
|
1973
2042
|
keyMasked: (0, audit_1.maskKeyForAudit)(params.key),
|
|
1974
2043
|
tags: record?.tags || {},
|
|
@@ -2015,7 +2084,7 @@ class PayGateServer {
|
|
|
2015
2084
|
return;
|
|
2016
2085
|
}
|
|
2017
2086
|
this.syncKeyMutation(params.key);
|
|
2018
|
-
const record = this.gate.store.
|
|
2087
|
+
const record = this.gate.store.resolveKey(params.key);
|
|
2019
2088
|
this.audit.log('key.ip_updated', 'admin', `IP allowlist updated`, {
|
|
2020
2089
|
keyMasked: (0, audit_1.maskKeyForAudit)(params.key),
|
|
2021
2090
|
ipAllowlist: record?.ipAllowlist || [],
|
|
@@ -2072,14 +2141,14 @@ class PayGateServer {
|
|
|
2072
2141
|
res.end(JSON.stringify({ error: 'Missing key query parameter' }));
|
|
2073
2142
|
return;
|
|
2074
2143
|
}
|
|
2075
|
-
// Verify key exists (use
|
|
2076
|
-
const record = this.gate.store.
|
|
2144
|
+
// Verify key exists (use resolveKeyRaw to allow querying by alias and expired/suspended keys)
|
|
2145
|
+
const record = this.gate.store.resolveKeyRaw(key);
|
|
2077
2146
|
if (!record) {
|
|
2078
2147
|
res.writeHead(404, { 'Content-Type': 'application/json' });
|
|
2079
2148
|
res.end(JSON.stringify({ error: 'Key not found' }));
|
|
2080
2149
|
return;
|
|
2081
2150
|
}
|
|
2082
|
-
const usage = this.gate.meter.getKeyUsage(key, since);
|
|
2151
|
+
const usage = this.gate.meter.getKeyUsage(record.key, since);
|
|
2083
2152
|
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
2084
2153
|
res.end(JSON.stringify({
|
|
2085
2154
|
key: key.slice(0, 10) + '...',
|
|
@@ -2115,7 +2184,7 @@ class PayGateServer {
|
|
|
2115
2184
|
res.end(JSON.stringify({ error: 'Missing key' }));
|
|
2116
2185
|
return;
|
|
2117
2186
|
}
|
|
2118
|
-
const record = this.gate.store.
|
|
2187
|
+
const record = this.gate.store.resolveKey(params.key);
|
|
2119
2188
|
if (!record) {
|
|
2120
2189
|
res.writeHead(404, { 'Content-Type': 'application/json' });
|
|
2121
2190
|
res.end(JSON.stringify({ error: 'Key not found or inactive' }));
|
|
@@ -2236,7 +2305,7 @@ class PayGateServer {
|
|
|
2236
2305
|
res.end(JSON.stringify({ error: 'Missing key' }));
|
|
2237
2306
|
return;
|
|
2238
2307
|
}
|
|
2239
|
-
const record = this.gate.store.
|
|
2308
|
+
const record = this.gate.store.resolveKey(params.key);
|
|
2240
2309
|
if (!record) {
|
|
2241
2310
|
res.writeHead(404, { 'Content-Type': 'application/json' });
|
|
2242
2311
|
res.end(JSON.stringify({ error: 'Key not found or inactive' }));
|
|
@@ -3539,7 +3608,7 @@ class PayGateServer {
|
|
|
3539
3608
|
return;
|
|
3540
3609
|
}
|
|
3541
3610
|
// Verify the key exists
|
|
3542
|
-
const keyRecord = this.gate.store.
|
|
3611
|
+
const keyRecord = this.gate.store.resolveKey(params.key);
|
|
3543
3612
|
if (!keyRecord) {
|
|
3544
3613
|
res.writeHead(404, { 'Content-Type': 'application/json' });
|
|
3545
3614
|
res.end(JSON.stringify({ error: 'API key not found' }));
|
|
@@ -3658,7 +3727,7 @@ class PayGateServer {
|
|
|
3658
3727
|
return;
|
|
3659
3728
|
}
|
|
3660
3729
|
// Verify the parent key exists and is active
|
|
3661
|
-
const keyRecord = this.gate.store.
|
|
3730
|
+
const keyRecord = this.gate.store.resolveKey(params.key);
|
|
3662
3731
|
if (!keyRecord || !keyRecord.active) {
|
|
3663
3732
|
res.writeHead(404, { 'Content-Type': 'application/json' });
|
|
3664
3733
|
res.end(JSON.stringify({ error: 'API key not found or inactive' }));
|