@deque/axe-auth 1.1.0-next.fea0aa8a → 1.1.0-rc.047d31b4

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.
@@ -2,8 +2,11 @@ import { type KeyringEntryFactory } from "./keyringBinding";
2
2
  import type { TokenSet } from "./tokenResponse";
3
3
  /**
4
4
  * Whether `KeyringTokenStore` should split the stored blob across
5
- * multiple keychain entries on this platform. Windows-only because of
6
- * Credential Manager's 2560 UTF-16 character per-entry cap. Exported
5
+ * multiple keychain entries on this platform. Windows-only: Credential
6
+ * Manager has a 2560-byte per-entry cap that large OAuth tokens
7
+ * routinely exceed. macOS Keychain and Linux libsecret have no
8
+ * comparable limit, and on macOS each entry is independently lockable
9
+ * (chunking there would multiply per-entry ACL prompts). Exported
7
10
  * (parameterized for tests) so the chunking path can be exercised
8
11
  * deterministically.
9
12
  */
@@ -109,28 +112,13 @@ export type BlobChainResult = {
109
112
  */
110
113
  export declare function parseAndMigrateBlob(raw: string | null, expectedVersion?: number, migrators?: ReadonlyMap<number, (old: unknown) => unknown | null>): BlobChainResult;
111
114
  /**
112
- * Builds the user-facing keychain error message. Platform is a
113
- * parameter (defaulting to `process.platform`) so tests can drive each
114
- * branch without mocking the runtime; mirrors the pattern in
115
+ * Builds the user-facing keychain error message: the underlying
116
+ * cause's text plus a per-platform hint. Platform is a parameter
117
+ * (defaulting to `process.platform`) so tests can drive each branch
118
+ * without mocking the runtime; mirrors the pattern in
115
119
  * `platformKeyringHint`.
116
- *
117
- * The Windows-specific size-limit message is only used when the
118
- * underlying error matches the binding's "longer than the platform
119
- * limit" wording AND the runtime is win32 — that combination is the
120
- * only way the size cap actually manifests in practice. On other
121
- * platforms (or for any other binding error) we fall back to the
122
- * generic per-platform hint.
123
120
  */
124
121
  export declare function keyringErrorMessage(op: string, cause: unknown, platform?: NodeJS.Platform): string;
125
- /**
126
- * Detects the `@napi-rs/keyring` error string for "value too large".
127
- * In practice only Windows Credential Manager triggers this — its
128
- * stored values are capped at 2560 UTF-16 chars; macOS Keychain and
129
- * Linux libsecret have no comparable limit. Exported (but not
130
- * re-exported from the package index) so tests can exercise the
131
- * detector independently of the wrap path.
132
- */
133
- export declare function isKeyringSizeError(cause: unknown): boolean;
134
122
  /**
135
123
  * Returns a per-platform hint appended to keychain error messages so
136
124
  * users see actionable guidance for their OS instead of generic or
@@ -145,8 +133,8 @@ export declare function platformKeyringHint(platform?: NodeJS.Platform): string;
145
133
  * Secret Service). On macOS and Linux the blob lives in a single entry
146
134
  * keyed by the fixed `credentials` account name. On Windows the blob
147
135
  * is split across `credentials.0`, `credentials.1`, … entries to fit
148
- * under Credential Manager's 2560 UTF-16 character per-entry cap; see
149
- * `shouldChunkForKeyring`.
136
+ * under Credential Manager's 2560-byte (1280 UTF-16 char) per-entry
137
+ * cap; see `shouldChunkForKeyring`.
150
138
  *
151
139
  * The blob carries its own issuer/client coordinates so verbs can
152
140
  * recover full config without per-issuer keying.
@@ -4,34 +4,41 @@ exports.KeyringTokenStore = exports.STORED_BLOB_VERSION = void 0;
4
4
  exports.shouldChunkForKeyring = shouldChunkForKeyring;
5
5
  exports.parseAndMigrateBlob = parseAndMigrateBlob;
6
6
  exports.keyringErrorMessage = keyringErrorMessage;
7
- exports.isKeyringSizeError = isKeyringSizeError;
8
7
  exports.platformKeyringHint = platformKeyringHint;
9
8
  exports.chunkBlobForKeyring = chunkBlobForKeyring;
10
9
  const errors_1 = require("./errors");
11
10
  const keyringBinding_1 = require("./keyringBinding");
12
11
  const SERVICE_NAME = "axe-auth";
13
- // On Windows the blob is base64-encoded and split across
14
- // `credentials.0`, `credentials.1`, entries (see `CHUNK_LIMIT`); a
15
- // Windows dev inspecting Credential Manager will see opaque base64.
12
+ /**
13
+ * Keychain account identifier. On macOS/Linux the entire blob lives at
14
+ * this single account. On Windows the blob is base64-encoded and split
15
+ * across `credentials.0`, `credentials.1`, … entries (see `CHUNK_LIMIT`),
16
+ * so a Windows dev inspecting Credential Manager will see opaque base64.
17
+ */
16
18
  const ACCOUNT_NAME = "credentials";
17
- // Windows Credential Manager caps stored values at 2560 UTF-16 code
18
- // units, which large OAuth access-token JWTs (many groups/roles
19
- // claims) routinely exceed. On Windows we work around this by
20
- // splitting the JSON blob across multiple entries with account names
21
- // `credentials.0`, `credentials.1`, . `CHUNK_LIMIT` leaves margin
22
- // under the platform cap; `MAX_CHUNKS` is a safety bound — we should
23
- // never get close in practice, even with maximally-claimed tokens.
24
- //
25
- // macOS Keychain and Linux libsecret have no comparable limit, so
26
- // chunking there would just multiply per-entry ACL prompts (each
27
- // keychain entry is independently lockable on macOS) for no gain.
28
- // Chunking is therefore Windows-only, gated by `shouldChunkForKeyring`.
29
- const CHUNK_LIMIT = 2500;
19
+ /**
20
+ * Max JS string length per chunk. The limit applies to the full chunk
21
+ * including chunk 0's `<N>\n` count header, so chunk 0's data slice is
22
+ * `CHUNK_LIMIT - headerLen`. Windows Credential Manager's per-entry
23
+ * cap is `CRED_MAX_CREDENTIAL_BLOB_SIZE = 2560` bytes, and the
24
+ * `@napi-rs/keyring` Windows backend stores strings as UTF-16 (2 bytes
25
+ * per char), so 1250 chars = 2500 bytes stays safely under the cap.
26
+ */
27
+ const CHUNK_LIMIT = 1250;
28
+ /**
29
+ * Cap on chunks per stored blob. A request that would exceed this
30
+ * raises `TOKEN_TOO_LARGE` so an IDP issuing tokens with extraordinary
31
+ * claim counts fails with a clear error instead of silently consuming
32
+ * dozens of keychain entries.
33
+ */
30
34
  const MAX_CHUNKS = 32;
31
35
  /**
32
36
  * Whether `KeyringTokenStore` should split the stored blob across
33
- * multiple keychain entries on this platform. Windows-only because of
34
- * Credential Manager's 2560 UTF-16 character per-entry cap. Exported
37
+ * multiple keychain entries on this platform. Windows-only: Credential
38
+ * Manager has a 2560-byte per-entry cap that large OAuth tokens
39
+ * routinely exceed. macOS Keychain and Linux libsecret have no
40
+ * comparable limit, and on macOS each entry is independently lockable
41
+ * (chunking there would multiply per-entry ACL prompts). Exported
35
42
  * (parameterized for tests) so the chunking path can be exercised
36
43
  * deterministically.
37
44
  */
@@ -180,38 +187,16 @@ function wrapKeyringError(op, cause) {
180
187
  });
181
188
  }
182
189
  /**
183
- * Builds the user-facing keychain error message. Platform is a
184
- * parameter (defaulting to `process.platform`) so tests can drive each
185
- * branch without mocking the runtime; mirrors the pattern in
190
+ * Builds the user-facing keychain error message: the underlying
191
+ * cause's text plus a per-platform hint. Platform is a parameter
192
+ * (defaulting to `process.platform`) so tests can drive each branch
193
+ * without mocking the runtime; mirrors the pattern in
186
194
  * `platformKeyringHint`.
187
- *
188
- * The Windows-specific size-limit message is only used when the
189
- * underlying error matches the binding's "longer than the platform
190
- * limit" wording AND the runtime is win32 — that combination is the
191
- * only way the size cap actually manifests in practice. On other
192
- * platforms (or for any other binding error) we fall back to the
193
- * generic per-platform hint.
194
195
  */
195
196
  function keyringErrorMessage(op, cause, platform = process.platform) {
196
- if (platform === "win32" && isKeyringSizeError(cause)) {
197
- return `System keychain ${op} failed: Windows Credential Manager limits stored values to 2560 UTF-16 characters. Large OAuth access-token JWTs (many groups/roles claims) commonly exceed this.`;
198
- }
199
197
  const causeMessage = cause instanceof Error ? cause.message : String(cause);
200
198
  return `System keychain ${op} failed: ${causeMessage}. ${platformKeyringHint(platform)}`;
201
199
  }
202
- /**
203
- * Detects the `@napi-rs/keyring` error string for "value too large".
204
- * In practice only Windows Credential Manager triggers this — its
205
- * stored values are capped at 2560 UTF-16 chars; macOS Keychain and
206
- * Linux libsecret have no comparable limit. Exported (but not
207
- * re-exported from the package index) so tests can exercise the
208
- * detector independently of the wrap path.
209
- */
210
- function isKeyringSizeError(cause) {
211
- if (!(cause instanceof Error))
212
- return false;
213
- return /longer than the platform limit/.test(cause.message);
214
- }
215
200
  /**
216
201
  * Returns a per-platform hint appended to keychain error messages so
217
202
  * users see actionable guidance for their OS instead of generic or
@@ -259,8 +244,8 @@ function parseChunkHeader(first) {
259
244
  * Secret Service). On macOS and Linux the blob lives in a single entry
260
245
  * keyed by the fixed `credentials` account name. On Windows the blob
261
246
  * is split across `credentials.0`, `credentials.1`, … entries to fit
262
- * under Credential Manager's 2560 UTF-16 character per-entry cap; see
263
- * `shouldChunkForKeyring`.
247
+ * under Credential Manager's 2560-byte (1280 UTF-16 char) per-entry
248
+ * cap; see `shouldChunkForKeyring`.
264
249
  *
265
250
  * The blob carries its own issuer/client coordinates so verbs can
266
251
  * recover full config without per-issuer keying.
package/package.json CHANGED
@@ -1,8 +1,15 @@
1
1
  {
2
2
  "name": "@deque/axe-auth",
3
- "version": "1.1.0-next.fea0aa8a",
3
+ "version": "1.1.0-rc.047d31b4",
4
4
  "description": "CLI authentication utility for Deque services",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/dequelabs/axe-mcp-server-public.git"
9
+ },
10
+ "bugs": {
11
+ "url": "https://github.com/dequelabs/axe-mcp-server-public/issues"
12
+ },
6
13
  "type": "commonjs",
7
14
  "main": "dist/index.js",
8
15
  "types": "dist/index.d.ts",
@@ -38,6 +45,7 @@
38
45
  },
39
46
  "scripts": {
40
47
  "build": "tsc",
48
+ "typecheck:scripts": "tsc -p tsconfig.scripts.json",
41
49
  "test": "tsx --test \"src/**/*.test.ts\"",
42
50
  "coverage": "c8 pnpm test",
43
51
  "register-dev-client": "tsx scripts/registerDevClient.ts",