@deque/axe-auth 1.1.0-next.97bcb8e6 → 1.1.0-next.9e34c9bf

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 (76) hide show
  1. package/README.md +64 -7
  2. package/credits.json +53 -0
  3. package/dist/cli/commonArgs.d.ts +35 -0
  4. package/dist/cli/commonArgs.help.d.ts +2 -0
  5. package/dist/cli/commonArgs.help.js +20 -0
  6. package/dist/cli/commonArgs.js +63 -0
  7. package/dist/cli/confirm.d.ts +17 -0
  8. package/dist/cli/confirm.js +53 -0
  9. package/dist/cli/errors.d.ts +13 -0
  10. package/dist/cli/errors.js +30 -0
  11. package/dist/cli/testUtils.d.ts +52 -0
  12. package/dist/cli/testUtils.js +100 -0
  13. package/dist/cli/types.d.ts +39 -0
  14. package/dist/cli/types.js +2 -0
  15. package/dist/commands/login.d.ts +41 -0
  16. package/dist/commands/login.help.d.ts +2 -0
  17. package/dist/commands/login.help.js +41 -0
  18. package/dist/commands/login.js +108 -0
  19. package/dist/commands/logout.d.ts +24 -0
  20. package/dist/commands/logout.help.d.ts +2 -0
  21. package/dist/commands/logout.help.js +38 -0
  22. package/dist/commands/logout.js +68 -0
  23. package/dist/commands/token.d.ts +21 -0
  24. package/dist/commands/token.help.d.ts +2 -0
  25. package/dist/commands/token.help.js +41 -0
  26. package/dist/commands/token.js +40 -0
  27. package/dist/index.js +119 -27
  28. package/dist/oauth/authorizationURL.d.ts +24 -0
  29. package/dist/oauth/authorizationURL.js +48 -0
  30. package/dist/oauth/authorize.d.ts +53 -0
  31. package/dist/oauth/authorize.js +117 -0
  32. package/dist/oauth/callbackServer.d.ts +23 -0
  33. package/dist/oauth/callbackServer.js +234 -0
  34. package/dist/oauth/discoverOIDC.d.ts +33 -0
  35. package/dist/oauth/discoverOIDC.js +144 -0
  36. package/dist/oauth/discoverSSOConfig.d.ts +37 -0
  37. package/dist/oauth/discoverSSOConfig.js +105 -0
  38. package/dist/oauth/errors.d.ts +77 -0
  39. package/dist/oauth/errors.js +48 -0
  40. package/dist/oauth/getValidAccessToken.d.ts +54 -0
  41. package/dist/oauth/getValidAccessToken.js +131 -0
  42. package/dist/oauth/index.d.ts +16 -0
  43. package/dist/oauth/index.js +19 -0
  44. package/dist/oauth/issuerURL.d.ts +22 -0
  45. package/dist/oauth/issuerURL.js +38 -0
  46. package/dist/oauth/keyringBinding.d.ts +22 -0
  47. package/dist/oauth/keyringBinding.js +41 -0
  48. package/dist/oauth/logo.generated.d.ts +1 -0
  49. package/dist/oauth/logo.generated.js +7 -0
  50. package/dist/oauth/openBrowser.d.ts +30 -0
  51. package/dist/oauth/openBrowser.js +95 -0
  52. package/dist/oauth/pkce.d.ts +17 -0
  53. package/dist/oauth/pkce.js +43 -0
  54. package/dist/oauth/predicates.d.ts +7 -0
  55. package/dist/oauth/predicates.js +15 -0
  56. package/dist/oauth/refreshTokens.d.ts +30 -0
  57. package/dist/oauth/refreshTokens.js +60 -0
  58. package/dist/oauth/renderHtml.d.ts +9 -0
  59. package/dist/oauth/renderHtml.js +60 -0
  60. package/dist/oauth/revokeToken.d.ts +28 -0
  61. package/dist/oauth/revokeToken.js +63 -0
  62. package/dist/oauth/testUtils.d.ts +35 -0
  63. package/dist/oauth/testUtils.js +61 -0
  64. package/dist/oauth/tokenExchange.d.ts +26 -0
  65. package/dist/oauth/tokenExchange.js +44 -0
  66. package/dist/oauth/tokenResponse.d.ts +22 -0
  67. package/dist/oauth/tokenResponse.js +101 -0
  68. package/dist/oauth/tokenStore.d.ts +183 -0
  69. package/dist/oauth/tokenStore.js +560 -0
  70. package/dist/userAgent.d.ts +12 -0
  71. package/dist/userAgent.js +18 -0
  72. package/docs/architecture.md +201 -0
  73. package/docs/callback-page.md +24 -0
  74. package/docs/callback-server.md +21 -0
  75. package/docs/oauth-flow.md +15 -0
  76. package/package.json +21 -4
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.discoverSSOConfig = discoverSSOConfig;
4
+ const errors_1 = require("./errors");
5
+ const predicates_1 = require("./predicates");
6
+ const userAgent_1 = require("../userAgent");
7
+ const LOOPBACK_HOSTS = new Set(["localhost", "127.0.0.1", "[::1]"]);
8
+ function assertSecureServerURL(serverURL, allowInsecure) {
9
+ let parsed;
10
+ try {
11
+ parsed = new URL(serverURL);
12
+ }
13
+ catch {
14
+ throw new errors_1.OAuthFlowError("DISCOVERY_FAILED", `axe server URL is not a valid URL: ${serverURL}`);
15
+ }
16
+ if (parsed.protocol === "https:")
17
+ return parsed;
18
+ if (parsed.protocol === "http:") {
19
+ const hostname = parsed.host.toLowerCase().replace(/:\d+$/, "");
20
+ if (LOOPBACK_HOSTS.has(hostname))
21
+ return parsed;
22
+ if (allowInsecure)
23
+ return parsed;
24
+ throw new errors_1.OAuthFlowError("DISCOVERY_FAILED", `Refusing to use axe server URL over http:// against non-loopback host ${parsed.host}. Use https:// or pass --allow-insecure-issuer to override (only do this on trusted networks).`);
25
+ }
26
+ throw new errors_1.OAuthFlowError("DISCOVERY_FAILED", `Unsupported axe server URL scheme '${parsed.protocol}'; expected https: or http: (loopback only).`);
27
+ }
28
+ function buildSSOConfigURL(parsed) {
29
+ const copy = new URL(parsed.toString());
30
+ copy.search = "";
31
+ copy.hash = "";
32
+ copy.pathname = `${copy.pathname.replace(/\/+$/, "")}/api/sso-config`;
33
+ return copy.toString();
34
+ }
35
+ /**
36
+ * Fetches and parses the axe server's `/api/sso-config` discovery
37
+ * endpoint. Used by `axe-auth login` to derive the OAuth issuer URL,
38
+ * realm, and CLI-specific client ID from the axe server URL the user
39
+ * supplied (or the SaaS prod default), so users no longer have to know
40
+ * the underlying Keycloak coordinates.
41
+ *
42
+ * Distinguishes three failure shapes for the operator-relevant cases:
43
+ *
44
+ * - `mcpClientId` field absent: the axe server deployment predates the
45
+ * field entirely. Surfaces as "needs upgrading".
46
+ * - `mcpClientId` is `null`: the axe server version supports the field
47
+ * but the operator has not configured `KEYCLOAK_MCP_PUBLIC_CLIENT_ID`.
48
+ * Surfaces as "ask the operator to configure".
49
+ * - any non-empty string: returned as-is.
50
+ *
51
+ * Other failure modes (unreachable, non-2xx, malformed JSON, missing
52
+ * `url` / `realm`) all map to `DISCOVERY_FAILED` with a descriptive
53
+ * message. The caller is expected to surface these errors verbatim.
54
+ */
55
+ async function discoverSSOConfig(serverURL, options = {}) {
56
+ const allowInsecure = options.allowInsecure ?? false;
57
+ const parsed = assertSecureServerURL(serverURL, allowInsecure);
58
+ const url = buildSSOConfigURL(parsed);
59
+ let response;
60
+ try {
61
+ response = await fetch(url, {
62
+ headers: { "User-Agent": userAgent_1.USER_AGENT },
63
+ signal: options.signal,
64
+ });
65
+ }
66
+ catch (cause) {
67
+ throw new errors_1.OAuthFlowError("DISCOVERY_FAILED", `Could not reach the axe server at ${url}. Check the --server URL and your network connection.`, { cause });
68
+ }
69
+ if (!response.ok) {
70
+ throw new errors_1.OAuthFlowError("DISCOVERY_FAILED", `axe server at ${url} responded with HTTP ${response.status}. Check the --server URL.`);
71
+ }
72
+ let body;
73
+ try {
74
+ body = await response.json();
75
+ }
76
+ catch (cause) {
77
+ throw new errors_1.OAuthFlowError("DISCOVERY_FAILED", `axe server at ${url} did not return valid JSON.`, { cause });
78
+ }
79
+ if (body === null || typeof body !== "object" || Array.isArray(body)) {
80
+ throw new errors_1.OAuthFlowError("DISCOVERY_FAILED", `axe server at ${url} returned a non-object response body.`);
81
+ }
82
+ const raw = body;
83
+ const missing = [];
84
+ if (!(0, predicates_1.isNonEmptyString)(raw.url))
85
+ missing.push("url");
86
+ if (!(0, predicates_1.isNonEmptyString)(raw.realm))
87
+ missing.push("realm");
88
+ if (missing.length > 0) {
89
+ throw new errors_1.OAuthFlowError("DISCOVERY_FAILED", `${url} is missing required field(s): ${missing.join(", ")}`);
90
+ }
91
+ if (!("mcpClientId" in raw)) {
92
+ throw new errors_1.OAuthFlowError("DISCOVERY_FAILED", `axe server at ${serverURL} does not advertise OAuth-based MCP authentication. The deployment may need to be upgraded to a version that supports the axe-auth CLI.`);
93
+ }
94
+ if (raw.mcpClientId === null) {
95
+ throw new errors_1.OAuthFlowError("DISCOVERY_FAILED", `axe server at ${serverURL} has not been configured for OAuth-based MCP authentication. Ask your operator to set the KEYCLOAK_MCP_PUBLIC_CLIENT_ID environment variable on the axe server.`);
96
+ }
97
+ if (!(0, predicates_1.isNonEmptyString)(raw.mcpClientId)) {
98
+ throw new errors_1.OAuthFlowError("DISCOVERY_FAILED", `axe server at ${serverURL} returned a malformed mcpClientId (expected a non-empty string).`);
99
+ }
100
+ return {
101
+ url: raw.url,
102
+ realm: raw.realm,
103
+ mcpClientId: raw.mcpClientId,
104
+ };
105
+ }
@@ -0,0 +1,77 @@
1
+ /** Error codes raised by the loopback callback server. */
2
+ export type OAuthCallbackErrorCode =
3
+ /** No callback arrived within `timeoutMs`; a retry is reasonable. */
4
+ "TIMEOUT"
5
+ /** Callback `state` did not match `expectedState`. Surface a generic failure — do NOT echo the expected value. */
6
+ | "STATE_MISMATCH"
7
+ /** Callback carried `?error=...`. `details` holds `error` and optionally `error_description` for display. */
8
+ | "PROVIDER_ERROR"
9
+ /** Callback had no `code` parameter; treat as a malformed response. */
10
+ | "MISSING_CODE"
11
+ /** Could not bind the loopback port. No retry — environment likely blocked. */
12
+ | "BIND_FAILED"
13
+ /** Caller's `AbortSignal` fired. Expected; no user-facing message. */
14
+ | "ABORTED";
15
+ /** Options for `OAuthCallbackError`. */
16
+ export interface OAuthCallbackErrorOptions {
17
+ /** Structured metadata for callers that want to surface specific fields. */
18
+ details?: Record<string, string>;
19
+ /** Underlying error that triggered this failure. */
20
+ cause?: unknown;
21
+ }
22
+ /**
23
+ * Error raised by the loopback callback server when the authorization
24
+ * response cannot be consumed (timeout, state mismatch, provider error,
25
+ * malformed response, bind failure, or caller abort).
26
+ */
27
+ export declare class OAuthCallbackError extends Error {
28
+ /** Discriminator for programmatic handling. */
29
+ readonly code: OAuthCallbackErrorCode;
30
+ /** Structured metadata carried alongside the error, if any. */
31
+ readonly details?: Record<string, string>;
32
+ constructor(code: OAuthCallbackErrorCode, message: string, options?: OAuthCallbackErrorOptions);
33
+ }
34
+ /** Error codes raised by the OAuth flow orchestrator and its helpers. */
35
+ export type OAuthFlowErrorCode =
36
+ /** OIDC discovery could not reach or parse the authorization server. No browser was opened. */
37
+ "DISCOVERY_FAILED"
38
+ /** Could not launch the system browser. User should be told to open the URL manually. */
39
+ | "BROWSER_LAUNCH_FAILED"
40
+ /** Authorization code → token exchange was rejected by the authorization server. */
41
+ | "TOKEN_EXCHANGE_FAILED"
42
+ /** System keychain is unavailable (e.g. no D-Bus secret service on Linux). */
43
+ | "KEYRING_UNAVAILABLE"
44
+ /** OAuth blob is too large for the OS keystore (Windows Credential Manager: 2560 UTF-16 chars per entry, MAX_CHUNKS chunks max). The keystore itself is healthy; the IDP is issuing tokens with too many claims. */
45
+ | "TOKEN_TOO_LARGE"
46
+ /** Authorization endpoint returned by discovery cannot be used (e.g. already carries an OAuth-required param). Server misconfiguration. */
47
+ | "INVALID_AUTHORIZATION_ENDPOINT"
48
+ /** No usable stored credentials; the user needs to run `login` to re-authenticate. Covers empty / corrupt / version-mismatched store and refresh tokens the authorization server has revoked. */
49
+ | "NOT_AUTHENTICATED";
50
+ /** Options for `OAuthFlowError`. */
51
+ export interface OAuthFlowErrorOptions {
52
+ /** Structured metadata for callers that want to surface specific fields. */
53
+ details?: Record<string, string>;
54
+ /** Underlying error that triggered this failure. */
55
+ cause?: unknown;
56
+ }
57
+ /**
58
+ * Error raised by anything in the OAuth flow outside the callback
59
+ * server itself: OIDC discovery, browser launch, token exchange, or
60
+ * keychain access.
61
+ *
62
+ * **Logging note.** For code `TOKEN_EXCHANGE_FAILED`, `message` may
63
+ * include the authorization server's `error_description`, which is
64
+ * free-form text the server controls and could plausibly contain
65
+ * user-identifying or otherwise sensitive information. Prefer
66
+ * structured logging via the discriminated `code` and the explicit
67
+ * `details` fields; avoid echoing the raw `message` (or the result
68
+ * of `console.error(err)`, which includes it) into shared log sinks
69
+ * without a redaction step.
70
+ */
71
+ export declare class OAuthFlowError extends Error {
72
+ /** Discriminator for programmatic handling. */
73
+ readonly code: OAuthFlowErrorCode;
74
+ /** Structured metadata carried alongside the error, if any. */
75
+ readonly details?: Record<string, string>;
76
+ constructor(code: OAuthFlowErrorCode, message: string, options?: OAuthFlowErrorOptions);
77
+ }
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OAuthFlowError = exports.OAuthCallbackError = void 0;
4
+ /**
5
+ * Error raised by the loopback callback server when the authorization
6
+ * response cannot be consumed (timeout, state mismatch, provider error,
7
+ * malformed response, bind failure, or caller abort).
8
+ */
9
+ class OAuthCallbackError extends Error {
10
+ /** Discriminator for programmatic handling. */
11
+ code;
12
+ /** Structured metadata carried alongside the error, if any. */
13
+ details;
14
+ constructor(code, message, options = {}) {
15
+ super(message, { cause: options.cause });
16
+ this.name = "OAuthCallbackError";
17
+ this.code = code;
18
+ this.details = options.details;
19
+ }
20
+ }
21
+ exports.OAuthCallbackError = OAuthCallbackError;
22
+ /**
23
+ * Error raised by anything in the OAuth flow outside the callback
24
+ * server itself: OIDC discovery, browser launch, token exchange, or
25
+ * keychain access.
26
+ *
27
+ * **Logging note.** For code `TOKEN_EXCHANGE_FAILED`, `message` may
28
+ * include the authorization server's `error_description`, which is
29
+ * free-form text the server controls and could plausibly contain
30
+ * user-identifying or otherwise sensitive information. Prefer
31
+ * structured logging via the discriminated `code` and the explicit
32
+ * `details` fields; avoid echoing the raw `message` (or the result
33
+ * of `console.error(err)`, which includes it) into shared log sinks
34
+ * without a redaction step.
35
+ */
36
+ class OAuthFlowError extends Error {
37
+ /** Discriminator for programmatic handling. */
38
+ code;
39
+ /** Structured metadata carried alongside the error, if any. */
40
+ details;
41
+ constructor(code, message, options = {}) {
42
+ super(message, { cause: options.cause });
43
+ this.name = "OAuthFlowError";
44
+ this.code = code;
45
+ this.details = options.details;
46
+ }
47
+ }
48
+ exports.OAuthFlowError = OAuthFlowError;
@@ -0,0 +1,54 @@
1
+ import { type LoadResult, type TokenStore } from "./tokenStore";
2
+ /** Options for `getValidAccessToken`. */
3
+ export interface GetValidAccessTokenOptions {
4
+ /** OIDC issuer URL. Must match the stored entry's `issuerURL`; mismatch throws NOT_AUTHENTICATED. */
5
+ issuerURL: string;
6
+ /** OAuth client identifier. Must match the stored entry's `clientId`; same mismatch behavior as `issuerURL`. */
7
+ clientId: string;
8
+ /**
9
+ * How close to expiry preemptive refresh kicks in, in ms. Default
10
+ * 60_000. Buffer covers clock skew vs. the server. Assumes
11
+ * access-token TTL ≫ this; otherwise every call refreshes.
12
+ */
13
+ expiryBufferMs?: number;
14
+ /** Override for the token store. */
15
+ tokenStore?: TokenStore;
16
+ /** Pre-loaded `tokenStore.load()` result so the dispatcher's keychain read isn't repeated. */
17
+ loadedEntry?: LoadResult;
18
+ /** Aborts discovery + the refresh POST when fired. */
19
+ signal?: AbortSignal;
20
+ /** Forwarded to discovery; permits non-loopback http. */
21
+ allowInsecureIssuer?: boolean;
22
+ /** Called for soft warnings (e.g. rotated tokens couldn't be persisted — see HAZARD note in the body). Default prints to stderr only when stderr is a TTY. */
23
+ onWarning?: (message: string) => void;
24
+ /** Source of `now`. Defaults to `Date.now`. Injected for test determinism. */
25
+ now?: () => number;
26
+ }
27
+ /**
28
+ * Returns a currently-valid access token string for the given issuer,
29
+ * refreshing via the stored refresh token if the cached access token
30
+ * is within `expiryBufferMs` of expiring (or already expired).
31
+ *
32
+ * Throws `OAuthFlowError("NOT_AUTHENTICATED", ...)` when the user
33
+ * must re-run `axe-auth login` — covers an empty / corrupt /
34
+ * version-mismatched store, an expired access token with no refresh
35
+ * token to rotate with, and a refresh attempt rejected with
36
+ * `invalid_grant` (which also clears the stored tokens).
37
+ *
38
+ * Throws `OAuthFlowError("TOKEN_EXCHANGE_FAILED", ...)` for transient
39
+ * failures during refresh (network errors, 5xx, malformed responses)
40
+ * and leaves the stored tokens intact so a retry is possible.
41
+ *
42
+ * Throws `OAuthFlowError("DISCOVERY_FAILED", ...)` when the issuer
43
+ * URL cannot be reached or parsed at refresh time.
44
+ *
45
+ * **Concurrency note.** Not safe against parallel invocations for
46
+ * the same issuer. Keycloak rotates refresh tokens by default; if
47
+ * two parallel calls both land on the refresh path, only one
48
+ * winner's rotated refresh token will be persisted and the loser's
49
+ * rotated token is stranded. The intended consumer is the
50
+ * `axe-auth token` CLI (a one-shot), so this is fine in context;
51
+ * per-request callers should wrap in an in-flight-Promise singleton
52
+ * keyed by issuer.
53
+ */
54
+ export declare function getValidAccessToken(options: GetValidAccessTokenOptions): Promise<string>;
@@ -0,0 +1,131 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getValidAccessToken = getValidAccessToken;
4
+ const discoverOIDC_1 = require("./discoverOIDC");
5
+ const errors_1 = require("./errors");
6
+ const refreshTokens_1 = require("./refreshTokens");
7
+ const tokenStore_1 = require("./tokenStore");
8
+ const DEFAULT_EXPIRY_BUFFER_MS = 60_000;
9
+ function defaultOnWarning(message) {
10
+ if (process.stderr.isTTY) {
11
+ console.error(`axe-auth: ${message}`);
12
+ }
13
+ }
14
+ function isInvalidGrant(err) {
15
+ return (err instanceof errors_1.OAuthFlowError &&
16
+ err.code === "TOKEN_EXCHANGE_FAILED" &&
17
+ err.details?.error === "invalid_grant");
18
+ }
19
+ function notAuthenticated(message, cause) {
20
+ return new errors_1.OAuthFlowError("NOT_AUTHENTICATED", message, cause === undefined ? undefined : { cause });
21
+ }
22
+ /**
23
+ * Returns a currently-valid access token string for the given issuer,
24
+ * refreshing via the stored refresh token if the cached access token
25
+ * is within `expiryBufferMs` of expiring (or already expired).
26
+ *
27
+ * Throws `OAuthFlowError("NOT_AUTHENTICATED", ...)` when the user
28
+ * must re-run `axe-auth login` — covers an empty / corrupt /
29
+ * version-mismatched store, an expired access token with no refresh
30
+ * token to rotate with, and a refresh attempt rejected with
31
+ * `invalid_grant` (which also clears the stored tokens).
32
+ *
33
+ * Throws `OAuthFlowError("TOKEN_EXCHANGE_FAILED", ...)` for transient
34
+ * failures during refresh (network errors, 5xx, malformed responses)
35
+ * and leaves the stored tokens intact so a retry is possible.
36
+ *
37
+ * Throws `OAuthFlowError("DISCOVERY_FAILED", ...)` when the issuer
38
+ * URL cannot be reached or parsed at refresh time.
39
+ *
40
+ * **Concurrency note.** Not safe against parallel invocations for
41
+ * the same issuer. Keycloak rotates refresh tokens by default; if
42
+ * two parallel calls both land on the refresh path, only one
43
+ * winner's rotated refresh token will be persisted and the loser's
44
+ * rotated token is stranded. The intended consumer is the
45
+ * `axe-auth token` CLI (a one-shot), so this is fine in context;
46
+ * per-request callers should wrap in an in-flight-Promise singleton
47
+ * keyed by issuer.
48
+ */
49
+ async function getValidAccessToken(options) {
50
+ const { issuerURL, clientId, expiryBufferMs = DEFAULT_EXPIRY_BUFFER_MS, tokenStore = new tokenStore_1.KeyringTokenStore(), loadedEntry, signal, allowInsecureIssuer, onWarning = defaultOnWarning, now = Date.now, } = options;
51
+ const loaded = loadedEntry ?? (await tokenStore.load());
52
+ if (!loaded.ok) {
53
+ switch (loaded.reason) {
54
+ case "empty":
55
+ throw notAuthenticated("No stored credentials. Run `axe-auth login` first.");
56
+ case "corrupt":
57
+ throw notAuthenticated("Stored credentials are unreadable. Run `axe-auth login` to re-authenticate.");
58
+ case "version-mismatch":
59
+ throw notAuthenticated(`Stored credentials are from an unsupported schema version (v:${loaded.storedVersion}). Run \`axe-auth login\` to re-authenticate.`);
60
+ }
61
+ }
62
+ // Refuse on issuer/client mismatch: refreshing tokens at a
63
+ // different endpoint would leak the refresh token to the wrong
64
+ // server.
65
+ if (loaded.entry.issuerURL !== issuerURL ||
66
+ loaded.entry.clientId !== clientId) {
67
+ throw notAuthenticated(`Stored credentials are for issuer ${loaded.entry.issuerURL} (client ${loaded.entry.clientId}), but the requested issuer is ${issuerURL} (client ${clientId}). Run \`axe-auth login\` to re-authenticate.`);
68
+ }
69
+ const tokens = loaded.entry.tokens;
70
+ if (now() + expiryBufferMs < tokens.expiresAt) {
71
+ return tokens.accessToken;
72
+ }
73
+ if (!tokens.refreshToken) {
74
+ throw notAuthenticated("Access token has expired and no refresh token is available. Run `axe-auth login` to re-authenticate.");
75
+ }
76
+ const config = await (0, discoverOIDC_1.discoverOIDC)(issuerURL, {
77
+ signal,
78
+ allowInsecureIssuer,
79
+ });
80
+ let fresh;
81
+ try {
82
+ fresh = await (0, refreshTokens_1.refreshTokens)({
83
+ tokenEndpoint: config.tokenEndpoint,
84
+ clientId,
85
+ refreshToken: tokens.refreshToken,
86
+ now,
87
+ signal,
88
+ });
89
+ }
90
+ catch (err) {
91
+ if (isInvalidGrant(err)) {
92
+ // Best-effort clear: if the clear itself fails, still surface
93
+ // NOT_AUTHENTICATED so the user gets the "please run login"
94
+ // signal — the next run will refresh, land back here, and
95
+ // retry the clear.
96
+ try {
97
+ await tokenStore.clear();
98
+ }
99
+ catch (clearErr) {
100
+ onWarning(`Failed to clear stored tokens after refresh rejection: ${clearErr instanceof Error ? clearErr.message : String(clearErr)}. Next run may need to clear manually.`);
101
+ }
102
+ throw notAuthenticated("Your session has expired. Run `axe-auth login` to re-authenticate.", err);
103
+ }
104
+ // Transient failure — leave the store alone so the user can
105
+ // retry without re-logging-in.
106
+ throw err;
107
+ }
108
+ // HAZARD: Keycloak (and most rotating-refresh-token providers) have
109
+ // already consumed the old refresh token server-side by the time
110
+ // `refreshTokens` returns. If persisting the rotated set fails
111
+ // here, we hold a valid access token in memory but the stored
112
+ // refresh token is now stale — the next invocation will POST it,
113
+ // get `invalid_grant`, and prompt re-authentication.
114
+ //
115
+ // We still return the fresh access token so the current call is
116
+ // useful, and warn the caller so "why does the next run need me to
117
+ // log in again?" has a breadcrumb.
118
+ try {
119
+ await tokenStore.save({
120
+ tokens: fresh,
121
+ issuerURL: loaded.entry.issuerURL,
122
+ clientId: loaded.entry.clientId,
123
+ allowInsecureIssuer: loaded.entry.allowInsecureIssuer,
124
+ walnutURL: loaded.entry.walnutURL,
125
+ });
126
+ }
127
+ catch (err) {
128
+ onWarning(`Refreshed tokens could not be saved: ${err instanceof Error ? err.message : String(err)}. The current call will succeed, but the next invocation will require re-authentication.`);
129
+ }
130
+ return fresh.accessToken;
131
+ }
@@ -0,0 +1,16 @@
1
+ export { startCallbackServer } from "./callbackServer";
2
+ export type { CallbackServerOptions, CallbackServerHandle, CallbackResult, } from "./callbackServer";
3
+ export { OAuthCallbackError, OAuthFlowError } from "./errors";
4
+ export type { OAuthCallbackErrorCode, OAuthCallbackErrorOptions, OAuthFlowErrorCode, OAuthFlowErrorOptions, } from "./errors";
5
+ export { authorize } from "./authorize";
6
+ export type { AuthorizeOptions } from "./authorize";
7
+ export { getValidAccessToken } from "./getValidAccessToken";
8
+ export type { GetValidAccessTokenOptions } from "./getValidAccessToken";
9
+ export { refreshTokens } from "./refreshTokens";
10
+ export type { RefreshTokensOptions } from "./refreshTokens";
11
+ export type { TokenSet } from "./tokenResponse";
12
+ export { KeyringTokenStore, STORED_BLOB_VERSION } from "./tokenStore";
13
+ export type { LoadResult, StoredEntry, TokenStore } from "./tokenStore";
14
+ export type { KeyringEntry, KeyringEntryFactory } from "./keyringBinding";
15
+ export { discoverOIDC } from "./discoverOIDC";
16
+ export type { OIDCConfiguration, DiscoverOIDCOptions } from "./discoverOIDC";
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.discoverOIDC = exports.STORED_BLOB_VERSION = exports.KeyringTokenStore = exports.refreshTokens = exports.getValidAccessToken = exports.authorize = exports.OAuthFlowError = exports.OAuthCallbackError = exports.startCallbackServer = void 0;
4
+ var callbackServer_1 = require("./callbackServer");
5
+ Object.defineProperty(exports, "startCallbackServer", { enumerable: true, get: function () { return callbackServer_1.startCallbackServer; } });
6
+ var errors_1 = require("./errors");
7
+ Object.defineProperty(exports, "OAuthCallbackError", { enumerable: true, get: function () { return errors_1.OAuthCallbackError; } });
8
+ Object.defineProperty(exports, "OAuthFlowError", { enumerable: true, get: function () { return errors_1.OAuthFlowError; } });
9
+ var authorize_1 = require("./authorize");
10
+ Object.defineProperty(exports, "authorize", { enumerable: true, get: function () { return authorize_1.authorize; } });
11
+ var getValidAccessToken_1 = require("./getValidAccessToken");
12
+ Object.defineProperty(exports, "getValidAccessToken", { enumerable: true, get: function () { return getValidAccessToken_1.getValidAccessToken; } });
13
+ var refreshTokens_1 = require("./refreshTokens");
14
+ Object.defineProperty(exports, "refreshTokens", { enumerable: true, get: function () { return refreshTokens_1.refreshTokens; } });
15
+ var tokenStore_1 = require("./tokenStore");
16
+ Object.defineProperty(exports, "KeyringTokenStore", { enumerable: true, get: function () { return tokenStore_1.KeyringTokenStore; } });
17
+ Object.defineProperty(exports, "STORED_BLOB_VERSION", { enumerable: true, get: function () { return tokenStore_1.STORED_BLOB_VERSION; } });
18
+ var discoverOIDC_1 = require("./discoverOIDC");
19
+ Object.defineProperty(exports, "discoverOIDC", { enumerable: true, get: function () { return discoverOIDC_1.discoverOIDC; } });
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Canonicalizes an OIDC issuer URL for equivalence comparison. Two URLs
3
+ * that normalize to the same string refer to the same issuer, which is
4
+ * what `discoverOIDC` uses to build discovery URLs and what
5
+ * `KeyringTokenStore` uses to key keychain entries.
6
+ *
7
+ * Rules (per RFC 3986 §6.2 URI comparison):
8
+ * - Trailing slashes stripped from the path.
9
+ * - Scheme and authority (host + optional port) lowercased — both are
10
+ * case-insensitive per the RFC.
11
+ * - Default ports (80 for http, 443 for https) collapsed via `URL.host`.
12
+ * - Path preserved case-sensitively.
13
+ * - Query string and fragment dropped: OIDC issuers are defined by
14
+ * scheme + authority + path, and carrying them through would break
15
+ * downstream path concatenation (e.g. appending
16
+ * `/.well-known/openid-configuration`).
17
+ *
18
+ * If the input is not a parseable URL, the function trims trailing
19
+ * slashes and returns — discovery will surface a clearer error than
20
+ * this function could.
21
+ */
22
+ export declare function normalizeIssuerURL(url: string): string;
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.normalizeIssuerURL = normalizeIssuerURL;
4
+ /**
5
+ * Canonicalizes an OIDC issuer URL for equivalence comparison. Two URLs
6
+ * that normalize to the same string refer to the same issuer, which is
7
+ * what `discoverOIDC` uses to build discovery URLs and what
8
+ * `KeyringTokenStore` uses to key keychain entries.
9
+ *
10
+ * Rules (per RFC 3986 §6.2 URI comparison):
11
+ * - Trailing slashes stripped from the path.
12
+ * - Scheme and authority (host + optional port) lowercased — both are
13
+ * case-insensitive per the RFC.
14
+ * - Default ports (80 for http, 443 for https) collapsed via `URL.host`.
15
+ * - Path preserved case-sensitively.
16
+ * - Query string and fragment dropped: OIDC issuers are defined by
17
+ * scheme + authority + path, and carrying them through would break
18
+ * downstream path concatenation (e.g. appending
19
+ * `/.well-known/openid-configuration`).
20
+ *
21
+ * If the input is not a parseable URL, the function trims trailing
22
+ * slashes and returns — discovery will surface a clearer error than
23
+ * this function could.
24
+ */
25
+ function normalizeIssuerURL(url) {
26
+ let parsed;
27
+ try {
28
+ parsed = new URL(url);
29
+ }
30
+ catch {
31
+ return url.replace(/\/+$/, "");
32
+ }
33
+ // `URL.protocol` is already lowercased by the URL parser.
34
+ // `URL.host` retains input casing, so lowercase it explicitly.
35
+ const host = parsed.host.toLowerCase();
36
+ const pathname = parsed.pathname.replace(/\/+$/, "");
37
+ return `${parsed.protocol}//${host}${pathname}`;
38
+ }
@@ -0,0 +1,22 @@
1
+ /** Minimal keyring-entry surface consumed by the package's stores. */
2
+ export interface KeyringEntry {
3
+ /** Writes the password for this entry. */
4
+ setPassword(password: string): void;
5
+ /** Reads the current password, or returns `null` if none is set. */
6
+ getPassword(): string | null;
7
+ /** Deletes the password and returns `true` if one existed. */
8
+ deletePassword(): boolean;
9
+ }
10
+ /**
11
+ * Factory for `KeyringEntry` values. Injection seam for tests;
12
+ * production callers use the default that constructs
13
+ * `@napi-rs/keyring` entries lazily.
14
+ */
15
+ export type KeyringEntryFactory = (service: string, account: string) => KeyringEntry;
16
+ /**
17
+ * Default `KeyringEntryFactory`. Resolves `@napi-rs/keyring` lazily
18
+ * so platforms without a prebuilt binding only see a
19
+ * `KEYRING_UNAVAILABLE` on first store construction, not on module
20
+ * import.
21
+ */
22
+ export declare const defaultEntryFactory: KeyringEntryFactory;
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.defaultEntryFactory = void 0;
4
+ const node_module_1 = require("node:module");
5
+ const errors_1 = require("./errors");
6
+ const requireFromHere = (0, node_module_1.createRequire)(__filename);
7
+ // Lazy-resolved Entry constructor. Importing @napi-rs/keyring at the
8
+ // top of this module would run its native binding loader at
9
+ // module-load time, throwing before any of our OAuthFlowError code
10
+ // catches it and preventing the module from being imported at all on
11
+ // platforms without a prebuilt. We defer the require into
12
+ // `defaultEntryFactory`, which turns that import-time failure into a
13
+ // `KEYRING_UNAVAILABLE` surfaced on the first store construction —
14
+ // not on first save/load/clear, since callers construct stores
15
+ // eagerly as default-arg expressions. Runtime keychain errors
16
+ // (missing D-Bus Secret Service, macOS Keychain denial, etc.) are a
17
+ // separate concern and surface later, inside save/load/clear.
18
+ let cachedEntryCtor = null;
19
+ function resolveEntryCtor() {
20
+ if (cachedEntryCtor)
21
+ return cachedEntryCtor;
22
+ try {
23
+ const mod = requireFromHere("@napi-rs/keyring");
24
+ cachedEntryCtor = mod.Entry;
25
+ return cachedEntryCtor;
26
+ }
27
+ catch (cause) {
28
+ throw new errors_1.OAuthFlowError("KEYRING_UNAVAILABLE", `Could not load @napi-rs/keyring. A prebuilt native binding for this platform may be missing.`, { cause });
29
+ }
30
+ }
31
+ /**
32
+ * Default `KeyringEntryFactory`. Resolves `@napi-rs/keyring` lazily
33
+ * so platforms without a prebuilt binding only see a
34
+ * `KEYRING_UNAVAILABLE` on first store construction, not on module
35
+ * import.
36
+ */
37
+ const defaultEntryFactory = (service, account) => {
38
+ const Ctor = resolveEntryCtor();
39
+ return new Ctor(service, account);
40
+ };
41
+ exports.defaultEntryFactory = defaultEntryFactory;
@@ -0,0 +1 @@
1
+ export declare const LOGO_PNG_BASE64 = "iVBORw0KGgoAAAANSUhEUgAAALQAAAC0CAYAAAA9zQYyAAAgAElEQVR4nO2df4wd13XfP2dBEIRAEKpKEIKqCISgEo7gOKqqKPsYpXEE1b8i/4rtWo6jJP7RuLHqtq7gt0kdwXANp9jn2Ibr2IkTJc4PO45l2bUMNZV/xHZcRW+jyI4iCKoqCASjCgShCiyhEARBEHv6x7x755wz9y13982bt+R7X2D3zdy5c+fMne+ce865P0ZY4OJHf7gXkX9AFSQlCqDVr2qdV0YZVKttZZSPkEdBZVReOi7mPE1Jn2O1d/s0bquEpa4utMAsYQim6U8DT6VxSk1KqX/Te5A2dERs94Kkc6TxLkwbC0LPCxLB8naCmvSUlLRvIqnR7ApIeiswJFdcpqTZw3sybezq9nILzA7ZBKgh4VjWrliTwaeJ+HOcGWNNl/Yk3woWhJ4bWGbatFKSeJKKIbolf8xDIU/HNsfC5JgLaNMk2CBrZXJoyFpIU6vZNaSlcyaTfKtYEHouYO3htA9FthlTu9oPtoMleHQcG5ER6dz0WBB6LhCiFWPzRBtYg8YlEF58mRJNmI7VMwsbek4gxuRITpyNPwcil3iYNLDajNTlNdK7t59hQej5gViibZDm0kdIpkTudMH4mOklscdmR+oFoecG6oMcasjmzOtkC9enNezv7OyFnkEJhXWvoBc29FzBak5J+8budd3iZlsDma1TmX/dG1D/LTpWFpgOpNaqjbhxodvbEl0DwZ0mDmZIo5xusdDQc4XUjZ1IaGLHGvbtr1W+NkZNLAdfdoyQdIAFoecJ0bGzv04rh18bvsuDjoydncZzFB3DbrEg9LygGE8ORCwFJdxoOnu++LxWw1uid4wFoecFpVBcA4WBRpn0+BCz/cUcj13fHWNB6LlDIJnrXCmN9Wio7HIeZ5KEXscOsSD0vMHGm+2vD0bj1W+JoCGcJ1GFF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