troxy-cli 1.8.5 → 1.8.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "troxy-cli",
3
- "version": "1.8.5",
3
+ "version": "1.8.6",
4
4
  "description": "AI payment control — protect your agent's payments with policies",
5
5
  "type": "module",
6
6
  "bin": {
package/src/api.js CHANGED
@@ -72,6 +72,7 @@ export const api = {
72
72
  // Evaluate + confirm (agent API key)
73
73
  evaluate: (body, apiKey) => request('POST', '/evaluate', { apiKey, body }),
74
74
  evaluateEmail: (body, apiKey) => request('POST', '/evaluate/email', { apiKey, body }),
75
+ selfRevoke: (apiKey) => request('POST', '/mcp/self-revoke', { apiKey }),
75
76
  confirmPayment: (auditId, body, apiKey) => request('POST', `/payments/${auditId}/confirm`, { apiKey, body }),
76
77
  waitApprovalStatus: (token) => request('GET', `/approvals/${encodeURIComponent(token)}/wait`),
77
78
 
package/src/uninstall.js CHANGED
@@ -4,6 +4,7 @@ import path from 'path';
4
4
  import { execSync } from 'child_process';
5
5
  import readline from 'readline';
6
6
  import { loadConfig } from './config.js';
7
+ import { api } from './api.js';
7
8
 
8
9
  const MCP_CLIENTS = [
9
10
  {
@@ -107,12 +108,21 @@ export async function runUninstall() {
107
108
  console.log('none found');
108
109
  }
109
110
 
110
- // 3. Warn about API key (requires login to revoke user must do it from dashboard)
111
+ // 3. Revoke the API key. /mcp/self-revoke only lets a key revoke the exact
112
+ // token it authenticates as — it can't touch or list any other token — so
113
+ // this doesn't need a login/JWT, the key on disk is enough.
111
114
  const cfg = loadConfig();
112
115
  if (cfg?.apiKey) {
113
116
  const prefix = cfg.apiKey.slice(0, 12) + '...';
114
- console.log(`\n API key ${prefix} was NOT revoked automatically.`);
115
- console.log(' Go to dash.troxy.io → Settings → API Keys to revoke it.\n');
117
+ process.stdout.write(` Revoking API key ${prefix}... `);
118
+ try {
119
+ await api.selfRevoke(cfg.apiKey);
120
+ console.log('✓');
121
+ } catch (err) {
122
+ console.log('✗');
123
+ console.log(` Couldn't revoke automatically (${err.message}).`);
124
+ console.log(' Go to dash.troxy.io → Settings → API Keys to revoke it.\n');
125
+ }
116
126
  }
117
127
 
118
128
  // 4. Delete ~/.troxy config