@deque/axe-auth 1.1.0-next.dc545028 → 1.1.0-next.e9efc11b
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/credits.json +11 -0
- package/dist/oauth/openBrowser.d.ts +14 -3
- package/dist/oauth/openBrowser.js +22 -5
- package/dist/oauth/tokenStore.d.ts +8 -0
- package/dist/oauth/tokenStore.js +22 -1
- package/package.json +4 -1
package/credits.json
CHANGED
|
@@ -27,6 +27,17 @@
|
|
|
27
27
|
"publisher": "Stephen Mathieson",
|
|
28
28
|
"email": "me@stephenmathieson.com"
|
|
29
29
|
},
|
|
30
|
+
"shlex@3.0.0": {
|
|
31
|
+
"name": "shlex",
|
|
32
|
+
"version": "3.0.0",
|
|
33
|
+
"licenses": "MIT",
|
|
34
|
+
"path": "/home/runner/work/axe-mcp-server/axe-mcp-server/node_modules/.pnpm/shlex@3.0.0/node_modules/shlex",
|
|
35
|
+
"licenseText": "MIT License\n\nCopyright (c) 2018 Ryan Govostes\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n",
|
|
36
|
+
"licenseFile": "/home/runner/work/axe-mcp-server/axe-mcp-server/node_modules/.pnpm/shlex@3.0.0/node_modules/shlex/LICENSE",
|
|
37
|
+
"repository": "https://github.com/rgov/node-shlex",
|
|
38
|
+
"publisher": "Ryan Govostes",
|
|
39
|
+
"copyright": "Copyright (c) 2018 Ryan Govostes"
|
|
40
|
+
},
|
|
30
41
|
"ts-dedent@2.2.0": {
|
|
31
42
|
"name": "ts-dedent",
|
|
32
43
|
"version": "2.2.0",
|
|
@@ -7,13 +7,24 @@ export interface OpenBrowserOptions {
|
|
|
7
7
|
platform?: NodeJS.Platform;
|
|
8
8
|
/** Override for `child_process.spawn`. Used by tests. */
|
|
9
9
|
spawnFn?: SpawnFn;
|
|
10
|
+
/**
|
|
11
|
+
* Override for `process.env.BROWSER`. The de-facto convention shared
|
|
12
|
+
* with `xdg-open` and Python's `webbrowser`: when set, it names the
|
|
13
|
+
* command to invoke instead of the platform default. Parsed shlex-style
|
|
14
|
+
* (POSIX shell tokenization) so values like `firefox --new-window` or
|
|
15
|
+
* `/path/with\ spaces/firefox` work as expected. An empty or missing
|
|
16
|
+
* value falls back to the platform default.
|
|
17
|
+
*/
|
|
18
|
+
browserEnv?: string;
|
|
10
19
|
}
|
|
11
20
|
/**
|
|
12
21
|
* Launches the system browser at `url` in a detached child process.
|
|
13
|
-
*
|
|
14
|
-
*
|
|
22
|
+
* Honors `$BROWSER` when set, falling back to the platform default
|
|
23
|
+
* (`open` / `xdg-open` / `cmd start`). Returns synchronously once the
|
|
24
|
+
* child is spawned — completion of the browser load is intentionally
|
|
25
|
+
* not awaited.
|
|
15
26
|
*
|
|
16
27
|
* @param url Absolute URL to open.
|
|
17
|
-
* @param options Platform/spawn overrides; only exposed for tests.
|
|
28
|
+
* @param options Platform/spawn/env overrides; only exposed for tests.
|
|
18
29
|
*/
|
|
19
30
|
export declare function openBrowser(url: string, options?: OpenBrowserOptions): void;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.openBrowser = openBrowser;
|
|
4
4
|
const node_child_process_1 = require("node:child_process");
|
|
5
|
+
const shlex_1 = require("shlex");
|
|
5
6
|
const errors_1 = require("./errors");
|
|
6
7
|
// On Windows `start` is a cmd.exe builtin, not a standalone binary.
|
|
7
8
|
// The empty `""` pair is a positional placeholder for the window
|
|
@@ -26,7 +27,11 @@ function windowsCommand(url) {
|
|
|
26
27
|
args: ["/c", "start", '""', url.replace(/[&|^<>"%\r\n]/g, (c) => `^${c}`)],
|
|
27
28
|
};
|
|
28
29
|
}
|
|
29
|
-
function browserCommand(platform, url) {
|
|
30
|
+
function browserCommand(platform, url, browserOverride) {
|
|
31
|
+
if (browserOverride && browserOverride.length > 0) {
|
|
32
|
+
const [command, ...extraArgs] = browserOverride;
|
|
33
|
+
return { command, args: [...extraArgs, url] };
|
|
34
|
+
}
|
|
30
35
|
switch (platform) {
|
|
31
36
|
case "darwin":
|
|
32
37
|
return { command: "open", args: [url] };
|
|
@@ -47,16 +52,28 @@ function browserCommand(platform, url) {
|
|
|
47
52
|
}
|
|
48
53
|
/**
|
|
49
54
|
* Launches the system browser at `url` in a detached child process.
|
|
50
|
-
*
|
|
51
|
-
*
|
|
55
|
+
* Honors `$BROWSER` when set, falling back to the platform default
|
|
56
|
+
* (`open` / `xdg-open` / `cmd start`). Returns synchronously once the
|
|
57
|
+
* child is spawned — completion of the browser load is intentionally
|
|
58
|
+
* not awaited.
|
|
52
59
|
*
|
|
53
60
|
* @param url Absolute URL to open.
|
|
54
|
-
* @param options Platform/spawn overrides; only exposed for tests.
|
|
61
|
+
* @param options Platform/spawn/env overrides; only exposed for tests.
|
|
55
62
|
*/
|
|
56
63
|
function openBrowser(url, options = {}) {
|
|
57
64
|
const platform = options.platform ?? process.platform;
|
|
58
65
|
const spawnFn = options.spawnFn ?? node_child_process_1.spawn;
|
|
59
|
-
const
|
|
66
|
+
const browserEnv = options.browserEnv ?? process.env.BROWSER;
|
|
67
|
+
let browserOverride;
|
|
68
|
+
if (browserEnv && browserEnv.length > 0) {
|
|
69
|
+
try {
|
|
70
|
+
browserOverride = (0, shlex_1.split)(browserEnv);
|
|
71
|
+
}
|
|
72
|
+
catch (cause) {
|
|
73
|
+
throw new errors_1.OAuthFlowError("BROWSER_LAUNCH_FAILED", `Failed to parse $BROWSER (${browserEnv}). Open this URL manually:\n${url}`, { cause });
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
const { command, args } = browserCommand(platform, url, browserOverride);
|
|
60
77
|
let child;
|
|
61
78
|
try {
|
|
62
79
|
child = spawnFn(command, args, {
|
|
@@ -100,6 +100,14 @@ export type BlobChainResult = {
|
|
|
100
100
|
* and `MIGRATORS` and applies the latest-shape check on top.
|
|
101
101
|
*/
|
|
102
102
|
export declare function parseAndMigrateBlob(raw: string | null, expectedVersion?: number, migrators?: ReadonlyMap<number, (old: unknown) => unknown | null>): BlobChainResult;
|
|
103
|
+
/**
|
|
104
|
+
* Returns a per-platform hint appended to keychain error messages so
|
|
105
|
+
* users see actionable guidance for their OS instead of generic or
|
|
106
|
+
* Linux-only advice. Exported (but not re-exported from the package
|
|
107
|
+
* index) so tests can exercise each branch without mocking
|
|
108
|
+
* `process.platform`.
|
|
109
|
+
*/
|
|
110
|
+
export declare function platformKeyringHint(platform?: NodeJS.Platform): string;
|
|
103
111
|
/**
|
|
104
112
|
* `TokenStore` backed by the operating system's native keychain via
|
|
105
113
|
* `@napi-rs/keyring` (macOS Keychain, Windows Credential Manager, Linux
|
package/dist/oauth/tokenStore.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.KeyringTokenStore = exports.STORED_BLOB_VERSION = void 0;
|
|
4
4
|
exports.parseAndMigrateBlob = parseAndMigrateBlob;
|
|
5
|
+
exports.platformKeyringHint = platformKeyringHint;
|
|
5
6
|
const errors_1 = require("./errors");
|
|
6
7
|
const keyringBinding_1 = require("./keyringBinding");
|
|
7
8
|
// On macOS: Keychain generic password item with the service name below.
|
|
@@ -153,7 +154,27 @@ function parseAndMigrateBlob(raw, expectedVersion = exports.STORED_BLOB_VERSION,
|
|
|
153
154
|
return { ok: true, blob: current };
|
|
154
155
|
}
|
|
155
156
|
function wrapKeyringError(op, cause) {
|
|
156
|
-
|
|
157
|
+
const causeMessage = cause instanceof Error ? cause.message : String(cause);
|
|
158
|
+
throw new errors_1.OAuthFlowError("KEYRING_UNAVAILABLE", `System keychain ${op} failed: ${causeMessage}. ${platformKeyringHint()}`, { cause });
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Returns a per-platform hint appended to keychain error messages so
|
|
162
|
+
* users see actionable guidance for their OS instead of generic or
|
|
163
|
+
* Linux-only advice. Exported (but not re-exported from the package
|
|
164
|
+
* index) so tests can exercise each branch without mocking
|
|
165
|
+
* `process.platform`.
|
|
166
|
+
*/
|
|
167
|
+
function platformKeyringHint(platform = process.platform) {
|
|
168
|
+
switch (platform) {
|
|
169
|
+
case "darwin":
|
|
170
|
+
return "On macOS this usually means Keychain Access denied or cancelled the prompt.";
|
|
171
|
+
case "win32":
|
|
172
|
+
return "On Windows this usually means Credential Manager rejected the operation.";
|
|
173
|
+
case "linux":
|
|
174
|
+
return "On Linux this usually means no D-Bus Secret Service is running (e.g. GNOME Keyring or KWallet).";
|
|
175
|
+
default:
|
|
176
|
+
return `Underlying platform: ${platform}.`;
|
|
177
|
+
}
|
|
157
178
|
}
|
|
158
179
|
/**
|
|
159
180
|
* `TokenStore` backed by the operating system's native keychain via
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deque/axe-auth",
|
|
3
|
-
"version": "1.1.0-next.
|
|
3
|
+
"version": "1.1.0-next.e9efc11b",
|
|
4
4
|
"description": "CLI authentication utility for Deque services",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -25,11 +25,14 @@
|
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@napi-rs/keyring": "^1.2.0",
|
|
27
27
|
"remove-trailing-slash": "^0.1.1",
|
|
28
|
+
"shlex": "^3.0.0",
|
|
28
29
|
"ts-dedent": "^2.2.0"
|
|
29
30
|
},
|
|
30
31
|
"devDependencies": {
|
|
32
|
+
"@hono/node-server": "^1.19.14",
|
|
31
33
|
"@types/node": "^22.13.10",
|
|
32
34
|
"c8": "^10.1.3",
|
|
35
|
+
"hono": "^4.12.15",
|
|
33
36
|
"tsx": "^4.20.6",
|
|
34
37
|
"typescript": "^5.9.3"
|
|
35
38
|
},
|