@deque/axe-auth 1.1.0-next.9bc60204 → 1.1.0-next.cc7aaec1
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.
|
@@ -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
|