@proxy-checkout/cli 0.1.0-prx-128.114.1 → 0.1.0-prx-128.115.1

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 CHANGED
@@ -45,7 +45,7 @@ proxy listen \
45
45
 
46
46
  The listener has a two-minute lease renewed every 30 seconds. Proxy prepares the canonical body and signature headers, the CLI forwards those exact bytes to the loopback URL, and the server records the real local outcome in its normal attempt/retry state machine. The source HTTPS endpoint continues to receive its independent normal delivery. Only `localhost`, `127.0.0.1`, and `::1` HTTP(S) destinations are allowed.
47
47
 
48
- Control-C closes the listener. Logout closes resources owned by the credential. The server expires abandoned listeners after a crash.
48
+ Control-C closes the listener. Logout closes resources owned by the credential. If a device or local credential is lost, an authorized Portal user can revoke the CLI credential from API Keys; remote revocation also closes its active local listeners and temporary Stripe ingress. The server expires abandoned listeners after a crash.
49
49
 
50
50
  ## Optional Stripe CLI orchestration
51
51
 
@@ -37,4 +37,9 @@ export declare function logout(input: {
37
37
  signal?: AbortSignal;
38
38
  token: string;
39
39
  }): Promise<void>;
40
+ export declare function validateVerificationUrl(value: string): string;
41
+ export declare function browserOpenCommand(operatingSystem: NodeJS.Platform, url: string): {
42
+ args: string[];
43
+ command: string;
44
+ };
40
45
  export {};
@@ -37,4 +37,9 @@ export declare function logout(input: {
37
37
  signal?: AbortSignal;
38
38
  token: string;
39
39
  }): Promise<void>;
40
+ export declare function validateVerificationUrl(value: string): string;
41
+ export declare function browserOpenCommand(operatingSystem: NodeJS.Platform, url: string): {
42
+ args: string[];
43
+ command: string;
44
+ };
40
45
  export {};
package/dist/cjs/auth.js CHANGED
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.login = login;
4
4
  exports.status = status;
5
5
  exports.logout = logout;
6
+ exports.validateVerificationUrl = validateVerificationUrl;
7
+ exports.browserOpenCommand = browserOpenCommand;
6
8
  const node_child_process_1 = require("node:child_process");
7
9
  const node_os_1 = require("node:os");
8
10
  const errors_js_1 = require("./errors.js");
@@ -243,7 +245,8 @@ function validateVerificationUrl(value) {
243
245
  catch {
244
246
  throw new errors_js_1.CliError("Proxy returned an invalid browser approval URL", "cli_invalid_auth_response", errors_js_1.cliExitCodes.network);
245
247
  }
246
- const loopback = ["127.0.0.1", "::1", "localhost"].includes(url.hostname);
248
+ const hostname = url.hostname.replace(/^\[|\]$/g, "");
249
+ const loopback = ["127.0.0.1", "::1", "localhost"].includes(hostname);
247
250
  if ((url.protocol !== "https:" && !(url.protocol === "http:" && loopback)) ||
248
251
  url.username ||
249
252
  url.password) {
@@ -252,8 +255,7 @@ function validateVerificationUrl(value) {
252
255
  return url.toString();
253
256
  }
254
257
  async function openBrowser(url) {
255
- const command = (0, node_os_1.platform)() === "darwin" ? "open" : (0, node_os_1.platform)() === "win32" ? "cmd" : "xdg-open";
256
- const args = (0, node_os_1.platform)() === "win32" ? ["/c", "start", "", url] : [url];
258
+ const { args, command } = browserOpenCommand((0, node_os_1.platform)(), url);
257
259
  return new Promise((resolve) => {
258
260
  const child = (0, node_child_process_1.spawn)(command, args, { detached: true, shell: false, stdio: "ignore" });
259
261
  child.once("error", () => resolve(false));
@@ -263,6 +265,17 @@ async function openBrowser(url) {
263
265
  });
264
266
  });
265
267
  }
268
+ function browserOpenCommand(operatingSystem, url) {
269
+ if (operatingSystem === "darwin") {
270
+ return { args: [url], command: "open" };
271
+ }
272
+ if (operatingSystem === "win32") {
273
+ // Avoid cmd.exe entirely: even with shell=false, `cmd /c start` reparses URL
274
+ // metacharacters. Explorer receives the URL as one process argument.
275
+ return { args: [url], command: "explorer.exe" };
276
+ }
277
+ return { args: [url], command: "xdg-open" };
278
+ }
266
279
  function deviceExpired() {
267
280
  return new errors_js_1.CliError("Device authorization expired", "cli_device_authorization_expired", errors_js_1.cliExitCodes.authentication);
268
281
  }
@@ -1,6 +1,6 @@
1
1
  import { CliConfigStore } from "./config.js";
2
2
  import { type CliIo } from "./output.js";
3
- export declare const cliVersion = "0.1.0-prx-128.114.1";
3
+ export declare const cliVersion = "0.1.0-prx-128.115.1";
4
4
  export interface RunCliOptions {
5
5
  configStore?: CliConfigStore;
6
6
  environment?: NodeJS.ProcessEnv;
package/dist/cjs/cli.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { CliConfigStore } from "./config.js";
2
2
  import { type CliIo } from "./output.js";
3
- export declare const cliVersion = "0.1.0-prx-128.114.1";
3
+ export declare const cliVersion = "0.1.0-prx-128.115.1";
4
4
  export interface RunCliOptions {
5
5
  configStore?: CliConfigStore;
6
6
  environment?: NodeJS.ProcessEnv;
package/dist/cjs/cli.js CHANGED
@@ -9,7 +9,7 @@ const config_js_1 = require("./config.js");
9
9
  const errors_js_1 = require("./errors.js");
10
10
  const output_js_1 = require("./output.js");
11
11
  const webhooks_js_1 = require("./webhooks.js");
12
- exports.cliVersion = "0.1.0-prx-128.114.1";
12
+ exports.cliVersion = "0.1.0-prx-128.115.1";
13
13
  async function runCli(argv, options = {}) {
14
14
  const io = options.io ?? {
15
15
  isTTY: Boolean(process.stdin.isTTY && process.stdout.isTTY),
@@ -46,6 +46,8 @@ function run() {
46
46
  if (operation === "read") {
47
47
  query.setObjectForKey(true, $("r_Data"));
48
48
  query.setObjectForKey($("m_LimitOne"), $("m_Limit"));
49
+ // In JXA's Objective-C bridge, nullary $() creates the mutable CFTypeRef
50
+ // out reference that SecItemCopyMatching fills with the returned NSData.
49
51
  const result = $();
50
52
  const status = $.SecItemCopyMatching(query, result);
51
53
  if (status === -25300) return "missing";
@@ -169,6 +169,7 @@ async function runListener(input) {
169
169
  }
170
170
  }
171
171
  async function forwardSelectedDelivery(input) {
172
+ const destination = validateLoopbackDestination(input.forwardTo);
172
173
  const claim = await input.client.claim(input.listenerId, {
173
174
  ...(input.deliveryId ? { deliveryId: input.deliveryId } : {}),
174
175
  ...(input.replayOutboxEventId ? { replayOutboxEventId: input.replayOutboxEventId } : {}),
@@ -176,7 +177,7 @@ async function forwardSelectedDelivery(input) {
176
177
  if (!claim) {
177
178
  throw new errors_js_1.CliError("Selected delivery or replay is not currently claimable", "cli_delivery_not_claimable", errors_js_1.cliExitCodes.conflict);
178
179
  }
179
- const completion = await forwardClaim(input.client, claim, validateLoopbackDestination(input.forwardTo), input.signal);
180
+ const completion = await forwardClaim(input.client, claim, destination, input.signal);
180
181
  return {
181
182
  attempt_id: claim.attempt_id,
182
183
  attempt_number: claim.attempt_number,
@@ -37,4 +37,9 @@ export declare function logout(input: {
37
37
  signal?: AbortSignal;
38
38
  token: string;
39
39
  }): Promise<void>;
40
+ export declare function validateVerificationUrl(value: string): string;
41
+ export declare function browserOpenCommand(operatingSystem: NodeJS.Platform, url: string): {
42
+ args: string[];
43
+ command: string;
44
+ };
40
45
  export {};
package/dist/esm/auth.js CHANGED
@@ -230,7 +230,7 @@ function normalizeCredentialName(name) {
230
230
  }
231
231
  return value;
232
232
  }
233
- function validateVerificationUrl(value) {
233
+ export function validateVerificationUrl(value) {
234
234
  let url;
235
235
  try {
236
236
  url = new URL(value);
@@ -238,7 +238,8 @@ function validateVerificationUrl(value) {
238
238
  catch {
239
239
  throw new CliError("Proxy returned an invalid browser approval URL", "cli_invalid_auth_response", cliExitCodes.network);
240
240
  }
241
- const loopback = ["127.0.0.1", "::1", "localhost"].includes(url.hostname);
241
+ const hostname = url.hostname.replace(/^\[|\]$/g, "");
242
+ const loopback = ["127.0.0.1", "::1", "localhost"].includes(hostname);
242
243
  if ((url.protocol !== "https:" && !(url.protocol === "http:" && loopback)) ||
243
244
  url.username ||
244
245
  url.password) {
@@ -247,8 +248,7 @@ function validateVerificationUrl(value) {
247
248
  return url.toString();
248
249
  }
249
250
  async function openBrowser(url) {
250
- const command = platform() === "darwin" ? "open" : platform() === "win32" ? "cmd" : "xdg-open";
251
- const args = platform() === "win32" ? ["/c", "start", "", url] : [url];
251
+ const { args, command } = browserOpenCommand(platform(), url);
252
252
  return new Promise((resolve) => {
253
253
  const child = spawn(command, args, { detached: true, shell: false, stdio: "ignore" });
254
254
  child.once("error", () => resolve(false));
@@ -258,6 +258,17 @@ async function openBrowser(url) {
258
258
  });
259
259
  });
260
260
  }
261
+ export function browserOpenCommand(operatingSystem, url) {
262
+ if (operatingSystem === "darwin") {
263
+ return { args: [url], command: "open" };
264
+ }
265
+ if (operatingSystem === "win32") {
266
+ // Avoid cmd.exe entirely: even with shell=false, `cmd /c start` reparses URL
267
+ // metacharacters. Explorer receives the URL as one process argument.
268
+ return { args: [url], command: "explorer.exe" };
269
+ }
270
+ return { args: [url], command: "xdg-open" };
271
+ }
261
272
  function deviceExpired() {
262
273
  return new CliError("Device authorization expired", "cli_device_authorization_expired", cliExitCodes.authentication);
263
274
  }
package/dist/esm/cli.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { CliConfigStore } from "./config.js";
2
2
  import { type CliIo } from "./output.js";
3
- export declare const cliVersion = "0.1.0-prx-128.114.1";
3
+ export declare const cliVersion = "0.1.0-prx-128.115.1";
4
4
  export interface RunCliOptions {
5
5
  configStore?: CliConfigStore;
6
6
  environment?: NodeJS.ProcessEnv;
package/dist/esm/cli.js CHANGED
@@ -5,7 +5,7 @@ import { CliConfigStore } from "./config.js";
5
5
  import { asCliError, CliError, cliExitCodes, usageError } from "./errors.js";
6
6
  import { CliOutput } from "./output.js";
7
7
  import { forwardSelectedDelivery, ProxyWebhooksClient, runListener, } from "./webhooks.js";
8
- export const cliVersion = "0.1.0-prx-128.114.1";
8
+ export const cliVersion = "0.1.0-prx-128.115.1";
9
9
  export async function runCli(argv, options = {}) {
10
10
  const io = options.io ?? {
11
11
  isTTY: Boolean(process.stdin.isTTY && process.stdout.isTTY),
@@ -41,6 +41,8 @@ function run() {
41
41
  if (operation === "read") {
42
42
  query.setObjectForKey(true, $("r_Data"));
43
43
  query.setObjectForKey($("m_LimitOne"), $("m_Limit"));
44
+ // In JXA's Objective-C bridge, nullary $() creates the mutable CFTypeRef
45
+ // out reference that SecItemCopyMatching fills with the returned NSData.
44
46
  const result = $();
45
47
  const status = $.SecItemCopyMatching(query, result);
46
48
  if (status === -25300) return "missing";
@@ -163,6 +163,7 @@ export async function runListener(input) {
163
163
  }
164
164
  }
165
165
  export async function forwardSelectedDelivery(input) {
166
+ const destination = validateLoopbackDestination(input.forwardTo);
166
167
  const claim = await input.client.claim(input.listenerId, {
167
168
  ...(input.deliveryId ? { deliveryId: input.deliveryId } : {}),
168
169
  ...(input.replayOutboxEventId ? { replayOutboxEventId: input.replayOutboxEventId } : {}),
@@ -170,7 +171,7 @@ export async function forwardSelectedDelivery(input) {
170
171
  if (!claim) {
171
172
  throw new CliError("Selected delivery or replay is not currently claimable", "cli_delivery_not_claimable", cliExitCodes.conflict);
172
173
  }
173
- const completion = await forwardClaim(input.client, claim, validateLoopbackDestination(input.forwardTo), input.signal);
174
+ const completion = await forwardClaim(input.client, claim, destination, input.signal);
174
175
  return {
175
176
  attempt_id: claim.attempt_id,
176
177
  attempt_number: claim.attempt_number,
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "sideEffects": false,
8
8
  "type": "module",
9
9
  "types": "./dist/esm/index.d.ts",
10
- "version": "0.1.0-prx-128.114.1",
10
+ "version": "0.1.0-prx-128.115.1",
11
11
  "bin": {
12
12
  "proxy": "./dist/esm/bin.js"
13
13
  },