@zuvo/cli 0.1.1 → 0.1.2

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.
Files changed (2) hide show
  1. package/dist/login.js +11 -6
  2. package/package.json +1 -1
package/dist/login.js CHANGED
@@ -27,7 +27,8 @@ async function openBrowser(url) {
27
27
  }
28
28
  }
29
29
  if (platform === 'win32') {
30
- await execFileAsync('cmd', ['/c', 'start', '', url]);
30
+ // cmd.exe treats `&` as a command separator. Quote the URL as one argument.
31
+ await execFileAsync('cmd', ['/c', 'start', '', `"${url.replaceAll('"', '')}"`]);
31
32
  return;
32
33
  }
33
34
  await execFileAsync('xdg-open', [url]);
@@ -68,14 +69,18 @@ export async function loginWithToken(token) {
68
69
  }
69
70
  await saveAccessToken(trimmed);
70
71
  }
71
- export function buildCliLoginUrl(opts) {
72
- const studio = opts.studioUrl.replace(/\/$/, '');
73
- const params = new URLSearchParams({
72
+ export function packCliLoginPayload(opts) {
73
+ return Buffer.from(JSON.stringify({
74
74
  session_id: opts.sessionId,
75
75
  public_key: opts.publicKeyHex,
76
76
  token_name: opts.tokenName,
77
- });
78
- return `${studio}/cli/login?${params.toString()}`;
77
+ }), 'utf8').toString('base64url');
78
+ }
79
+ export function buildCliLoginUrl(opts) {
80
+ const studio = opts.studioUrl.replace(/\/$/, '');
81
+ // A single query param so Windows `start`, macOS Terminal, and VS Code
82
+ // hyperlinks cannot truncate `public_key` at `&`.
83
+ return `${studio}/cli/login?p=${packCliLoginPayload(opts)}`;
79
84
  }
80
85
  export async function loginBrowser(opts) {
81
86
  const { ecdh, publicKeyHex } = generateLoginKeyPair();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zuvo/cli",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "type": "module",
5
5
  "description": "Zuvo CLI — login, link, functions deploy, and db push",
6
6
  "license": "MIT",