@metamask-previews/hw-wallet-sdk 0.9.0-e51c895 → 0.10.0-1fa477f
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/CHANGELOG.md +13 -1
- package/dist/dmk-error-mappings.cjs +136 -0
- package/dist/dmk-error-mappings.cjs.map +1 -0
- package/dist/dmk-error-mappings.d.cts +60 -0
- package/dist/dmk-error-mappings.d.cts.map +1 -0
- package/dist/dmk-error-mappings.d.mts +60 -0
- package/dist/dmk-error-mappings.d.mts.map +1 -0
- package/dist/dmk-error-mappings.mjs +132 -0
- package/dist/dmk-error-mappings.mjs.map +1 -0
- package/dist/hardware-error-mappings.cjs +17 -1
- package/dist/hardware-error-mappings.cjs.map +1 -1
- package/dist/hardware-error-mappings.d.cts +8 -0
- package/dist/hardware-error-mappings.d.cts.map +1 -1
- package/dist/hardware-error-mappings.d.mts +8 -0
- package/dist/hardware-error-mappings.d.mts.map +1 -1
- package/dist/hardware-error-mappings.mjs +16 -0
- package/dist/hardware-error-mappings.mjs.map +1 -1
- package/dist/index.cjs +1 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +1 -0
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- Add `DMK_ERROR_TAG_MAPPINGS`, `DMK_MESSAGE_PATTERNS`, and `getDMKErrorFromTag` for parsing Ledger Device Management Kit (DMK) errors by their non-standard `_tag` property ([#597](https://github.com/MetaMask/accounts/pull/597))
|
|
13
|
+
- Add `DMK_ERROR_MAPPINGS` providing full `ErrorMapping` details (severity, category, userMessage) for each DMK `_tag`
|
|
14
|
+
|
|
15
|
+
## [0.10.0]
|
|
16
|
+
|
|
17
|
+
### Added
|
|
18
|
+
|
|
19
|
+
- Add `KEYRING_ERROR_MAPPINGS` with `DeviceStateOnlyV4Supported` for keyring-level typed data version validation ([#575](https://github.com/MetaMask/accounts/pull/575))
|
|
20
|
+
|
|
10
21
|
### Fixed
|
|
11
22
|
|
|
12
23
|
- Add shared user-rejection detection helpers so hardware wallet libraries can classify cancellation-like errors consistently ([#576](https://github.com/MetaMask/accounts/pull/576))
|
|
@@ -70,7 +81,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
70
81
|
- Add hardware related error mappings and custom hardware error ([#421](https://github.com/MetaMask/accounts/pull/421))
|
|
71
82
|
- Add BLE and mobile error mappings with new error codes for Bluetooth permissions, connection states, and mobile support ([#433](https://github.com/MetaMask/accounts/pull/433))
|
|
72
83
|
|
|
73
|
-
[Unreleased]: https://github.com/MetaMask/accounts/compare/@metamask/hw-wallet-sdk@0.
|
|
84
|
+
[Unreleased]: https://github.com/MetaMask/accounts/compare/@metamask/hw-wallet-sdk@0.10.0...HEAD
|
|
85
|
+
[0.10.0]: https://github.com/MetaMask/accounts/compare/@metamask/hw-wallet-sdk@0.8.0...@metamask/hw-wallet-sdk@0.10.0
|
|
74
86
|
[0.8.0]: https://github.com/MetaMask/accounts/compare/@metamask/hw-wallet-sdk@0.7.0...@metamask/hw-wallet-sdk@0.8.0
|
|
75
87
|
[0.7.0]: https://github.com/MetaMask/accounts/compare/@metamask/hw-wallet-sdk@0.6.0...@metamask/hw-wallet-sdk@0.7.0
|
|
76
88
|
[0.6.0]: https://github.com/MetaMask/accounts/compare/@metamask/hw-wallet-sdk@0.5.0...@metamask/hw-wallet-sdk@0.6.0
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getDMKErrorFromTag = exports.DMK_MESSAGE_PATTERNS = exports.DMK_ERROR_TAG_MAPPINGS = exports.DMK_ERROR_MAPPINGS = void 0;
|
|
4
|
+
const hardware_errors_enums_1 = require("./hardware-errors-enums.cjs");
|
|
5
|
+
/**
|
|
6
|
+
* Full DMK (Device Management Kit) `_tag`-based error mappings.
|
|
7
|
+
*
|
|
8
|
+
* DMK is Ledger's newer SDK. Unlike legacy `@ledgerhq/errors`, which identify
|
|
9
|
+
* errors via the standard `error.name` property, DMK errors carry a
|
|
10
|
+
* non-standard `_tag` string (e.g. `'DeviceSessionNotFound'`,
|
|
11
|
+
* `'DeviceLockedError'`). Tag values are looked up in this mapping to resolve
|
|
12
|
+
* the full {@link ErrorMapping} (code, message, severity, category,
|
|
13
|
+
* userMessage).
|
|
14
|
+
*
|
|
15
|
+
* This is the single source of truth for DMK tag → error details. The
|
|
16
|
+
* code-only {@link DMK_ERROR_TAG_MAPPINGS} is derived from this object so
|
|
17
|
+
* consumers that only need the `ErrorCode` (e.g. MetaMask Mobile) can use the
|
|
18
|
+
* simpler mapping without duplicating data.
|
|
19
|
+
*
|
|
20
|
+
* These mappings are shared with legacy error names in consumers (e.g.
|
|
21
|
+
* MetaMask Mobile) since both map to the same `ErrorCode` values.
|
|
22
|
+
*/
|
|
23
|
+
exports.DMK_ERROR_MAPPINGS = {
|
|
24
|
+
DeviceSessionNotFound: {
|
|
25
|
+
code: hardware_errors_enums_1.ErrorCode.DeviceDisconnected,
|
|
26
|
+
message: 'DMK device session not found',
|
|
27
|
+
severity: hardware_errors_enums_1.Severity.Err,
|
|
28
|
+
category: hardware_errors_enums_1.Category.Connection,
|
|
29
|
+
userMessage: 'Your Ledger device was disconnected. Please reconnect and try again.',
|
|
30
|
+
},
|
|
31
|
+
ConnectionOpeningError: {
|
|
32
|
+
code: hardware_errors_enums_1.ErrorCode.BluetoothConnectionFailed,
|
|
33
|
+
message: 'DMK connection failed to open',
|
|
34
|
+
severity: hardware_errors_enums_1.Severity.Err,
|
|
35
|
+
category: hardware_errors_enums_1.Category.Connection,
|
|
36
|
+
userMessage: 'Failed to connect to your Ledger device. Please make sure it is nearby and try again.',
|
|
37
|
+
},
|
|
38
|
+
DeviceDisconnectedWhileSendingError: {
|
|
39
|
+
code: hardware_errors_enums_1.ErrorCode.DeviceDisconnected,
|
|
40
|
+
message: 'DMK device disconnected while sending',
|
|
41
|
+
severity: hardware_errors_enums_1.Severity.Err,
|
|
42
|
+
category: hardware_errors_enums_1.Category.Connection,
|
|
43
|
+
userMessage: 'Your Ledger device was disconnected. Please reconnect and try again.',
|
|
44
|
+
},
|
|
45
|
+
DeviceDisconnectedBeforeSendingApdu: {
|
|
46
|
+
code: hardware_errors_enums_1.ErrorCode.DeviceDisconnected,
|
|
47
|
+
message: 'DMK device disconnected before sending',
|
|
48
|
+
severity: hardware_errors_enums_1.Severity.Err,
|
|
49
|
+
category: hardware_errors_enums_1.Category.Connection,
|
|
50
|
+
userMessage: 'Your Ledger device was disconnected. Please reconnect and try again.',
|
|
51
|
+
},
|
|
52
|
+
DeviceLockedError: {
|
|
53
|
+
code: hardware_errors_enums_1.ErrorCode.AuthenticationDeviceLocked,
|
|
54
|
+
message: 'DMK device locked',
|
|
55
|
+
severity: hardware_errors_enums_1.Severity.Err,
|
|
56
|
+
category: hardware_errors_enums_1.Category.Authentication,
|
|
57
|
+
userMessage: 'Please unlock your Ledger device to continue.',
|
|
58
|
+
},
|
|
59
|
+
DeviceNotConnectedError: {
|
|
60
|
+
code: hardware_errors_enums_1.ErrorCode.DeviceDisconnected,
|
|
61
|
+
message: 'DMK device not connected',
|
|
62
|
+
severity: hardware_errors_enums_1.Severity.Err,
|
|
63
|
+
category: hardware_errors_enums_1.Category.Connection,
|
|
64
|
+
userMessage: 'Your Ledger device is not connected. Please connect and try again.',
|
|
65
|
+
},
|
|
66
|
+
SessionRefresherError: {
|
|
67
|
+
code: hardware_errors_enums_1.ErrorCode.DeviceDisconnected,
|
|
68
|
+
message: 'DMK session refresh failed',
|
|
69
|
+
severity: hardware_errors_enums_1.Severity.Err,
|
|
70
|
+
category: hardware_errors_enums_1.Category.Connection,
|
|
71
|
+
userMessage: 'Your Ledger device session has expired. Please reconnect and try again.',
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* DMK `_tag`-to-`ErrorCode` mappings.
|
|
76
|
+
*
|
|
77
|
+
* Derived from {@link DMK_ERROR_MAPPINGS} so there is a single source of truth
|
|
78
|
+
* for tag → code resolution. Consumers that only need the numeric `ErrorCode`
|
|
79
|
+
* (e.g. MetaMask Mobile) can use this lightweight mapping directly.
|
|
80
|
+
*/
|
|
81
|
+
exports.DMK_ERROR_TAG_MAPPINGS = Object.fromEntries(Object.entries(exports.DMK_ERROR_MAPPINGS).map(([tag, { code }]) => [tag, code]));
|
|
82
|
+
/**
|
|
83
|
+
* DMK-specific message patterns for error parsing.
|
|
84
|
+
*
|
|
85
|
+
* Each entry maps one or more case-insensitive message substrings to an
|
|
86
|
+
* `ErrorCode`. Used as a fallback when neither `error.name` nor `_tag` is
|
|
87
|
+
* recognised, but the error message contains DMK-specific phrasing.
|
|
88
|
+
*/
|
|
89
|
+
exports.DMK_MESSAGE_PATTERNS = [
|
|
90
|
+
{
|
|
91
|
+
patterns: [
|
|
92
|
+
'session not found',
|
|
93
|
+
'sessionid is not initialized',
|
|
94
|
+
'invalid session',
|
|
95
|
+
],
|
|
96
|
+
code: hardware_errors_enums_1.ErrorCode.DeviceDisconnected,
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
patterns: ['device action ended without completion'],
|
|
100
|
+
code: hardware_errors_enums_1.ErrorCode.DeviceUnresponsive,
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
patterns: ['ledger command failed'],
|
|
104
|
+
code: hardware_errors_enums_1.ErrorCode.DeviceNotReady,
|
|
105
|
+
},
|
|
106
|
+
];
|
|
107
|
+
/**
|
|
108
|
+
* Parse a DMK (Device Management Kit) error by its `_tag` property.
|
|
109
|
+
*
|
|
110
|
+
* DMK errors carry a non-standard `_tag` string. This function extracts the
|
|
111
|
+
* tag and looks it up in {@link DMK_ERROR_TAG_MAPPINGS} to resolve the
|
|
112
|
+
* corresponding `ErrorCode`.
|
|
113
|
+
*
|
|
114
|
+
* @param error - The error object to parse.
|
|
115
|
+
* @returns The resolved `ErrorCode` and the original tag string, or `null`
|
|
116
|
+
* if no `_tag` is present or the tag is not recognised.
|
|
117
|
+
*/
|
|
118
|
+
function getDMKErrorFromTag(error) {
|
|
119
|
+
if (error === null || typeof error !== 'object') {
|
|
120
|
+
return null;
|
|
121
|
+
}
|
|
122
|
+
const errorObj = error;
|
|
123
|
+
const tag = '_tag' in errorObj && typeof errorObj._tag === 'string'
|
|
124
|
+
? errorObj._tag
|
|
125
|
+
: null;
|
|
126
|
+
if (!tag) {
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
129
|
+
const code = exports.DMK_ERROR_TAG_MAPPINGS[tag];
|
|
130
|
+
if (code === undefined) {
|
|
131
|
+
return null;
|
|
132
|
+
}
|
|
133
|
+
return { code, tag };
|
|
134
|
+
}
|
|
135
|
+
exports.getDMKErrorFromTag = getDMKErrorFromTag;
|
|
136
|
+
//# sourceMappingURL=dmk-error-mappings.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dmk-error-mappings.cjs","sourceRoot":"","sources":["../src/dmk-error-mappings.ts"],"names":[],"mappings":";;;AACA,uEAAwE;AAExE;;;;;;;;;;;;;;;;;GAiBG;AACU,QAAA,kBAAkB,GAAiC;IAC9D,qBAAqB,EAAE;QACrB,IAAI,EAAE,iCAAS,CAAC,kBAAkB;QAClC,OAAO,EAAE,8BAA8B;QACvC,QAAQ,EAAE,gCAAQ,CAAC,GAAG;QACtB,QAAQ,EAAE,gCAAQ,CAAC,UAAU;QAC7B,WAAW,EACT,sEAAsE;KACzE;IACD,sBAAsB,EAAE;QACtB,IAAI,EAAE,iCAAS,CAAC,yBAAyB;QACzC,OAAO,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AC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CACzE,CAAC;AAEJ;;;;;;GAMG;AACU,QAAA,oBAAoB,GAG3B;IACJ;QACE,QAAQ,EAAE;YACR,mBAAmB;YACnB,8BAA8B;YAC9B,iBAAiB;SAClB;QACD,IAAI,EAAE,iCAAS,CAAC,kBAAkB;KACnC;IACD;QACE,QAAQ,EAAE,CAAC,wCAAwC,CAAC;QACpD,IAAI,EAAE,iCAAS,CAAC,kBAAkB;KACnC;IACD;QACE,QAAQ,EAAE,CAAC,uBAAuB,CAAC;QACnC,IAAI,EAAE,iCAAS,CAAC,cAAc;KAC/B;CACF,CAAC;AAUF;;;;;;;;;;GAUG;AACH,SAAgB,kBAAkB,CAAC,KAAc;IAC/C,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAChD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,QAAQ,GAAG,KAAgC,CAAC;IAClD,MAAM,GAAG,GACP,MAAM,IAAI,QAAQ,IAAI,OAAO,QAAQ,CAAC,IAAI,KAAK,QAAQ;QACrD,CAAC,CAAC,QAAQ,CAAC,IAAI;QACf,CAAC,CAAC,IAAI,CAAC;IAEX,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,IAAI,GAAG,8BAAsB,CAAC,GAAG,CAAC,CAAC;IACzC,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC;AACvB,CAAC;AArBD,gDAqBC","sourcesContent":["import type { ErrorMapping } from './hardware-error-mappings';\nimport { Category, ErrorCode, Severity } from './hardware-errors-enums';\n\n/**\n * Full DMK (Device Management Kit) `_tag`-based error mappings.\n *\n * DMK is Ledger's newer SDK. Unlike legacy `@ledgerhq/errors`, which identify\n * errors via the standard `error.name` property, DMK errors carry a\n * non-standard `_tag` string (e.g. `'DeviceSessionNotFound'`,\n * `'DeviceLockedError'`). Tag values are looked up in this mapping to resolve\n * the full {@link ErrorMapping} (code, message, severity, category,\n * userMessage).\n *\n * This is the single source of truth for DMK tag → error details. The\n * code-only {@link DMK_ERROR_TAG_MAPPINGS} is derived from this object so\n * consumers that only need the `ErrorCode` (e.g. MetaMask Mobile) can use the\n * simpler mapping without duplicating data.\n *\n * These mappings are shared with legacy error names in consumers (e.g.\n * MetaMask Mobile) since both map to the same `ErrorCode` values.\n */\nexport const DMK_ERROR_MAPPINGS: Record<string, ErrorMapping> = {\n DeviceSessionNotFound: {\n code: ErrorCode.DeviceDisconnected,\n message: 'DMK device session not found',\n severity: Severity.Err,\n category: Category.Connection,\n userMessage:\n 'Your Ledger device was disconnected. Please reconnect and try again.',\n },\n ConnectionOpeningError: {\n code: ErrorCode.BluetoothConnectionFailed,\n message: 'DMK connection failed to open',\n severity: Severity.Err,\n category: Category.Connection,\n userMessage:\n 'Failed to connect to your Ledger device. Please make sure it is nearby and try again.',\n },\n DeviceDisconnectedWhileSendingError: {\n code: ErrorCode.DeviceDisconnected,\n message: 'DMK device disconnected while sending',\n severity: Severity.Err,\n category: Category.Connection,\n userMessage:\n 'Your Ledger device was disconnected. Please reconnect and try again.',\n },\n DeviceDisconnectedBeforeSendingApdu: {\n code: ErrorCode.DeviceDisconnected,\n message: 'DMK device disconnected before sending',\n severity: Severity.Err,\n category: Category.Connection,\n userMessage:\n 'Your Ledger device was disconnected. Please reconnect and try again.',\n },\n DeviceLockedError: {\n code: ErrorCode.AuthenticationDeviceLocked,\n message: 'DMK device locked',\n severity: Severity.Err,\n category: Category.Authentication,\n userMessage: 'Please unlock your Ledger device to continue.',\n },\n DeviceNotConnectedError: {\n code: ErrorCode.DeviceDisconnected,\n message: 'DMK device not connected',\n severity: Severity.Err,\n category: Category.Connection,\n userMessage:\n 'Your Ledger device is not connected. Please connect and try again.',\n },\n SessionRefresherError: {\n code: ErrorCode.DeviceDisconnected,\n message: 'DMK session refresh failed',\n severity: Severity.Err,\n category: Category.Connection,\n userMessage:\n 'Your Ledger device session has expired. Please reconnect and try again.',\n },\n};\n\n/**\n * DMK `_tag`-to-`ErrorCode` mappings.\n *\n * Derived from {@link DMK_ERROR_MAPPINGS} so there is a single source of truth\n * for tag → code resolution. Consumers that only need the numeric `ErrorCode`\n * (e.g. MetaMask Mobile) can use this lightweight mapping directly.\n */\nexport const DMK_ERROR_TAG_MAPPINGS: Record<string, ErrorCode> =\n Object.fromEntries(\n Object.entries(DMK_ERROR_MAPPINGS).map(([tag, { code }]) => [tag, code]),\n );\n\n/**\n * DMK-specific message patterns for error parsing.\n *\n * Each entry maps one or more case-insensitive message substrings to an\n * `ErrorCode`. Used as a fallback when neither `error.name` nor `_tag` is\n * recognised, but the error message contains DMK-specific phrasing.\n */\nexport const DMK_MESSAGE_PATTERNS: readonly {\n patterns: string[];\n code: ErrorCode;\n}[] = [\n {\n patterns: [\n 'session not found',\n 'sessionid is not initialized',\n 'invalid session',\n ],\n code: ErrorCode.DeviceDisconnected,\n },\n {\n patterns: ['device action ended without completion'],\n code: ErrorCode.DeviceUnresponsive,\n },\n {\n patterns: ['ledger command failed'],\n code: ErrorCode.DeviceNotReady,\n },\n];\n\n/**\n * Result of resolving a DMK error from its `_tag` property.\n */\nexport type DMKTagResolution = {\n code: ErrorCode;\n tag: string;\n};\n\n/**\n * Parse a DMK (Device Management Kit) error by its `_tag` property.\n *\n * DMK errors carry a non-standard `_tag` string. This function extracts the\n * tag and looks it up in {@link DMK_ERROR_TAG_MAPPINGS} to resolve the\n * corresponding `ErrorCode`.\n *\n * @param error - The error object to parse.\n * @returns The resolved `ErrorCode` and the original tag string, or `null`\n * if no `_tag` is present or the tag is not recognised.\n */\nexport function getDMKErrorFromTag(error: unknown): DMKTagResolution | null {\n if (error === null || typeof error !== 'object') {\n return null;\n }\n\n const errorObj = error as Record<string, unknown>;\n const tag =\n '_tag' in errorObj && typeof errorObj._tag === 'string'\n ? errorObj._tag\n : null;\n\n if (!tag) {\n return null;\n }\n\n const code = DMK_ERROR_TAG_MAPPINGS[tag];\n if (code === undefined) {\n return null;\n }\n\n return { code, tag };\n}\n"]}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { ErrorMapping } from "./hardware-error-mappings.cjs";
|
|
2
|
+
import { ErrorCode } from "./hardware-errors-enums.cjs";
|
|
3
|
+
/**
|
|
4
|
+
* Full DMK (Device Management Kit) `_tag`-based error mappings.
|
|
5
|
+
*
|
|
6
|
+
* DMK is Ledger's newer SDK. Unlike legacy `@ledgerhq/errors`, which identify
|
|
7
|
+
* errors via the standard `error.name` property, DMK errors carry a
|
|
8
|
+
* non-standard `_tag` string (e.g. `'DeviceSessionNotFound'`,
|
|
9
|
+
* `'DeviceLockedError'`). Tag values are looked up in this mapping to resolve
|
|
10
|
+
* the full {@link ErrorMapping} (code, message, severity, category,
|
|
11
|
+
* userMessage).
|
|
12
|
+
*
|
|
13
|
+
* This is the single source of truth for DMK tag → error details. The
|
|
14
|
+
* code-only {@link DMK_ERROR_TAG_MAPPINGS} is derived from this object so
|
|
15
|
+
* consumers that only need the `ErrorCode` (e.g. MetaMask Mobile) can use the
|
|
16
|
+
* simpler mapping without duplicating data.
|
|
17
|
+
*
|
|
18
|
+
* These mappings are shared with legacy error names in consumers (e.g.
|
|
19
|
+
* MetaMask Mobile) since both map to the same `ErrorCode` values.
|
|
20
|
+
*/
|
|
21
|
+
export declare const DMK_ERROR_MAPPINGS: Record<string, ErrorMapping>;
|
|
22
|
+
/**
|
|
23
|
+
* DMK `_tag`-to-`ErrorCode` mappings.
|
|
24
|
+
*
|
|
25
|
+
* Derived from {@link DMK_ERROR_MAPPINGS} so there is a single source of truth
|
|
26
|
+
* for tag → code resolution. Consumers that only need the numeric `ErrorCode`
|
|
27
|
+
* (e.g. MetaMask Mobile) can use this lightweight mapping directly.
|
|
28
|
+
*/
|
|
29
|
+
export declare const DMK_ERROR_TAG_MAPPINGS: Record<string, ErrorCode>;
|
|
30
|
+
/**
|
|
31
|
+
* DMK-specific message patterns for error parsing.
|
|
32
|
+
*
|
|
33
|
+
* Each entry maps one or more case-insensitive message substrings to an
|
|
34
|
+
* `ErrorCode`. Used as a fallback when neither `error.name` nor `_tag` is
|
|
35
|
+
* recognised, but the error message contains DMK-specific phrasing.
|
|
36
|
+
*/
|
|
37
|
+
export declare const DMK_MESSAGE_PATTERNS: readonly {
|
|
38
|
+
patterns: string[];
|
|
39
|
+
code: ErrorCode;
|
|
40
|
+
}[];
|
|
41
|
+
/**
|
|
42
|
+
* Result of resolving a DMK error from its `_tag` property.
|
|
43
|
+
*/
|
|
44
|
+
export type DMKTagResolution = {
|
|
45
|
+
code: ErrorCode;
|
|
46
|
+
tag: string;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Parse a DMK (Device Management Kit) error by its `_tag` property.
|
|
50
|
+
*
|
|
51
|
+
* DMK errors carry a non-standard `_tag` string. This function extracts the
|
|
52
|
+
* tag and looks it up in {@link DMK_ERROR_TAG_MAPPINGS} to resolve the
|
|
53
|
+
* corresponding `ErrorCode`.
|
|
54
|
+
*
|
|
55
|
+
* @param error - The error object to parse.
|
|
56
|
+
* @returns The resolved `ErrorCode` and the original tag string, or `null`
|
|
57
|
+
* if no `_tag` is present or the tag is not recognised.
|
|
58
|
+
*/
|
|
59
|
+
export declare function getDMKErrorFromTag(error: unknown): DMKTagResolution | null;
|
|
60
|
+
//# sourceMappingURL=dmk-error-mappings.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dmk-error-mappings.d.cts","sourceRoot":"","sources":["../src/dmk-error-mappings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,sCAAkC;AAC9D,OAAO,EAAY,SAAS,EAAY,oCAAgC;AAExE;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAwD3D,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAG1D,CAAC;AAEJ;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,EAAE,SAAS;IAC1C,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,IAAI,EAAE,SAAS,CAAC;CACjB,EAiBA,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,SAAS,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,GAAG,IAAI,CAqB1E"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { ErrorMapping } from "./hardware-error-mappings.mjs";
|
|
2
|
+
import { ErrorCode } from "./hardware-errors-enums.mjs";
|
|
3
|
+
/**
|
|
4
|
+
* Full DMK (Device Management Kit) `_tag`-based error mappings.
|
|
5
|
+
*
|
|
6
|
+
* DMK is Ledger's newer SDK. Unlike legacy `@ledgerhq/errors`, which identify
|
|
7
|
+
* errors via the standard `error.name` property, DMK errors carry a
|
|
8
|
+
* non-standard `_tag` string (e.g. `'DeviceSessionNotFound'`,
|
|
9
|
+
* `'DeviceLockedError'`). Tag values are looked up in this mapping to resolve
|
|
10
|
+
* the full {@link ErrorMapping} (code, message, severity, category,
|
|
11
|
+
* userMessage).
|
|
12
|
+
*
|
|
13
|
+
* This is the single source of truth for DMK tag → error details. The
|
|
14
|
+
* code-only {@link DMK_ERROR_TAG_MAPPINGS} is derived from this object so
|
|
15
|
+
* consumers that only need the `ErrorCode` (e.g. MetaMask Mobile) can use the
|
|
16
|
+
* simpler mapping without duplicating data.
|
|
17
|
+
*
|
|
18
|
+
* These mappings are shared with legacy error names in consumers (e.g.
|
|
19
|
+
* MetaMask Mobile) since both map to the same `ErrorCode` values.
|
|
20
|
+
*/
|
|
21
|
+
export declare const DMK_ERROR_MAPPINGS: Record<string, ErrorMapping>;
|
|
22
|
+
/**
|
|
23
|
+
* DMK `_tag`-to-`ErrorCode` mappings.
|
|
24
|
+
*
|
|
25
|
+
* Derived from {@link DMK_ERROR_MAPPINGS} so there is a single source of truth
|
|
26
|
+
* for tag → code resolution. Consumers that only need the numeric `ErrorCode`
|
|
27
|
+
* (e.g. MetaMask Mobile) can use this lightweight mapping directly.
|
|
28
|
+
*/
|
|
29
|
+
export declare const DMK_ERROR_TAG_MAPPINGS: Record<string, ErrorCode>;
|
|
30
|
+
/**
|
|
31
|
+
* DMK-specific message patterns for error parsing.
|
|
32
|
+
*
|
|
33
|
+
* Each entry maps one or more case-insensitive message substrings to an
|
|
34
|
+
* `ErrorCode`. Used as a fallback when neither `error.name` nor `_tag` is
|
|
35
|
+
* recognised, but the error message contains DMK-specific phrasing.
|
|
36
|
+
*/
|
|
37
|
+
export declare const DMK_MESSAGE_PATTERNS: readonly {
|
|
38
|
+
patterns: string[];
|
|
39
|
+
code: ErrorCode;
|
|
40
|
+
}[];
|
|
41
|
+
/**
|
|
42
|
+
* Result of resolving a DMK error from its `_tag` property.
|
|
43
|
+
*/
|
|
44
|
+
export type DMKTagResolution = {
|
|
45
|
+
code: ErrorCode;
|
|
46
|
+
tag: string;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Parse a DMK (Device Management Kit) error by its `_tag` property.
|
|
50
|
+
*
|
|
51
|
+
* DMK errors carry a non-standard `_tag` string. This function extracts the
|
|
52
|
+
* tag and looks it up in {@link DMK_ERROR_TAG_MAPPINGS} to resolve the
|
|
53
|
+
* corresponding `ErrorCode`.
|
|
54
|
+
*
|
|
55
|
+
* @param error - The error object to parse.
|
|
56
|
+
* @returns The resolved `ErrorCode` and the original tag string, or `null`
|
|
57
|
+
* if no `_tag` is present or the tag is not recognised.
|
|
58
|
+
*/
|
|
59
|
+
export declare function getDMKErrorFromTag(error: unknown): DMKTagResolution | null;
|
|
60
|
+
//# sourceMappingURL=dmk-error-mappings.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dmk-error-mappings.d.mts","sourceRoot":"","sources":["../src/dmk-error-mappings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,sCAAkC;AAC9D,OAAO,EAAY,SAAS,EAAY,oCAAgC;AAExE;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAwD3D,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAG1D,CAAC;AAEJ;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,EAAE,SAAS;IAC1C,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,IAAI,EAAE,SAAS,CAAC;CACjB,EAiBA,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,SAAS,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,GAAG,IAAI,CAqB1E"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { Category, ErrorCode, Severity } from "./hardware-errors-enums.mjs";
|
|
2
|
+
/**
|
|
3
|
+
* Full DMK (Device Management Kit) `_tag`-based error mappings.
|
|
4
|
+
*
|
|
5
|
+
* DMK is Ledger's newer SDK. Unlike legacy `@ledgerhq/errors`, which identify
|
|
6
|
+
* errors via the standard `error.name` property, DMK errors carry a
|
|
7
|
+
* non-standard `_tag` string (e.g. `'DeviceSessionNotFound'`,
|
|
8
|
+
* `'DeviceLockedError'`). Tag values are looked up in this mapping to resolve
|
|
9
|
+
* the full {@link ErrorMapping} (code, message, severity, category,
|
|
10
|
+
* userMessage).
|
|
11
|
+
*
|
|
12
|
+
* This is the single source of truth for DMK tag → error details. The
|
|
13
|
+
* code-only {@link DMK_ERROR_TAG_MAPPINGS} is derived from this object so
|
|
14
|
+
* consumers that only need the `ErrorCode` (e.g. MetaMask Mobile) can use the
|
|
15
|
+
* simpler mapping without duplicating data.
|
|
16
|
+
*
|
|
17
|
+
* These mappings are shared with legacy error names in consumers (e.g.
|
|
18
|
+
* MetaMask Mobile) since both map to the same `ErrorCode` values.
|
|
19
|
+
*/
|
|
20
|
+
export const DMK_ERROR_MAPPINGS = {
|
|
21
|
+
DeviceSessionNotFound: {
|
|
22
|
+
code: ErrorCode.DeviceDisconnected,
|
|
23
|
+
message: 'DMK device session not found',
|
|
24
|
+
severity: Severity.Err,
|
|
25
|
+
category: Category.Connection,
|
|
26
|
+
userMessage: 'Your Ledger device was disconnected. Please reconnect and try again.',
|
|
27
|
+
},
|
|
28
|
+
ConnectionOpeningError: {
|
|
29
|
+
code: ErrorCode.BluetoothConnectionFailed,
|
|
30
|
+
message: 'DMK connection failed to open',
|
|
31
|
+
severity: Severity.Err,
|
|
32
|
+
category: Category.Connection,
|
|
33
|
+
userMessage: 'Failed to connect to your Ledger device. Please make sure it is nearby and try again.',
|
|
34
|
+
},
|
|
35
|
+
DeviceDisconnectedWhileSendingError: {
|
|
36
|
+
code: ErrorCode.DeviceDisconnected,
|
|
37
|
+
message: 'DMK device disconnected while sending',
|
|
38
|
+
severity: Severity.Err,
|
|
39
|
+
category: Category.Connection,
|
|
40
|
+
userMessage: 'Your Ledger device was disconnected. Please reconnect and try again.',
|
|
41
|
+
},
|
|
42
|
+
DeviceDisconnectedBeforeSendingApdu: {
|
|
43
|
+
code: ErrorCode.DeviceDisconnected,
|
|
44
|
+
message: 'DMK device disconnected before sending',
|
|
45
|
+
severity: Severity.Err,
|
|
46
|
+
category: Category.Connection,
|
|
47
|
+
userMessage: 'Your Ledger device was disconnected. Please reconnect and try again.',
|
|
48
|
+
},
|
|
49
|
+
DeviceLockedError: {
|
|
50
|
+
code: ErrorCode.AuthenticationDeviceLocked,
|
|
51
|
+
message: 'DMK device locked',
|
|
52
|
+
severity: Severity.Err,
|
|
53
|
+
category: Category.Authentication,
|
|
54
|
+
userMessage: 'Please unlock your Ledger device to continue.',
|
|
55
|
+
},
|
|
56
|
+
DeviceNotConnectedError: {
|
|
57
|
+
code: ErrorCode.DeviceDisconnected,
|
|
58
|
+
message: 'DMK device not connected',
|
|
59
|
+
severity: Severity.Err,
|
|
60
|
+
category: Category.Connection,
|
|
61
|
+
userMessage: 'Your Ledger device is not connected. Please connect and try again.',
|
|
62
|
+
},
|
|
63
|
+
SessionRefresherError: {
|
|
64
|
+
code: ErrorCode.DeviceDisconnected,
|
|
65
|
+
message: 'DMK session refresh failed',
|
|
66
|
+
severity: Severity.Err,
|
|
67
|
+
category: Category.Connection,
|
|
68
|
+
userMessage: 'Your Ledger device session has expired. Please reconnect and try again.',
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* DMK `_tag`-to-`ErrorCode` mappings.
|
|
73
|
+
*
|
|
74
|
+
* Derived from {@link DMK_ERROR_MAPPINGS} so there is a single source of truth
|
|
75
|
+
* for tag → code resolution. Consumers that only need the numeric `ErrorCode`
|
|
76
|
+
* (e.g. MetaMask Mobile) can use this lightweight mapping directly.
|
|
77
|
+
*/
|
|
78
|
+
export const DMK_ERROR_TAG_MAPPINGS = Object.fromEntries(Object.entries(DMK_ERROR_MAPPINGS).map(([tag, { code }]) => [tag, code]));
|
|
79
|
+
/**
|
|
80
|
+
* DMK-specific message patterns for error parsing.
|
|
81
|
+
*
|
|
82
|
+
* Each entry maps one or more case-insensitive message substrings to an
|
|
83
|
+
* `ErrorCode`. Used as a fallback when neither `error.name` nor `_tag` is
|
|
84
|
+
* recognised, but the error message contains DMK-specific phrasing.
|
|
85
|
+
*/
|
|
86
|
+
export const DMK_MESSAGE_PATTERNS = [
|
|
87
|
+
{
|
|
88
|
+
patterns: [
|
|
89
|
+
'session not found',
|
|
90
|
+
'sessionid is not initialized',
|
|
91
|
+
'invalid session',
|
|
92
|
+
],
|
|
93
|
+
code: ErrorCode.DeviceDisconnected,
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
patterns: ['device action ended without completion'],
|
|
97
|
+
code: ErrorCode.DeviceUnresponsive,
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
patterns: ['ledger command failed'],
|
|
101
|
+
code: ErrorCode.DeviceNotReady,
|
|
102
|
+
},
|
|
103
|
+
];
|
|
104
|
+
/**
|
|
105
|
+
* Parse a DMK (Device Management Kit) error by its `_tag` property.
|
|
106
|
+
*
|
|
107
|
+
* DMK errors carry a non-standard `_tag` string. This function extracts the
|
|
108
|
+
* tag and looks it up in {@link DMK_ERROR_TAG_MAPPINGS} to resolve the
|
|
109
|
+
* corresponding `ErrorCode`.
|
|
110
|
+
*
|
|
111
|
+
* @param error - The error object to parse.
|
|
112
|
+
* @returns The resolved `ErrorCode` and the original tag string, or `null`
|
|
113
|
+
* if no `_tag` is present or the tag is not recognised.
|
|
114
|
+
*/
|
|
115
|
+
export function getDMKErrorFromTag(error) {
|
|
116
|
+
if (error === null || typeof error !== 'object') {
|
|
117
|
+
return null;
|
|
118
|
+
}
|
|
119
|
+
const errorObj = error;
|
|
120
|
+
const tag = '_tag' in errorObj && typeof errorObj._tag === 'string'
|
|
121
|
+
? errorObj._tag
|
|
122
|
+
: null;
|
|
123
|
+
if (!tag) {
|
|
124
|
+
return null;
|
|
125
|
+
}
|
|
126
|
+
const code = DMK_ERROR_TAG_MAPPINGS[tag];
|
|
127
|
+
if (code === undefined) {
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
return { code, tag };
|
|
131
|
+
}
|
|
132
|
+
//# sourceMappingURL=dmk-error-mappings.mjs.map
|
|
@@ -0,0 +1 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,IAAI,OAAO,QAAQ,CAAC,IAAI,KAAK,QAAQ;QACrD,CAAC,CAAC,QAAQ,CAAC,IAAI;QACf,CAAC,CAAC,IAAI,CAAC;IAEX,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,IAAI,GAAG,sBAAsB,CAAC,GAAG,CAAC,CAAC;IACzC,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC;AACvB,CAAC","sourcesContent":["import type { ErrorMapping } from './hardware-error-mappings';\nimport { Category, ErrorCode, Severity } from './hardware-errors-enums';\n\n/**\n * Full DMK (Device Management Kit) `_tag`-based error mappings.\n *\n * DMK is Ledger's newer SDK. Unlike legacy `@ledgerhq/errors`, which identify\n * errors via the standard `error.name` property, DMK errors carry a\n * non-standard `_tag` string (e.g. `'DeviceSessionNotFound'`,\n * `'DeviceLockedError'`). Tag values are looked up in this mapping to resolve\n * the full {@link ErrorMapping} (code, message, severity, category,\n * userMessage).\n *\n * This is the single source of truth for DMK tag → error details. The\n * code-only {@link DMK_ERROR_TAG_MAPPINGS} is derived from this object so\n * consumers that only need the `ErrorCode` (e.g. MetaMask Mobile) can use the\n * simpler mapping without duplicating data.\n *\n * These mappings are shared with legacy error names in consumers (e.g.\n * MetaMask Mobile) since both map to the same `ErrorCode` values.\n */\nexport const DMK_ERROR_MAPPINGS: Record<string, ErrorMapping> = {\n DeviceSessionNotFound: {\n code: ErrorCode.DeviceDisconnected,\n message: 'DMK device session not found',\n severity: Severity.Err,\n category: Category.Connection,\n userMessage:\n 'Your Ledger device was disconnected. Please reconnect and try again.',\n },\n ConnectionOpeningError: {\n code: ErrorCode.BluetoothConnectionFailed,\n message: 'DMK connection failed to open',\n severity: Severity.Err,\n category: Category.Connection,\n userMessage:\n 'Failed to connect to your Ledger device. Please make sure it is nearby and try again.',\n },\n DeviceDisconnectedWhileSendingError: {\n code: ErrorCode.DeviceDisconnected,\n message: 'DMK device disconnected while sending',\n severity: Severity.Err,\n category: Category.Connection,\n userMessage:\n 'Your Ledger device was disconnected. Please reconnect and try again.',\n },\n DeviceDisconnectedBeforeSendingApdu: {\n code: ErrorCode.DeviceDisconnected,\n message: 'DMK device disconnected before sending',\n severity: Severity.Err,\n category: Category.Connection,\n userMessage:\n 'Your Ledger device was disconnected. Please reconnect and try again.',\n },\n DeviceLockedError: {\n code: ErrorCode.AuthenticationDeviceLocked,\n message: 'DMK device locked',\n severity: Severity.Err,\n category: Category.Authentication,\n userMessage: 'Please unlock your Ledger device to continue.',\n },\n DeviceNotConnectedError: {\n code: ErrorCode.DeviceDisconnected,\n message: 'DMK device not connected',\n severity: Severity.Err,\n category: Category.Connection,\n userMessage:\n 'Your Ledger device is not connected. Please connect and try again.',\n },\n SessionRefresherError: {\n code: ErrorCode.DeviceDisconnected,\n message: 'DMK session refresh failed',\n severity: Severity.Err,\n category: Category.Connection,\n userMessage:\n 'Your Ledger device session has expired. Please reconnect and try again.',\n },\n};\n\n/**\n * DMK `_tag`-to-`ErrorCode` mappings.\n *\n * Derived from {@link DMK_ERROR_MAPPINGS} so there is a single source of truth\n * for tag → code resolution. Consumers that only need the numeric `ErrorCode`\n * (e.g. MetaMask Mobile) can use this lightweight mapping directly.\n */\nexport const DMK_ERROR_TAG_MAPPINGS: Record<string, ErrorCode> =\n Object.fromEntries(\n Object.entries(DMK_ERROR_MAPPINGS).map(([tag, { code }]) => [tag, code]),\n );\n\n/**\n * DMK-specific message patterns for error parsing.\n *\n * Each entry maps one or more case-insensitive message substrings to an\n * `ErrorCode`. Used as a fallback when neither `error.name` nor `_tag` is\n * recognised, but the error message contains DMK-specific phrasing.\n */\nexport const DMK_MESSAGE_PATTERNS: readonly {\n patterns: string[];\n code: ErrorCode;\n}[] = [\n {\n patterns: [\n 'session not found',\n 'sessionid is not initialized',\n 'invalid session',\n ],\n code: ErrorCode.DeviceDisconnected,\n },\n {\n patterns: ['device action ended without completion'],\n code: ErrorCode.DeviceUnresponsive,\n },\n {\n patterns: ['ledger command failed'],\n code: ErrorCode.DeviceNotReady,\n },\n];\n\n/**\n * Result of resolving a DMK error from its `_tag` property.\n */\nexport type DMKTagResolution = {\n code: ErrorCode;\n tag: string;\n};\n\n/**\n * Parse a DMK (Device Management Kit) error by its `_tag` property.\n *\n * DMK errors carry a non-standard `_tag` string. This function extracts the\n * tag and looks it up in {@link DMK_ERROR_TAG_MAPPINGS} to resolve the\n * corresponding `ErrorCode`.\n *\n * @param error - The error object to parse.\n * @returns The resolved `ErrorCode` and the original tag string, or `null`\n * if no `_tag` is present or the tag is not recognised.\n */\nexport function getDMKErrorFromTag(error: unknown): DMKTagResolution | null {\n if (error === null || typeof error !== 'object') {\n return null;\n }\n\n const errorObj = error as Record<string, unknown>;\n const tag =\n '_tag' in errorObj && typeof errorObj._tag === 'string'\n ? errorObj._tag\n : null;\n\n if (!tag) {\n return null;\n }\n\n const code = DMK_ERROR_TAG_MAPPINGS[tag];\n if (code === undefined) {\n return null;\n }\n\n return { code, tag };\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TREZOR_ERROR_MAPPINGS = exports.QR_WALLET_ERROR_MAPPINGS = exports.MOBILE_ERROR_MAPPINGS = exports.BLE_ERROR_MAPPINGS = exports.LEDGER_ERROR_MAPPINGS = void 0;
|
|
3
|
+
exports.KEYRING_ERROR_MAPPINGS = exports.TREZOR_ERROR_MAPPINGS = exports.QR_WALLET_ERROR_MAPPINGS = exports.MOBILE_ERROR_MAPPINGS = exports.BLE_ERROR_MAPPINGS = exports.LEDGER_ERROR_MAPPINGS = void 0;
|
|
4
4
|
const hardware_errors_enums_1 = require("./hardware-errors-enums.cjs");
|
|
5
5
|
exports.LEDGER_ERROR_MAPPINGS = {
|
|
6
6
|
'0x9000': {
|
|
@@ -416,4 +416,20 @@ exports.TREZOR_ERROR_MAPPINGS = {
|
|
|
416
416
|
userMessage: 'Your Trezor device failed to initialize. Please unlock it and try again.',
|
|
417
417
|
},
|
|
418
418
|
};
|
|
419
|
+
/**
|
|
420
|
+
* Keyring error mappings - static error data for keyring-level validation errors
|
|
421
|
+
* that are not tied to a Ledger transport status code.
|
|
422
|
+
*
|
|
423
|
+
* TODO: Wire DeviceStateOnlyV4Supported into keyring-eth-trezor and keyring-eth-qr
|
|
424
|
+
* so all hardware keyrings throw HardwareWalletError for unsupported typed data versions.
|
|
425
|
+
*/
|
|
426
|
+
exports.KEYRING_ERROR_MAPPINGS = {
|
|
427
|
+
[hardware_errors_enums_1.ErrorCode.DeviceStateOnlyV4Supported]: {
|
|
428
|
+
code: hardware_errors_enums_1.ErrorCode.DeviceStateOnlyV4Supported,
|
|
429
|
+
message: 'Only version 4 of typed data signing is supported',
|
|
430
|
+
severity: hardware_errors_enums_1.Severity.Err,
|
|
431
|
+
category: hardware_errors_enums_1.Category.DeviceState,
|
|
432
|
+
userMessage: 'This device can only sign version 4 (V4) typed data. This site requested an older signature type that is not supported.',
|
|
433
|
+
},
|
|
434
|
+
};
|
|
419
435
|
//# sourceMappingURL=hardware-error-mappings.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hardware-error-mappings.cjs","sourceRoot":"","sources":["../src/hardware-error-mappings.ts"],"names":[],"mappings":";;;AAAA,uEAAwE;AAU3D,QAAA,qBAAqB,GAAiC;IACjE,QAAQ,EAAE;QACR,IAAI,EAAE,iCAAS,CAAC,OAAO;QACvB,OAAO,EAAE,sBAAsB;QAC/B,QAAQ,EAAE,gCAAQ,CAAC,IAAI;QACvB,QAAQ,EAAE,gCAAQ,CAAC,OAAO;KAC3B;IACD,QAAQ,EAAE;QACR,IAAI,EAAE,iCAAS,CAAC,oBAAoB;QACpC,OAAO,EAAE,uBAAuB;QAChC,QAAQ,EAAE,gCAAQ,CAAC,GAAG;QACtB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T,0EAA0E;KAC7E;CACF,CAAC","sourcesContent":["import { ErrorCode, Severity, Category } from './hardware-errors-enums';\n\nexport type ErrorMapping = {\n code: ErrorCode;\n message: string;\n severity: Severity;\n category: Category;\n userMessage?: string;\n};\n\nexport const LEDGER_ERROR_MAPPINGS: Record<string, ErrorMapping> = {\n '0x9000': {\n code: ErrorCode.Success,\n message: 'Operation successful',\n severity: Severity.Info,\n category: Category.Success,\n },\n '0x6300': {\n code: ErrorCode.AuthenticationFailed,\n message: 'Authentication failed',\n severity: Severity.Err,\n category: Category.Authentication,\n userMessage: 'Authentication failed. Please verify your credentials.',\n },\n '0x63c0': {\n code: ErrorCode.AuthenticationPinAttemptsRemaining,\n message: 'PIN attempts remaining',\n severity: Severity.Warning,\n category: Category.Authentication,\n userMessage: 'Incorrect PIN. Please try again.',\n },\n '0x6982': {\n code: ErrorCode.AuthenticationSecurityCondition,\n message: 'Security conditions not satisfied',\n severity: Severity.Err,\n category: Category.Authentication,\n\n userMessage:\n 'Device is locked or access rights are insufficient. Please unlock your device.',\n },\n '0x6985': {\n code: ErrorCode.UserRejected,\n message: 'User rejected action on device',\n severity: Severity.Warning,\n category: Category.UserAction,\n\n userMessage:\n 'Transaction was rejected. Please approve on your device to continue.',\n },\n '0x9804': {\n code: ErrorCode.AuthenticationSecurityCondition,\n message: 'App update required',\n severity: Severity.Err,\n category: Category.Authentication,\n\n userMessage: 'Please update your Ledger app to continue.',\n },\n '0x9808': {\n code: ErrorCode.AuthenticationFailed,\n message: 'Contradiction in secret code status',\n severity: Severity.Err,\n category: Category.Authentication,\n },\n '0x9840': {\n code: ErrorCode.AuthenticationDeviceBlocked,\n message: 'Code blocked',\n severity: Severity.Critical,\n category: Category.Authentication,\n\n userMessage:\n 'Your device is blocked due to too many failed attempts. Please follow device recovery procedures.',\n },\n '0x650f': {\n code: ErrorCode.DeviceStateEthAppClosed,\n message: 'Ethereum app closed',\n severity: Severity.Err,\n category: Category.DeviceState,\n userMessage:\n 'Ethereum app is closed. Please open it on your Ledger device to continue.',\n },\n '0x5515': {\n code: ErrorCode.AuthenticationDeviceLocked,\n message: 'Device is locked',\n severity: Severity.Err,\n category: Category.Authentication,\n userMessage: 'Please unlock your Ledger device to continue.',\n },\n '0x5501': {\n code: ErrorCode.UserRejected,\n message: 'User refused on device',\n severity: Severity.Warning,\n category: Category.UserAction,\n userMessage:\n 'Operation was rejected. Please approve on your device to continue.',\n },\n '0x6a80': {\n code: ErrorCode.DeviceStateBlindSignNotSupported,\n message: 'Blind signing not supported',\n severity: Severity.Err,\n category: Category.DeviceState,\n userMessage: 'Blind signing is not supported on this device.',\n },\n '0x6a83': {\n code: ErrorCode.DeviceStateEthAppClosed,\n message: 'Ethereum app closed',\n severity: Severity.Err,\n category: Category.DeviceState,\n userMessage:\n 'Ethereum app is closed. Currently on solana. Please open it to continue.',\n },\n '0x6d00': {\n code: ErrorCode.DeviceStateEthAppClosed,\n message: 'Ethereum app closed',\n severity: Severity.Err,\n category: Category.DeviceState,\n userMessage:\n 'Ethereum app is closed. Currently on bitcoin. Please open it to continue.',\n },\n '0x6e00': {\n code: ErrorCode.DeviceStateEthAppClosed,\n message: 'Ethereum app closed',\n severity: Severity.Err,\n category: Category.DeviceState,\n userMessage: 'Ethereum app is closed. Please open it to continue.',\n },\n '0x6501': {\n code: ErrorCode.DeviceStateEthAppOutOfDate,\n message: 'Ethereum app out of date',\n severity: Severity.Err,\n category: Category.DeviceState,\n userMessage: 'Ethereum app is out of date. Please update it to continue.',\n },\n '0x6f00': {\n code: ErrorCode.DeviceUnresponsive,\n message: 'Device unresponsive',\n severity: Severity.Err,\n category: Category.DeviceState,\n userMessage:\n 'Your device is not responding. Please disconnect and reconnect your device.',\n },\n '0x6b0c': {\n code: ErrorCode.AuthenticationDeviceLocked,\n message: 'Device locked',\n severity: Severity.Err,\n category: Category.Authentication,\n userMessage: 'Please unlock your Ledger device to continue.',\n },\n '0x6a15': {\n code: ErrorCode.DeviceStateEthAppClosed,\n message: 'Ethereum app closed',\n severity: Severity.Err,\n category: Category.DeviceState,\n userMessage: 'Ethereum app is closed. Please open it to continue.',\n },\n '0x6511': {\n code: ErrorCode.DeviceStateEthAppClosed,\n message: 'Ethereum app closed',\n severity: Severity.Err,\n category: Category.DeviceState,\n userMessage: 'Ethereum app is closed. Please open it to continue.',\n },\n};\n\nexport const BLE_ERROR_MAPPINGS = {\n BLUETOOTH_PERMISSION_DENIED: {\n code: ErrorCode.PermissionBluetoothDenied,\n message: 'Bluetooth permission denied',\n severity: Severity.Err,\n category: Category.Configuration,\n userMessage:\n 'Bluetooth permission is required to connect to your hardware wallet. Please enable it in your device settings.',\n },\n LOCATION_PERMISSION_DENIED: {\n code: ErrorCode.PermissionLocationDenied,\n message: 'Location permission denied',\n severity: Severity.Err,\n category: Category.Configuration,\n userMessage:\n 'Location permission is required for Bluetooth scanning on Android. Please enable it in your device settings.',\n },\n NEARBY_DEVICES_PERMISSION_DENIED: {\n code: ErrorCode.PermissionNearbyDevicesDenied,\n message: 'Nearby devices permission denied',\n severity: Severity.Err,\n category: Category.Configuration,\n userMessage:\n 'Nearby devices permission is required to scan for your hardware wallet. Please enable it in your device settings.',\n },\n BLUETOOTH_DISABLED: {\n code: ErrorCode.BluetoothDisabled,\n message: 'Bluetooth is turned off',\n severity: Severity.Warning,\n category: Category.Connection,\n userMessage:\n 'Bluetooth is turned off. Please enable Bluetooth to connect to your hardware wallet.',\n },\n BLUETOOTH_SCAN_FAILED: {\n code: ErrorCode.BluetoothScanFailed,\n message: 'Bluetooth scanning failed',\n severity: Severity.Err,\n category: Category.Connection,\n userMessage: 'Unable to scan for Bluetooth devices. Please try again.',\n },\n BLUETOOTH_CONNECTION_FAILED: {\n code: ErrorCode.BluetoothConnectionFailed,\n message: 'Bluetooth connection failed',\n severity: Severity.Err,\n category: Category.Connection,\n userMessage:\n 'Failed to connect via Bluetooth. Please make sure your device is nearby and try again.',\n },\n};\n\nexport const MOBILE_ERROR_MAPPINGS = {\n CAMERA_PERMISSION_DENIED: {\n code: ErrorCode.PermissionCameraDenied,\n message: 'Camera permission denied',\n severity: Severity.Err,\n category: Category.Configuration,\n userMessage:\n 'Camera permission is required to scan QR codes. Please enable it in your device settings.',\n },\n NOT_SUPPORTED: {\n code: ErrorCode.MobileNotSupported,\n message: 'Operation not supported on mobile',\n severity: Severity.Err,\n category: Category.DeviceState,\n userMessage: 'This operation is not supported on mobile devices.',\n },\n};\n\n/**\n * QR error mappings - static error data for QR hardware wallets and their related flows.\n */\nexport const QR_WALLET_ERROR_MAPPINGS: Record<string, ErrorMapping> = {\n CAMERA_PERMISSION_PROMPT_DISMISSED: {\n code: ErrorCode.PermissionCameraPromptDismissed,\n message: 'Camera permission prompt dismissed without granting access',\n severity: Severity.Warning,\n category: Category.Configuration,\n userMessage:\n 'MetaMask needs camera access to scan the QR code on your device.',\n },\n CAMERA_PERMISSION_BLOCKED: {\n code: ErrorCode.PermissionCameraDenied,\n message: 'Camera permission blocked by the browser',\n severity: Severity.Err,\n category: Category.Configuration,\n userMessage: 'To continue, allow camera access in your browser settings.',\n },\n};\n\n/**\n * Trezor error mappings - static error data for Trezor hardware wallets.\n * These mappings provide consistent error classification across Trezor integrations.\n */\nexport const TREZOR_ERROR_MAPPINGS: Record<string, ErrorMapping> = {\n Transport_Missing: {\n code: ErrorCode.ConnectionTransportMissing,\n message: 'Trezor transport is unavailable',\n severity: Severity.Err,\n category: Category.Connection,\n userMessage:\n 'Unable to connect to your Trezor device. Please reconnect and try again.',\n },\n Device_Disconnected: {\n code: ErrorCode.DeviceDisconnected,\n message: 'Trezor device disconnected',\n severity: Severity.Err,\n category: Category.Connection,\n userMessage:\n 'Your Trezor device was disconnected. Please reconnect and try again.',\n },\n Popup_ConnectionMissing: {\n code: ErrorCode.ConnectionClosed,\n message: 'Trezor popup connection unavailable',\n severity: Severity.Err,\n category: Category.Connection,\n userMessage: 'Connection to your Trezor device popup failed. Please retry.',\n },\n Desktop_ConnectionMissing: {\n code: ErrorCode.ConnectionClosed,\n message: 'Trezor desktop connection unavailable',\n severity: Severity.Err,\n category: Category.Connection,\n userMessage:\n 'Connection to Trezor Suite failed. Please retry with your device connected.',\n },\n Method_Interrupted: {\n code: ErrorCode.ConnectionClosed,\n message: 'Trezor action was interrupted',\n severity: Severity.Err,\n category: Category.Connection,\n userMessage:\n 'Connection to your Trezor device was closed. Please reconnect and try again.',\n },\n Method_Cancel: {\n code: ErrorCode.UserCancelled,\n message: 'User cancelled action on Trezor device',\n severity: Severity.Warning,\n category: Category.UserAction,\n userMessage: 'Action was cancelled on your Trezor device.',\n },\n Method_PermissionsNotGranted: {\n code: ErrorCode.UserRejected,\n message: 'Permission not granted on Trezor device',\n severity: Severity.Warning,\n category: Category.UserAction,\n userMessage: 'Permission was rejected on your Trezor device.',\n },\n Failure_ActionCancelled: {\n code: ErrorCode.UserCancelled,\n message: 'User cancelled action on Trezor device',\n severity: Severity.Warning,\n category: Category.UserAction,\n userMessage: 'Action was cancelled on your Trezor device.',\n },\n Device_InvalidState: {\n code: ErrorCode.AuthenticationFailed,\n message: 'Trezor device authentication failed',\n severity: Severity.Err,\n category: Category.Authentication,\n userMessage:\n 'Authentication failed on your Trezor device. Check your passphrase and retry.',\n },\n Device_CallInProgress: {\n code: ErrorCode.DeviceCallInProgress,\n message: 'Trezor device call already in progress',\n severity: Severity.Err,\n category: Category.DeviceState,\n userMessage:\n 'Your Trezor device is busy. Finish the current action and retry.',\n },\n Init_IframeTimeout: {\n code: ErrorCode.ConnectionTimeout,\n message: 'Trezor connection timed out',\n severity: Severity.Err,\n category: Category.Connection,\n userMessage:\n 'Connection to your Trezor device timed out. Please try again.',\n },\n Init_IframeBlocked: {\n code: ErrorCode.ConnectionBlocked,\n message: 'Trezor iframe blocked',\n severity: Severity.Err,\n category: Category.Connection,\n userMessage:\n 'Trezor connection popup was blocked. Please allow popups and try again.',\n },\n Init_ManifestMissing: {\n code: ErrorCode.Unknown,\n message: 'Trezor manifest is missing',\n severity: Severity.Err,\n category: Category.Configuration,\n userMessage:\n 'Trezor integration is not configured correctly. Please retry later.',\n },\n Device_NotFound: {\n code: ErrorCode.DeviceNotFound,\n message: 'Trezor device not found',\n severity: Severity.Err,\n category: Category.Connection,\n userMessage:\n 'No Trezor device found. Please connect your device and try again.',\n },\n Device_UsedElsewhere: {\n code: ErrorCode.DeviceUsedElsewhere,\n message: 'Trezor device is used elsewhere',\n severity: Severity.Err,\n category: Category.DeviceState,\n userMessage:\n 'Your Trezor device is busy in another window. Close the other flow and try again.',\n },\n Device_MultipleNotSupported: {\n code: ErrorCode.DeviceMultipleConnected,\n message: 'Multiple Trezor devices are not supported',\n severity: Severity.Err,\n category: Category.DeviceState,\n userMessage:\n 'Multiple Trezor devices are connected. Keep one connected and retry.',\n },\n Device_MissingCapability: {\n code: ErrorCode.DeviceMissingCapability,\n message: 'Trezor device is missing capability',\n severity: Severity.Err,\n category: Category.DeviceState,\n userMessage:\n 'Your Trezor firmware does not support this action. Please update and retry.',\n },\n Device_MissingCapabilityBtcOnly: {\n code: ErrorCode.DeviceBtcOnlyFirmware,\n message: 'Trezor device firmware only supports BTC',\n severity: Severity.Err,\n category: Category.DeviceState,\n userMessage:\n 'Your Trezor firmware currently supports BTC only. Update firmware and retry.',\n },\n Failure_PinCancelled: {\n code: ErrorCode.AuthenticationPinCancelled,\n message: 'Trezor PIN entry cancelled',\n severity: Severity.Warning,\n category: Category.Authentication,\n userMessage: 'PIN entry was cancelled on your Trezor device.',\n },\n Failure_PinInvalid: {\n code: ErrorCode.AuthenticationIncorrectPin,\n message: 'Trezor PIN is invalid',\n severity: Severity.Err,\n category: Category.Authentication,\n userMessage: 'The PIN is incorrect. Please try again.',\n },\n Failure_PinMismatch: {\n code: ErrorCode.AuthenticationIncorrectPin,\n message: 'Trezor PIN mismatch',\n severity: Severity.Err,\n category: Category.Authentication,\n userMessage: 'The PIN does not match. Please try again.',\n },\n Failure_WipeCodeMismatch: {\n code: ErrorCode.AuthenticationWipeCodeMismatch,\n message: 'Trezor wipe code mismatch',\n severity: Severity.Err,\n category: Category.Authentication,\n userMessage: 'The wipe code does not match. Please verify and try again.',\n },\n Device_ModeException: {\n code: ErrorCode.DeviceIncompatibleMode,\n message: 'Trezor device mode is incompatible',\n severity: Severity.Err,\n category: Category.DeviceState,\n userMessage:\n 'Your Trezor is in an incompatible mode for this action. Check the device and retry.',\n },\n Device_ThpPairingTagInvalid: {\n code: ErrorCode.AuthenticationSecurityCondition,\n message: 'Trezor pairing security check failed',\n severity: Severity.Err,\n category: Category.Authentication,\n userMessage:\n 'A security check failed on your Trezor device. Reconnect and try again.',\n },\n Backend_Disconnected: {\n code: ErrorCode.ConnectionClosed,\n message: 'Trezor backend disconnected',\n severity: Severity.Err,\n category: Category.Connection,\n userMessage: 'Trezor backend disconnected. Please retry.',\n },\n Method_NoResponse: {\n code: ErrorCode.ConnectionClosed,\n message: 'Trezor call returned no response',\n severity: Severity.Err,\n category: Category.Connection,\n userMessage:\n 'Trezor did not return a response. Reconnect your device and try again.',\n },\n Device_InitializeFailed: {\n code: ErrorCode.AuthenticationDeviceLocked,\n message: 'Trezor device initialization failed',\n severity: Severity.Err,\n category: Category.Authentication,\n userMessage:\n 'Your Trezor device failed to initialize. Please unlock it and try again.',\n },\n};\n"]}
|
|
1
|
+
{"version":3,"file":"hardware-error-mappings.cjs","sourceRoot":"","sources":["../src/hardware-error-mappings.ts"],"names":[],"mappings":";;;AAAA,uEAAwE;AAU3D,QAAA,qBAAqB,GAAiC;IACjE,QAAQ,EAAE;QACR,IAAI,EAAE,iCAAS,CAAC,OAAO;QACvB,OAAO,EAAE,sBAAsB;QAC/B,QAAQ,EAAE,gCAAQ,CAAC,IAAI;QACvB,QAAQ,EAAE,gCAAQ,CAAC,OAAO;KAC3B;IACD,QAAQ,EAAE;QACR,IAAI,EAAE,iCAAS,CAAC,oBAAoB;QACpC,OAAO,EAAE,uBAAuB;QAChC,QAAQ,EAAE,gCAAQ,CAAC,GAAG;QACtB,QAAQ,EAAE,gCAAQ,CAAC,cAAc;QAC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;;;GAMG;AACU,QAAA,sBAAsB,GACjC;IACE,CAAC,iCAAS,CAAC,0BAA0B,CAAC,EAAE;QACtC,IAAI,EAAE,iCAAS,CAAC,0BAA0B;QAC1C,OAAO,EAAE,mDAAmD;QAC5D,QAAQ,EAAE,gCAAQ,CAAC,GAAG;QACtB,QAAQ,EAAE,gCAAQ,CAAC,WAAW;QAC9B,WAAW,EACT,yHAAyH;KAC5H;CACF,CAAC","sourcesContent":["import { ErrorCode, Severity, Category } from './hardware-errors-enums';\n\nexport type ErrorMapping = {\n code: ErrorCode;\n message: string;\n severity: Severity;\n category: Category;\n userMessage?: string;\n};\n\nexport const LEDGER_ERROR_MAPPINGS: Record<string, ErrorMapping> = {\n '0x9000': {\n code: ErrorCode.Success,\n message: 'Operation successful',\n severity: Severity.Info,\n category: Category.Success,\n },\n '0x6300': {\n code: ErrorCode.AuthenticationFailed,\n message: 'Authentication failed',\n severity: Severity.Err,\n category: Category.Authentication,\n userMessage: 'Authentication failed. Please verify your credentials.',\n },\n '0x63c0': {\n code: ErrorCode.AuthenticationPinAttemptsRemaining,\n message: 'PIN attempts remaining',\n severity: Severity.Warning,\n category: Category.Authentication,\n userMessage: 'Incorrect PIN. Please try again.',\n },\n '0x6982': {\n code: ErrorCode.AuthenticationSecurityCondition,\n message: 'Security conditions not satisfied',\n severity: Severity.Err,\n category: Category.Authentication,\n\n userMessage:\n 'Device is locked or access rights are insufficient. Please unlock your device.',\n },\n '0x6985': {\n code: ErrorCode.UserRejected,\n message: 'User rejected action on device',\n severity: Severity.Warning,\n category: Category.UserAction,\n\n userMessage:\n 'Transaction was rejected. Please approve on your device to continue.',\n },\n '0x9804': {\n code: ErrorCode.AuthenticationSecurityCondition,\n message: 'App update required',\n severity: Severity.Err,\n category: Category.Authentication,\n\n userMessage: 'Please update your Ledger app to continue.',\n },\n '0x9808': {\n code: ErrorCode.AuthenticationFailed,\n message: 'Contradiction in secret code status',\n severity: Severity.Err,\n category: Category.Authentication,\n },\n '0x9840': {\n code: ErrorCode.AuthenticationDeviceBlocked,\n message: 'Code blocked',\n severity: Severity.Critical,\n category: Category.Authentication,\n\n userMessage:\n 'Your device is blocked due to too many failed attempts. Please follow device recovery procedures.',\n },\n '0x650f': {\n code: ErrorCode.DeviceStateEthAppClosed,\n message: 'Ethereum app closed',\n severity: Severity.Err,\n category: Category.DeviceState,\n userMessage:\n 'Ethereum app is closed. Please open it on your Ledger device to continue.',\n },\n '0x5515': {\n code: ErrorCode.AuthenticationDeviceLocked,\n message: 'Device is locked',\n severity: Severity.Err,\n category: Category.Authentication,\n userMessage: 'Please unlock your Ledger device to continue.',\n },\n '0x5501': {\n code: ErrorCode.UserRejected,\n message: 'User refused on device',\n severity: Severity.Warning,\n category: Category.UserAction,\n userMessage:\n 'Operation was rejected. Please approve on your device to continue.',\n },\n '0x6a80': {\n code: ErrorCode.DeviceStateBlindSignNotSupported,\n message: 'Blind signing not supported',\n severity: Severity.Err,\n category: Category.DeviceState,\n userMessage: 'Blind signing is not supported on this device.',\n },\n '0x6a83': {\n code: ErrorCode.DeviceStateEthAppClosed,\n message: 'Ethereum app closed',\n severity: Severity.Err,\n category: Category.DeviceState,\n userMessage:\n 'Ethereum app is closed. Currently on solana. Please open it to continue.',\n },\n '0x6d00': {\n code: ErrorCode.DeviceStateEthAppClosed,\n message: 'Ethereum app closed',\n severity: Severity.Err,\n category: Category.DeviceState,\n userMessage:\n 'Ethereum app is closed. Currently on bitcoin. Please open it to continue.',\n },\n '0x6e00': {\n code: ErrorCode.DeviceStateEthAppClosed,\n message: 'Ethereum app closed',\n severity: Severity.Err,\n category: Category.DeviceState,\n userMessage: 'Ethereum app is closed. Please open it to continue.',\n },\n '0x6501': {\n code: ErrorCode.DeviceStateEthAppOutOfDate,\n message: 'Ethereum app out of date',\n severity: Severity.Err,\n category: Category.DeviceState,\n userMessage: 'Ethereum app is out of date. Please update it to continue.',\n },\n '0x6f00': {\n code: ErrorCode.DeviceUnresponsive,\n message: 'Device unresponsive',\n severity: Severity.Err,\n category: Category.DeviceState,\n userMessage:\n 'Your device is not responding. Please disconnect and reconnect your device.',\n },\n '0x6b0c': {\n code: ErrorCode.AuthenticationDeviceLocked,\n message: 'Device locked',\n severity: Severity.Err,\n category: Category.Authentication,\n userMessage: 'Please unlock your Ledger device to continue.',\n },\n '0x6a15': {\n code: ErrorCode.DeviceStateEthAppClosed,\n message: 'Ethereum app closed',\n severity: Severity.Err,\n category: Category.DeviceState,\n userMessage: 'Ethereum app is closed. Please open it to continue.',\n },\n '0x6511': {\n code: ErrorCode.DeviceStateEthAppClosed,\n message: 'Ethereum app closed',\n severity: Severity.Err,\n category: Category.DeviceState,\n userMessage: 'Ethereum app is closed. Please open it to continue.',\n },\n};\n\nexport const BLE_ERROR_MAPPINGS = {\n BLUETOOTH_PERMISSION_DENIED: {\n code: ErrorCode.PermissionBluetoothDenied,\n message: 'Bluetooth permission denied',\n severity: Severity.Err,\n category: Category.Configuration,\n userMessage:\n 'Bluetooth permission is required to connect to your hardware wallet. Please enable it in your device settings.',\n },\n LOCATION_PERMISSION_DENIED: {\n code: ErrorCode.PermissionLocationDenied,\n message: 'Location permission denied',\n severity: Severity.Err,\n category: Category.Configuration,\n userMessage:\n 'Location permission is required for Bluetooth scanning on Android. Please enable it in your device settings.',\n },\n NEARBY_DEVICES_PERMISSION_DENIED: {\n code: ErrorCode.PermissionNearbyDevicesDenied,\n message: 'Nearby devices permission denied',\n severity: Severity.Err,\n category: Category.Configuration,\n userMessage:\n 'Nearby devices permission is required to scan for your hardware wallet. Please enable it in your device settings.',\n },\n BLUETOOTH_DISABLED: {\n code: ErrorCode.BluetoothDisabled,\n message: 'Bluetooth is turned off',\n severity: Severity.Warning,\n category: Category.Connection,\n userMessage:\n 'Bluetooth is turned off. Please enable Bluetooth to connect to your hardware wallet.',\n },\n BLUETOOTH_SCAN_FAILED: {\n code: ErrorCode.BluetoothScanFailed,\n message: 'Bluetooth scanning failed',\n severity: Severity.Err,\n category: Category.Connection,\n userMessage: 'Unable to scan for Bluetooth devices. Please try again.',\n },\n BLUETOOTH_CONNECTION_FAILED: {\n code: ErrorCode.BluetoothConnectionFailed,\n message: 'Bluetooth connection failed',\n severity: Severity.Err,\n category: Category.Connection,\n userMessage:\n 'Failed to connect via Bluetooth. Please make sure your device is nearby and try again.',\n },\n};\n\nexport const MOBILE_ERROR_MAPPINGS = {\n CAMERA_PERMISSION_DENIED: {\n code: ErrorCode.PermissionCameraDenied,\n message: 'Camera permission denied',\n severity: Severity.Err,\n category: Category.Configuration,\n userMessage:\n 'Camera permission is required to scan QR codes. Please enable it in your device settings.',\n },\n NOT_SUPPORTED: {\n code: ErrorCode.MobileNotSupported,\n message: 'Operation not supported on mobile',\n severity: Severity.Err,\n category: Category.DeviceState,\n userMessage: 'This operation is not supported on mobile devices.',\n },\n};\n\n/**\n * QR error mappings - static error data for QR hardware wallets and their related flows.\n */\nexport const QR_WALLET_ERROR_MAPPINGS: Record<string, ErrorMapping> = {\n CAMERA_PERMISSION_PROMPT_DISMISSED: {\n code: ErrorCode.PermissionCameraPromptDismissed,\n message: 'Camera permission prompt dismissed without granting access',\n severity: Severity.Warning,\n category: Category.Configuration,\n userMessage:\n 'MetaMask needs camera access to scan the QR code on your device.',\n },\n CAMERA_PERMISSION_BLOCKED: {\n code: ErrorCode.PermissionCameraDenied,\n message: 'Camera permission blocked by the browser',\n severity: Severity.Err,\n category: Category.Configuration,\n userMessage: 'To continue, allow camera access in your browser settings.',\n },\n};\n\n/**\n * Trezor error mappings - static error data for Trezor hardware wallets.\n * These mappings provide consistent error classification across Trezor integrations.\n */\nexport const TREZOR_ERROR_MAPPINGS: Record<string, ErrorMapping> = {\n Transport_Missing: {\n code: ErrorCode.ConnectionTransportMissing,\n message: 'Trezor transport is unavailable',\n severity: Severity.Err,\n category: Category.Connection,\n userMessage:\n 'Unable to connect to your Trezor device. Please reconnect and try again.',\n },\n Device_Disconnected: {\n code: ErrorCode.DeviceDisconnected,\n message: 'Trezor device disconnected',\n severity: Severity.Err,\n category: Category.Connection,\n userMessage:\n 'Your Trezor device was disconnected. Please reconnect and try again.',\n },\n Popup_ConnectionMissing: {\n code: ErrorCode.ConnectionClosed,\n message: 'Trezor popup connection unavailable',\n severity: Severity.Err,\n category: Category.Connection,\n userMessage: 'Connection to your Trezor device popup failed. Please retry.',\n },\n Desktop_ConnectionMissing: {\n code: ErrorCode.ConnectionClosed,\n message: 'Trezor desktop connection unavailable',\n severity: Severity.Err,\n category: Category.Connection,\n userMessage:\n 'Connection to Trezor Suite failed. Please retry with your device connected.',\n },\n Method_Interrupted: {\n code: ErrorCode.ConnectionClosed,\n message: 'Trezor action was interrupted',\n severity: Severity.Err,\n category: Category.Connection,\n userMessage:\n 'Connection to your Trezor device was closed. Please reconnect and try again.',\n },\n Method_Cancel: {\n code: ErrorCode.UserCancelled,\n message: 'User cancelled action on Trezor device',\n severity: Severity.Warning,\n category: Category.UserAction,\n userMessage: 'Action was cancelled on your Trezor device.',\n },\n Method_PermissionsNotGranted: {\n code: ErrorCode.UserRejected,\n message: 'Permission not granted on Trezor device',\n severity: Severity.Warning,\n category: Category.UserAction,\n userMessage: 'Permission was rejected on your Trezor device.',\n },\n Failure_ActionCancelled: {\n code: ErrorCode.UserCancelled,\n message: 'User cancelled action on Trezor device',\n severity: Severity.Warning,\n category: Category.UserAction,\n userMessage: 'Action was cancelled on your Trezor device.',\n },\n Device_InvalidState: {\n code: ErrorCode.AuthenticationFailed,\n message: 'Trezor device authentication failed',\n severity: Severity.Err,\n category: Category.Authentication,\n userMessage:\n 'Authentication failed on your Trezor device. Check your passphrase and retry.',\n },\n Device_CallInProgress: {\n code: ErrorCode.DeviceCallInProgress,\n message: 'Trezor device call already in progress',\n severity: Severity.Err,\n category: Category.DeviceState,\n userMessage:\n 'Your Trezor device is busy. Finish the current action and retry.',\n },\n Init_IframeTimeout: {\n code: ErrorCode.ConnectionTimeout,\n message: 'Trezor connection timed out',\n severity: Severity.Err,\n category: Category.Connection,\n userMessage:\n 'Connection to your Trezor device timed out. Please try again.',\n },\n Init_IframeBlocked: {\n code: ErrorCode.ConnectionBlocked,\n message: 'Trezor iframe blocked',\n severity: Severity.Err,\n category: Category.Connection,\n userMessage:\n 'Trezor connection popup was blocked. Please allow popups and try again.',\n },\n Init_ManifestMissing: {\n code: ErrorCode.Unknown,\n message: 'Trezor manifest is missing',\n severity: Severity.Err,\n category: Category.Configuration,\n userMessage:\n 'Trezor integration is not configured correctly. Please retry later.',\n },\n Device_NotFound: {\n code: ErrorCode.DeviceNotFound,\n message: 'Trezor device not found',\n severity: Severity.Err,\n category: Category.Connection,\n userMessage:\n 'No Trezor device found. Please connect your device and try again.',\n },\n Device_UsedElsewhere: {\n code: ErrorCode.DeviceUsedElsewhere,\n message: 'Trezor device is used elsewhere',\n severity: Severity.Err,\n category: Category.DeviceState,\n userMessage:\n 'Your Trezor device is busy in another window. Close the other flow and try again.',\n },\n Device_MultipleNotSupported: {\n code: ErrorCode.DeviceMultipleConnected,\n message: 'Multiple Trezor devices are not supported',\n severity: Severity.Err,\n category: Category.DeviceState,\n userMessage:\n 'Multiple Trezor devices are connected. Keep one connected and retry.',\n },\n Device_MissingCapability: {\n code: ErrorCode.DeviceMissingCapability,\n message: 'Trezor device is missing capability',\n severity: Severity.Err,\n category: Category.DeviceState,\n userMessage:\n 'Your Trezor firmware does not support this action. Please update and retry.',\n },\n Device_MissingCapabilityBtcOnly: {\n code: ErrorCode.DeviceBtcOnlyFirmware,\n message: 'Trezor device firmware only supports BTC',\n severity: Severity.Err,\n category: Category.DeviceState,\n userMessage:\n 'Your Trezor firmware currently supports BTC only. Update firmware and retry.',\n },\n Failure_PinCancelled: {\n code: ErrorCode.AuthenticationPinCancelled,\n message: 'Trezor PIN entry cancelled',\n severity: Severity.Warning,\n category: Category.Authentication,\n userMessage: 'PIN entry was cancelled on your Trezor device.',\n },\n Failure_PinInvalid: {\n code: ErrorCode.AuthenticationIncorrectPin,\n message: 'Trezor PIN is invalid',\n severity: Severity.Err,\n category: Category.Authentication,\n userMessage: 'The PIN is incorrect. Please try again.',\n },\n Failure_PinMismatch: {\n code: ErrorCode.AuthenticationIncorrectPin,\n message: 'Trezor PIN mismatch',\n severity: Severity.Err,\n category: Category.Authentication,\n userMessage: 'The PIN does not match. Please try again.',\n },\n Failure_WipeCodeMismatch: {\n code: ErrorCode.AuthenticationWipeCodeMismatch,\n message: 'Trezor wipe code mismatch',\n severity: Severity.Err,\n category: Category.Authentication,\n userMessage: 'The wipe code does not match. Please verify and try again.',\n },\n Device_ModeException: {\n code: ErrorCode.DeviceIncompatibleMode,\n message: 'Trezor device mode is incompatible',\n severity: Severity.Err,\n category: Category.DeviceState,\n userMessage:\n 'Your Trezor is in an incompatible mode for this action. Check the device and retry.',\n },\n Device_ThpPairingTagInvalid: {\n code: ErrorCode.AuthenticationSecurityCondition,\n message: 'Trezor pairing security check failed',\n severity: Severity.Err,\n category: Category.Authentication,\n userMessage:\n 'A security check failed on your Trezor device. Reconnect and try again.',\n },\n Backend_Disconnected: {\n code: ErrorCode.ConnectionClosed,\n message: 'Trezor backend disconnected',\n severity: Severity.Err,\n category: Category.Connection,\n userMessage: 'Trezor backend disconnected. Please retry.',\n },\n Method_NoResponse: {\n code: ErrorCode.ConnectionClosed,\n message: 'Trezor call returned no response',\n severity: Severity.Err,\n category: Category.Connection,\n userMessage:\n 'Trezor did not return a response. Reconnect your device and try again.',\n },\n Device_InitializeFailed: {\n code: ErrorCode.AuthenticationDeviceLocked,\n message: 'Trezor device initialization failed',\n severity: Severity.Err,\n category: Category.Authentication,\n userMessage:\n 'Your Trezor device failed to initialize. Please unlock it and try again.',\n },\n};\n\n/**\n * Keyring error mappings - static error data for keyring-level validation errors\n * that are not tied to a Ledger transport status code.\n *\n * TODO: Wire DeviceStateOnlyV4Supported into keyring-eth-trezor and keyring-eth-qr\n * so all hardware keyrings throw HardwareWalletError for unsupported typed data versions.\n */\nexport const KEYRING_ERROR_MAPPINGS: Partial<Record<ErrorCode, ErrorMapping>> =\n {\n [ErrorCode.DeviceStateOnlyV4Supported]: {\n code: ErrorCode.DeviceStateOnlyV4Supported,\n message: 'Only version 4 of typed data signing is supported',\n severity: Severity.Err,\n category: Category.DeviceState,\n userMessage:\n 'This device can only sign version 4 (V4) typed data. This site requested an older signature type that is not supported.',\n },\n };\n"]}
|
|
@@ -76,4 +76,12 @@ export declare const QR_WALLET_ERROR_MAPPINGS: Record<string, ErrorMapping>;
|
|
|
76
76
|
* These mappings provide consistent error classification across Trezor integrations.
|
|
77
77
|
*/
|
|
78
78
|
export declare const TREZOR_ERROR_MAPPINGS: Record<string, ErrorMapping>;
|
|
79
|
+
/**
|
|
80
|
+
* Keyring error mappings - static error data for keyring-level validation errors
|
|
81
|
+
* that are not tied to a Ledger transport status code.
|
|
82
|
+
*
|
|
83
|
+
* TODO: Wire DeviceStateOnlyV4Supported into keyring-eth-trezor and keyring-eth-qr
|
|
84
|
+
* so all hardware keyrings throw HardwareWalletError for unsupported typed data versions.
|
|
85
|
+
*/
|
|
86
|
+
export declare const KEYRING_ERROR_MAPPINGS: Partial<Record<ErrorCode, ErrorMapping>>;
|
|
79
87
|
//# sourceMappingURL=hardware-error-mappings.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hardware-error-mappings.d.cts","sourceRoot":"","sources":["../src/hardware-error-mappings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,oCAAgC;AAExE,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,QAAQ,CAAC;IACnB,QAAQ,EAAE,QAAQ,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAuJ9D,CAAC;AAEF,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgD9B,CAAC;AAEF,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;CAgBjC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,wBAAwB,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAgBjE,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAgN9D,CAAC"}
|
|
1
|
+
{"version":3,"file":"hardware-error-mappings.d.cts","sourceRoot":"","sources":["../src/hardware-error-mappings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,oCAAgC;AAExE,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,QAAQ,CAAC;IACnB,QAAQ,EAAE,QAAQ,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAuJ9D,CAAC;AAEF,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgD9B,CAAC;AAEF,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;CAgBjC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,wBAAwB,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAgBjE,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAgN9D,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,EAAE,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,CAUzE,CAAC"}
|
|
@@ -76,4 +76,12 @@ export declare const QR_WALLET_ERROR_MAPPINGS: Record<string, ErrorMapping>;
|
|
|
76
76
|
* These mappings provide consistent error classification across Trezor integrations.
|
|
77
77
|
*/
|
|
78
78
|
export declare const TREZOR_ERROR_MAPPINGS: Record<string, ErrorMapping>;
|
|
79
|
+
/**
|
|
80
|
+
* Keyring error mappings - static error data for keyring-level validation errors
|
|
81
|
+
* that are not tied to a Ledger transport status code.
|
|
82
|
+
*
|
|
83
|
+
* TODO: Wire DeviceStateOnlyV4Supported into keyring-eth-trezor and keyring-eth-qr
|
|
84
|
+
* so all hardware keyrings throw HardwareWalletError for unsupported typed data versions.
|
|
85
|
+
*/
|
|
86
|
+
export declare const KEYRING_ERROR_MAPPINGS: Partial<Record<ErrorCode, ErrorMapping>>;
|
|
79
87
|
//# sourceMappingURL=hardware-error-mappings.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hardware-error-mappings.d.mts","sourceRoot":"","sources":["../src/hardware-error-mappings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,oCAAgC;AAExE,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,QAAQ,CAAC;IACnB,QAAQ,EAAE,QAAQ,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAuJ9D,CAAC;AAEF,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgD9B,CAAC;AAEF,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;CAgBjC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,wBAAwB,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAgBjE,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAgN9D,CAAC"}
|
|
1
|
+
{"version":3,"file":"hardware-error-mappings.d.mts","sourceRoot":"","sources":["../src/hardware-error-mappings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,oCAAgC;AAExE,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,QAAQ,CAAC;IACnB,QAAQ,EAAE,QAAQ,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAuJ9D,CAAC;AAEF,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgD9B,CAAC;AAEF,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;CAgBjC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,wBAAwB,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAgBjE,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAgN9D,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,EAAE,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,CAUzE,CAAC"}
|
|
@@ -413,4 +413,20 @@ export const TREZOR_ERROR_MAPPINGS = {
|
|
|
413
413
|
userMessage: 'Your Trezor device failed to initialize. Please unlock it and try again.',
|
|
414
414
|
},
|
|
415
415
|
};
|
|
416
|
+
/**
|
|
417
|
+
* Keyring error mappings - static error data for keyring-level validation errors
|
|
418
|
+
* that are not tied to a Ledger transport status code.
|
|
419
|
+
*
|
|
420
|
+
* TODO: Wire DeviceStateOnlyV4Supported into keyring-eth-trezor and keyring-eth-qr
|
|
421
|
+
* so all hardware keyrings throw HardwareWalletError for unsupported typed data versions.
|
|
422
|
+
*/
|
|
423
|
+
export const KEYRING_ERROR_MAPPINGS = {
|
|
424
|
+
[ErrorCode.DeviceStateOnlyV4Supported]: {
|
|
425
|
+
code: ErrorCode.DeviceStateOnlyV4Supported,
|
|
426
|
+
message: 'Only version 4 of typed data signing is supported',
|
|
427
|
+
severity: Severity.Err,
|
|
428
|
+
category: Category.DeviceState,
|
|
429
|
+
userMessage: 'This device can only sign version 4 (V4) typed data. This site requested an older signature type that is not supported.',
|
|
430
|
+
},
|
|
431
|
+
};
|
|
416
432
|
//# sourceMappingURL=hardware-error-mappings.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hardware-error-mappings.mjs","sourceRoot":"","sources":["../src/hardware-error-mappings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,oCAAgC;AAUxE,MAAM,CAAC,MAAM,qBAAqB,GAAiC;IACjE,QAAQ,EAAE;QACR,IAAI,EAAE,SAAS,CAAC,OAAO;QACvB,OAAO,EAAE,sBAAsB;QAC/B,QAAQ,EAAE,QAAQ,CAAC,IAAI;QACvB,QAAQ,EAAE,QAAQ,CAAC,OAAO;KAC3B;IACD,QAAQ,EAAE;QACR,IAAI,EAAE,SAAS,CAAC,oBAAoB;QACpC,OAAO,EAAE,uBAAuB;QAChC,QAAQ,EAAE,QAAQ,CAAC,GAAG;QACtB,QAAQ,EAAE,QAAQ,CAAC,cAAc;QACjC,WAAW,EAAE,wDAAwD;KACtE;IACD,QAAQ,EAAE;QACR,IAAI,EAAE,SAAS,CAAC,kCAAkC;QAClD,OAAO,EAAE,wBAAwB;QACjC,QAAQ,EAAE,QAAQ,CAAC,OAAO;QAC1B,QAAQ,EAAE,QAAQ,CAAC,cAAc;QACjC,WAAW,EAAE,kCAAkC;KAChD;IACD,QAAQ,EAAE;QACR,IAAI,EAAE,SAAS,CAAC,+BAA+B;QAC/C,OAAO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EAAE;QAC3B,IAAI,EAAE,SAAS,CAAC,+BAA+B;QAC/C,OAAO,EAAE,sCAAsC;QAC/C,QAAQ,EAAE,QAAQ,CAAC,GAAG;QACtB,QAAQ,EAAE,QAAQ,CAAC,cAAc;QACjC,WAAW,EACT,yEAAyE;KAC5E;IACD,oBAAoB,EAAE;QACpB,IAAI,EAAE,SAAS,CAAC,gBAAgB;QAChC,OAAO,EAAE,6BAA6B;QACtC,QAAQ,EAAE,QAAQ,CAAC,GAAG;QACtB,QAAQ,EAAE,QAAQ,CAAC,UAAU;QAC7B,WAAW,EAAE,4CAA4C;KAC1D;IACD,iBAAiB,EAAE;QACjB,IAAI,EAAE,SAAS,CAAC,gBAAgB;QAChC,OAAO,EAAE,kCAAkC;QAC3C,QAAQ,EAAE,QAAQ,CAAC,GAAG;QACtB,QAAQ,EAAE,QAAQ,CAAC,UAAU;QAC7B,WAAW,EACT,wEAAwE;KAC3E;IACD,uBAAuB,EAAE;QACvB,IAAI,EAAE,SAAS,CAAC,0BAA0B;QAC1C,OAAO,EAAE,qCAAqC;QAC9C,QAAQ,EAAE,QAAQ,CAAC,GAAG;QACtB,QAAQ,EAAE,QAAQ,CAAC,cAAc;QACjC,WAAW,EACT,0EAA0E;KAC7E;CACF,CAAC","sourcesContent":["import { ErrorCode, Severity, Category } from './hardware-errors-enums';\n\nexport type ErrorMapping = {\n code: ErrorCode;\n message: string;\n severity: Severity;\n category: Category;\n userMessage?: string;\n};\n\nexport const LEDGER_ERROR_MAPPINGS: Record<string, ErrorMapping> = {\n '0x9000': {\n code: ErrorCode.Success,\n message: 'Operation successful',\n severity: Severity.Info,\n category: Category.Success,\n },\n '0x6300': {\n code: ErrorCode.AuthenticationFailed,\n message: 'Authentication failed',\n severity: Severity.Err,\n category: Category.Authentication,\n userMessage: 'Authentication failed. Please verify your credentials.',\n },\n '0x63c0': {\n code: ErrorCode.AuthenticationPinAttemptsRemaining,\n message: 'PIN attempts remaining',\n severity: Severity.Warning,\n category: Category.Authentication,\n userMessage: 'Incorrect PIN. Please try again.',\n },\n '0x6982': {\n code: ErrorCode.AuthenticationSecurityCondition,\n message: 'Security conditions not satisfied',\n severity: Severity.Err,\n category: Category.Authentication,\n\n userMessage:\n 'Device is locked or access rights are insufficient. Please unlock your device.',\n },\n '0x6985': {\n code: ErrorCode.UserRejected,\n message: 'User rejected action on device',\n severity: Severity.Warning,\n category: Category.UserAction,\n\n userMessage:\n 'Transaction was rejected. Please approve on your device to continue.',\n },\n '0x9804': {\n code: ErrorCode.AuthenticationSecurityCondition,\n message: 'App update required',\n severity: Severity.Err,\n category: Category.Authentication,\n\n userMessage: 'Please update your Ledger app to continue.',\n },\n '0x9808': {\n code: ErrorCode.AuthenticationFailed,\n message: 'Contradiction in secret code status',\n severity: Severity.Err,\n category: Category.Authentication,\n },\n '0x9840': {\n code: ErrorCode.AuthenticationDeviceBlocked,\n message: 'Code blocked',\n severity: Severity.Critical,\n category: Category.Authentication,\n\n userMessage:\n 'Your device is blocked due to too many failed attempts. Please follow device recovery procedures.',\n },\n '0x650f': {\n code: ErrorCode.DeviceStateEthAppClosed,\n message: 'Ethereum app closed',\n severity: Severity.Err,\n category: Category.DeviceState,\n userMessage:\n 'Ethereum app is closed. Please open it on your Ledger device to continue.',\n },\n '0x5515': {\n code: ErrorCode.AuthenticationDeviceLocked,\n message: 'Device is locked',\n severity: Severity.Err,\n category: Category.Authentication,\n userMessage: 'Please unlock your Ledger device to continue.',\n },\n '0x5501': {\n code: ErrorCode.UserRejected,\n message: 'User refused on device',\n severity: Severity.Warning,\n category: Category.UserAction,\n userMessage:\n 'Operation was rejected. Please approve on your device to continue.',\n },\n '0x6a80': {\n code: ErrorCode.DeviceStateBlindSignNotSupported,\n message: 'Blind signing not supported',\n severity: Severity.Err,\n category: Category.DeviceState,\n userMessage: 'Blind signing is not supported on this device.',\n },\n '0x6a83': {\n code: ErrorCode.DeviceStateEthAppClosed,\n message: 'Ethereum app closed',\n severity: Severity.Err,\n category: Category.DeviceState,\n userMessage:\n 'Ethereum app is closed. Currently on solana. Please open it to continue.',\n },\n '0x6d00': {\n code: ErrorCode.DeviceStateEthAppClosed,\n message: 'Ethereum app closed',\n severity: Severity.Err,\n category: Category.DeviceState,\n userMessage:\n 'Ethereum app is closed. Currently on bitcoin. Please open it to continue.',\n },\n '0x6e00': {\n code: ErrorCode.DeviceStateEthAppClosed,\n message: 'Ethereum app closed',\n severity: Severity.Err,\n category: Category.DeviceState,\n userMessage: 'Ethereum app is closed. Please open it to continue.',\n },\n '0x6501': {\n code: ErrorCode.DeviceStateEthAppOutOfDate,\n message: 'Ethereum app out of date',\n severity: Severity.Err,\n category: Category.DeviceState,\n userMessage: 'Ethereum app is out of date. Please update it to continue.',\n },\n '0x6f00': {\n code: ErrorCode.DeviceUnresponsive,\n message: 'Device unresponsive',\n severity: Severity.Err,\n category: Category.DeviceState,\n userMessage:\n 'Your device is not responding. Please disconnect and reconnect your device.',\n },\n '0x6b0c': {\n code: ErrorCode.AuthenticationDeviceLocked,\n message: 'Device locked',\n severity: Severity.Err,\n category: Category.Authentication,\n userMessage: 'Please unlock your Ledger device to continue.',\n },\n '0x6a15': {\n code: ErrorCode.DeviceStateEthAppClosed,\n message: 'Ethereum app closed',\n severity: Severity.Err,\n category: Category.DeviceState,\n userMessage: 'Ethereum app is closed. Please open it to continue.',\n },\n '0x6511': {\n code: ErrorCode.DeviceStateEthAppClosed,\n message: 'Ethereum app closed',\n severity: Severity.Err,\n category: Category.DeviceState,\n userMessage: 'Ethereum app is closed. Please open it to continue.',\n },\n};\n\nexport const BLE_ERROR_MAPPINGS = {\n BLUETOOTH_PERMISSION_DENIED: {\n code: ErrorCode.PermissionBluetoothDenied,\n message: 'Bluetooth permission denied',\n severity: Severity.Err,\n category: Category.Configuration,\n userMessage:\n 'Bluetooth permission is required to connect to your hardware wallet. Please enable it in your device settings.',\n },\n LOCATION_PERMISSION_DENIED: {\n code: ErrorCode.PermissionLocationDenied,\n message: 'Location permission denied',\n severity: Severity.Err,\n category: Category.Configuration,\n userMessage:\n 'Location permission is required for Bluetooth scanning on Android. Please enable it in your device settings.',\n },\n NEARBY_DEVICES_PERMISSION_DENIED: {\n code: ErrorCode.PermissionNearbyDevicesDenied,\n message: 'Nearby devices permission denied',\n severity: Severity.Err,\n category: Category.Configuration,\n userMessage:\n 'Nearby devices permission is required to scan for your hardware wallet. Please enable it in your device settings.',\n },\n BLUETOOTH_DISABLED: {\n code: ErrorCode.BluetoothDisabled,\n message: 'Bluetooth is turned off',\n severity: Severity.Warning,\n category: Category.Connection,\n userMessage:\n 'Bluetooth is turned off. Please enable Bluetooth to connect to your hardware wallet.',\n },\n BLUETOOTH_SCAN_FAILED: {\n code: ErrorCode.BluetoothScanFailed,\n message: 'Bluetooth scanning failed',\n severity: Severity.Err,\n category: Category.Connection,\n userMessage: 'Unable to scan for Bluetooth devices. Please try again.',\n },\n BLUETOOTH_CONNECTION_FAILED: {\n code: ErrorCode.BluetoothConnectionFailed,\n message: 'Bluetooth connection failed',\n severity: Severity.Err,\n category: Category.Connection,\n userMessage:\n 'Failed to connect via Bluetooth. Please make sure your device is nearby and try again.',\n },\n};\n\nexport const MOBILE_ERROR_MAPPINGS = {\n CAMERA_PERMISSION_DENIED: {\n code: ErrorCode.PermissionCameraDenied,\n message: 'Camera permission denied',\n severity: Severity.Err,\n category: Category.Configuration,\n userMessage:\n 'Camera permission is required to scan QR codes. Please enable it in your device settings.',\n },\n NOT_SUPPORTED: {\n code: ErrorCode.MobileNotSupported,\n message: 'Operation not supported on mobile',\n severity: Severity.Err,\n category: Category.DeviceState,\n userMessage: 'This operation is not supported on mobile devices.',\n },\n};\n\n/**\n * QR error mappings - static error data for QR hardware wallets and their related flows.\n */\nexport const QR_WALLET_ERROR_MAPPINGS: Record<string, ErrorMapping> = {\n CAMERA_PERMISSION_PROMPT_DISMISSED: {\n code: ErrorCode.PermissionCameraPromptDismissed,\n message: 'Camera permission prompt dismissed without granting access',\n severity: Severity.Warning,\n category: Category.Configuration,\n userMessage:\n 'MetaMask needs camera access to scan the QR code on your device.',\n },\n CAMERA_PERMISSION_BLOCKED: {\n code: ErrorCode.PermissionCameraDenied,\n message: 'Camera permission blocked by the browser',\n severity: Severity.Err,\n category: Category.Configuration,\n userMessage: 'To continue, allow camera access in your browser settings.',\n },\n};\n\n/**\n * Trezor error mappings - static error data for Trezor hardware wallets.\n * These mappings provide consistent error classification across Trezor integrations.\n */\nexport const TREZOR_ERROR_MAPPINGS: Record<string, ErrorMapping> = {\n Transport_Missing: {\n code: ErrorCode.ConnectionTransportMissing,\n message: 'Trezor transport is unavailable',\n severity: Severity.Err,\n category: Category.Connection,\n userMessage:\n 'Unable to connect to your Trezor device. Please reconnect and try again.',\n },\n Device_Disconnected: {\n code: ErrorCode.DeviceDisconnected,\n message: 'Trezor device disconnected',\n severity: Severity.Err,\n category: Category.Connection,\n userMessage:\n 'Your Trezor device was disconnected. Please reconnect and try again.',\n },\n Popup_ConnectionMissing: {\n code: ErrorCode.ConnectionClosed,\n message: 'Trezor popup connection unavailable',\n severity: Severity.Err,\n category: Category.Connection,\n userMessage: 'Connection to your Trezor device popup failed. Please retry.',\n },\n Desktop_ConnectionMissing: {\n code: ErrorCode.ConnectionClosed,\n message: 'Trezor desktop connection unavailable',\n severity: Severity.Err,\n category: Category.Connection,\n userMessage:\n 'Connection to Trezor Suite failed. Please retry with your device connected.',\n },\n Method_Interrupted: {\n code: ErrorCode.ConnectionClosed,\n message: 'Trezor action was interrupted',\n severity: Severity.Err,\n category: Category.Connection,\n userMessage:\n 'Connection to your Trezor device was closed. Please reconnect and try again.',\n },\n Method_Cancel: {\n code: ErrorCode.UserCancelled,\n message: 'User cancelled action on Trezor device',\n severity: Severity.Warning,\n category: Category.UserAction,\n userMessage: 'Action was cancelled on your Trezor device.',\n },\n Method_PermissionsNotGranted: {\n code: ErrorCode.UserRejected,\n message: 'Permission not granted on Trezor device',\n severity: Severity.Warning,\n category: Category.UserAction,\n userMessage: 'Permission was rejected on your Trezor device.',\n },\n Failure_ActionCancelled: {\n code: ErrorCode.UserCancelled,\n message: 'User cancelled action on Trezor device',\n severity: Severity.Warning,\n category: Category.UserAction,\n userMessage: 'Action was cancelled on your Trezor device.',\n },\n Device_InvalidState: {\n code: ErrorCode.AuthenticationFailed,\n message: 'Trezor device authentication failed',\n severity: Severity.Err,\n category: Category.Authentication,\n userMessage:\n 'Authentication failed on your Trezor device. Check your passphrase and retry.',\n },\n Device_CallInProgress: {\n code: ErrorCode.DeviceCallInProgress,\n message: 'Trezor device call already in progress',\n severity: Severity.Err,\n category: Category.DeviceState,\n userMessage:\n 'Your Trezor device is busy. Finish the current action and retry.',\n },\n Init_IframeTimeout: {\n code: ErrorCode.ConnectionTimeout,\n message: 'Trezor connection timed out',\n severity: Severity.Err,\n category: Category.Connection,\n userMessage:\n 'Connection to your Trezor device timed out. Please try again.',\n },\n Init_IframeBlocked: {\n code: ErrorCode.ConnectionBlocked,\n message: 'Trezor iframe blocked',\n severity: Severity.Err,\n category: Category.Connection,\n userMessage:\n 'Trezor connection popup was blocked. Please allow popups and try again.',\n },\n Init_ManifestMissing: {\n code: ErrorCode.Unknown,\n message: 'Trezor manifest is missing',\n severity: Severity.Err,\n category: Category.Configuration,\n userMessage:\n 'Trezor integration is not configured correctly. Please retry later.',\n },\n Device_NotFound: {\n code: ErrorCode.DeviceNotFound,\n message: 'Trezor device not found',\n severity: Severity.Err,\n category: Category.Connection,\n userMessage:\n 'No Trezor device found. Please connect your device and try again.',\n },\n Device_UsedElsewhere: {\n code: ErrorCode.DeviceUsedElsewhere,\n message: 'Trezor device is used elsewhere',\n severity: Severity.Err,\n category: Category.DeviceState,\n userMessage:\n 'Your Trezor device is busy in another window. Close the other flow and try again.',\n },\n Device_MultipleNotSupported: {\n code: ErrorCode.DeviceMultipleConnected,\n message: 'Multiple Trezor devices are not supported',\n severity: Severity.Err,\n category: Category.DeviceState,\n userMessage:\n 'Multiple Trezor devices are connected. Keep one connected and retry.',\n },\n Device_MissingCapability: {\n code: ErrorCode.DeviceMissingCapability,\n message: 'Trezor device is missing capability',\n severity: Severity.Err,\n category: Category.DeviceState,\n userMessage:\n 'Your Trezor firmware does not support this action. Please update and retry.',\n },\n Device_MissingCapabilityBtcOnly: {\n code: ErrorCode.DeviceBtcOnlyFirmware,\n message: 'Trezor device firmware only supports BTC',\n severity: Severity.Err,\n category: Category.DeviceState,\n userMessage:\n 'Your Trezor firmware currently supports BTC only. Update firmware and retry.',\n },\n Failure_PinCancelled: {\n code: ErrorCode.AuthenticationPinCancelled,\n message: 'Trezor PIN entry cancelled',\n severity: Severity.Warning,\n category: Category.Authentication,\n userMessage: 'PIN entry was cancelled on your Trezor device.',\n },\n Failure_PinInvalid: {\n code: ErrorCode.AuthenticationIncorrectPin,\n message: 'Trezor PIN is invalid',\n severity: Severity.Err,\n category: Category.Authentication,\n userMessage: 'The PIN is incorrect. Please try again.',\n },\n Failure_PinMismatch: {\n code: ErrorCode.AuthenticationIncorrectPin,\n message: 'Trezor PIN mismatch',\n severity: Severity.Err,\n category: Category.Authentication,\n userMessage: 'The PIN does not match. Please try again.',\n },\n Failure_WipeCodeMismatch: {\n code: ErrorCode.AuthenticationWipeCodeMismatch,\n message: 'Trezor wipe code mismatch',\n severity: Severity.Err,\n category: Category.Authentication,\n userMessage: 'The wipe code does not match. Please verify and try again.',\n },\n Device_ModeException: {\n code: ErrorCode.DeviceIncompatibleMode,\n message: 'Trezor device mode is incompatible',\n severity: Severity.Err,\n category: Category.DeviceState,\n userMessage:\n 'Your Trezor is in an incompatible mode for this action. Check the device and retry.',\n },\n Device_ThpPairingTagInvalid: {\n code: ErrorCode.AuthenticationSecurityCondition,\n message: 'Trezor pairing security check failed',\n severity: Severity.Err,\n category: Category.Authentication,\n userMessage:\n 'A security check failed on your Trezor device. Reconnect and try again.',\n },\n Backend_Disconnected: {\n code: ErrorCode.ConnectionClosed,\n message: 'Trezor backend disconnected',\n severity: Severity.Err,\n category: Category.Connection,\n userMessage: 'Trezor backend disconnected. Please retry.',\n },\n Method_NoResponse: {\n code: ErrorCode.ConnectionClosed,\n message: 'Trezor call returned no response',\n severity: Severity.Err,\n category: Category.Connection,\n userMessage:\n 'Trezor did not return a response. Reconnect your device and try again.',\n },\n Device_InitializeFailed: {\n code: ErrorCode.AuthenticationDeviceLocked,\n message: 'Trezor device initialization failed',\n severity: Severity.Err,\n category: Category.Authentication,\n userMessage:\n 'Your Trezor device failed to initialize. Please unlock it and try again.',\n },\n};\n"]}
|
|
1
|
+
{"version":3,"file":"hardware-error-mappings.mjs","sourceRoot":"","sources":["../src/hardware-error-mappings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,oCAAgC;AAUxE,MAAM,CAAC,MAAM,qBAAqB,GAAiC;IACjE,QAAQ,EAAE;QACR,IAAI,EAAE,SAAS,CAAC,OAAO;QACvB,OAAO,EAAE,sBAAsB;QAC/B,QAAQ,EAAE,QAAQ,CAAC,IAAI;QACvB,QAAQ,EAAE,QAAQ,CAAC,OAAO;KAC3B;IACD,QAAQ,EAAE;QACR,IAAI,EAAE,SAAS,CAAC,oBAAoB;QACpC,OAAO,EAAE,uBAAuB;QAChC,QAAQ,EAAE,QAAQ,CAAC,GAAG;QACtB,QAAQ,EAAE,QAAQ,CAAC,cAAc;QACjC,WAAW,EAAE,wDAAwD;KACtE;IACD,QAAQ,EAAE;QACR,IAAI,EAAE,SAAS,CAAC,kCAAkC;QAClD,OAAO,EAAE,wBAAwB;QACjC,QAAQ,EAAE,QAAQ,CAAC,OAAO;QAC1B,QAAQ,EAAE,QAAQ,CAAC,cAAc;QACjC,WAAW,EAAE,kCAAkC;KAChD;IACD,QAAQ,EAAE;QACR,IAAI,EAAE,SAAS,CAAC,+BAA+B;QAC/C,OAAO,EAAE,mCAAmC;QAC5C,QAAQ,EAAE,QAAQ,CAAC,GAAG;QACtB,QAAQ,EAAE,QAAQ,CAAC,cAAc;QAEjC,WAAW,EACT,gFAAgF;KACnF;IACD,QAA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AQ,CAAC,cAAc;QACjC,WAAW,EACT,yEAAyE;KAC5E;IACD,oBAAoB,EAAE;QACpB,IAAI,EAAE,SAAS,CAAC,gBAAgB;QAChC,OAAO,EAAE,6BAA6B;QACtC,QAAQ,EAAE,QAAQ,CAAC,GAAG;QACtB,QAAQ,EAAE,QAAQ,CAAC,UAAU;QAC7B,WAAW,EAAE,4CAA4C;KAC1D;IACD,iBAAiB,EAAE;QACjB,IAAI,EAAE,SAAS,CAAC,gBAAgB;QAChC,OAAO,EAAE,kCAAkC;QAC3C,QAAQ,EAAE,QAAQ,CAAC,GAAG;QACtB,QAAQ,EAAE,QAAQ,CAAC,UAAU;QAC7B,WAAW,EACT,wEAAwE;KAC3E;IACD,uBAAuB,EAAE;QACvB,IAAI,EAAE,SAAS,CAAC,0BAA0B;QAC1C,OAAO,EAAE,qCAAqC;QAC9C,QAAQ,EAAE,QAAQ,CAAC,GAAG;QACtB,QAAQ,EAAE,QAAQ,CAAC,cAAc;QACjC,WAAW,EACT,0EAA0E;KAC7E;CACF,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,sBAAsB,GACjC;IACE,CAAC,SAAS,CAAC,0BAA0B,CAAC,EAAE;QACtC,IAAI,EAAE,SAAS,CAAC,0BAA0B;QAC1C,OAAO,EAAE,mDAAmD;QAC5D,QAAQ,EAAE,QAAQ,CAAC,GAAG;QACtB,QAAQ,EAAE,QAAQ,CAAC,WAAW;QAC9B,WAAW,EACT,yHAAyH;KAC5H;CACF,CAAC","sourcesContent":["import { ErrorCode, Severity, Category } from './hardware-errors-enums';\n\nexport type ErrorMapping = {\n code: ErrorCode;\n message: string;\n severity: Severity;\n category: Category;\n userMessage?: string;\n};\n\nexport const LEDGER_ERROR_MAPPINGS: Record<string, ErrorMapping> = {\n '0x9000': {\n code: ErrorCode.Success,\n message: 'Operation successful',\n severity: Severity.Info,\n category: Category.Success,\n },\n '0x6300': {\n code: ErrorCode.AuthenticationFailed,\n message: 'Authentication failed',\n severity: Severity.Err,\n category: Category.Authentication,\n userMessage: 'Authentication failed. Please verify your credentials.',\n },\n '0x63c0': {\n code: ErrorCode.AuthenticationPinAttemptsRemaining,\n message: 'PIN attempts remaining',\n severity: Severity.Warning,\n category: Category.Authentication,\n userMessage: 'Incorrect PIN. Please try again.',\n },\n '0x6982': {\n code: ErrorCode.AuthenticationSecurityCondition,\n message: 'Security conditions not satisfied',\n severity: Severity.Err,\n category: Category.Authentication,\n\n userMessage:\n 'Device is locked or access rights are insufficient. Please unlock your device.',\n },\n '0x6985': {\n code: ErrorCode.UserRejected,\n message: 'User rejected action on device',\n severity: Severity.Warning,\n category: Category.UserAction,\n\n userMessage:\n 'Transaction was rejected. Please approve on your device to continue.',\n },\n '0x9804': {\n code: ErrorCode.AuthenticationSecurityCondition,\n message: 'App update required',\n severity: Severity.Err,\n category: Category.Authentication,\n\n userMessage: 'Please update your Ledger app to continue.',\n },\n '0x9808': {\n code: ErrorCode.AuthenticationFailed,\n message: 'Contradiction in secret code status',\n severity: Severity.Err,\n category: Category.Authentication,\n },\n '0x9840': {\n code: ErrorCode.AuthenticationDeviceBlocked,\n message: 'Code blocked',\n severity: Severity.Critical,\n category: Category.Authentication,\n\n userMessage:\n 'Your device is blocked due to too many failed attempts. Please follow device recovery procedures.',\n },\n '0x650f': {\n code: ErrorCode.DeviceStateEthAppClosed,\n message: 'Ethereum app closed',\n severity: Severity.Err,\n category: Category.DeviceState,\n userMessage:\n 'Ethereum app is closed. Please open it on your Ledger device to continue.',\n },\n '0x5515': {\n code: ErrorCode.AuthenticationDeviceLocked,\n message: 'Device is locked',\n severity: Severity.Err,\n category: Category.Authentication,\n userMessage: 'Please unlock your Ledger device to continue.',\n },\n '0x5501': {\n code: ErrorCode.UserRejected,\n message: 'User refused on device',\n severity: Severity.Warning,\n category: Category.UserAction,\n userMessage:\n 'Operation was rejected. Please approve on your device to continue.',\n },\n '0x6a80': {\n code: ErrorCode.DeviceStateBlindSignNotSupported,\n message: 'Blind signing not supported',\n severity: Severity.Err,\n category: Category.DeviceState,\n userMessage: 'Blind signing is not supported on this device.',\n },\n '0x6a83': {\n code: ErrorCode.DeviceStateEthAppClosed,\n message: 'Ethereum app closed',\n severity: Severity.Err,\n category: Category.DeviceState,\n userMessage:\n 'Ethereum app is closed. Currently on solana. Please open it to continue.',\n },\n '0x6d00': {\n code: ErrorCode.DeviceStateEthAppClosed,\n message: 'Ethereum app closed',\n severity: Severity.Err,\n category: Category.DeviceState,\n userMessage:\n 'Ethereum app is closed. Currently on bitcoin. Please open it to continue.',\n },\n '0x6e00': {\n code: ErrorCode.DeviceStateEthAppClosed,\n message: 'Ethereum app closed',\n severity: Severity.Err,\n category: Category.DeviceState,\n userMessage: 'Ethereum app is closed. Please open it to continue.',\n },\n '0x6501': {\n code: ErrorCode.DeviceStateEthAppOutOfDate,\n message: 'Ethereum app out of date',\n severity: Severity.Err,\n category: Category.DeviceState,\n userMessage: 'Ethereum app is out of date. Please update it to continue.',\n },\n '0x6f00': {\n code: ErrorCode.DeviceUnresponsive,\n message: 'Device unresponsive',\n severity: Severity.Err,\n category: Category.DeviceState,\n userMessage:\n 'Your device is not responding. Please disconnect and reconnect your device.',\n },\n '0x6b0c': {\n code: ErrorCode.AuthenticationDeviceLocked,\n message: 'Device locked',\n severity: Severity.Err,\n category: Category.Authentication,\n userMessage: 'Please unlock your Ledger device to continue.',\n },\n '0x6a15': {\n code: ErrorCode.DeviceStateEthAppClosed,\n message: 'Ethereum app closed',\n severity: Severity.Err,\n category: Category.DeviceState,\n userMessage: 'Ethereum app is closed. Please open it to continue.',\n },\n '0x6511': {\n code: ErrorCode.DeviceStateEthAppClosed,\n message: 'Ethereum app closed',\n severity: Severity.Err,\n category: Category.DeviceState,\n userMessage: 'Ethereum app is closed. Please open it to continue.',\n },\n};\n\nexport const BLE_ERROR_MAPPINGS = {\n BLUETOOTH_PERMISSION_DENIED: {\n code: ErrorCode.PermissionBluetoothDenied,\n message: 'Bluetooth permission denied',\n severity: Severity.Err,\n category: Category.Configuration,\n userMessage:\n 'Bluetooth permission is required to connect to your hardware wallet. Please enable it in your device settings.',\n },\n LOCATION_PERMISSION_DENIED: {\n code: ErrorCode.PermissionLocationDenied,\n message: 'Location permission denied',\n severity: Severity.Err,\n category: Category.Configuration,\n userMessage:\n 'Location permission is required for Bluetooth scanning on Android. Please enable it in your device settings.',\n },\n NEARBY_DEVICES_PERMISSION_DENIED: {\n code: ErrorCode.PermissionNearbyDevicesDenied,\n message: 'Nearby devices permission denied',\n severity: Severity.Err,\n category: Category.Configuration,\n userMessage:\n 'Nearby devices permission is required to scan for your hardware wallet. Please enable it in your device settings.',\n },\n BLUETOOTH_DISABLED: {\n code: ErrorCode.BluetoothDisabled,\n message: 'Bluetooth is turned off',\n severity: Severity.Warning,\n category: Category.Connection,\n userMessage:\n 'Bluetooth is turned off. Please enable Bluetooth to connect to your hardware wallet.',\n },\n BLUETOOTH_SCAN_FAILED: {\n code: ErrorCode.BluetoothScanFailed,\n message: 'Bluetooth scanning failed',\n severity: Severity.Err,\n category: Category.Connection,\n userMessage: 'Unable to scan for Bluetooth devices. Please try again.',\n },\n BLUETOOTH_CONNECTION_FAILED: {\n code: ErrorCode.BluetoothConnectionFailed,\n message: 'Bluetooth connection failed',\n severity: Severity.Err,\n category: Category.Connection,\n userMessage:\n 'Failed to connect via Bluetooth. Please make sure your device is nearby and try again.',\n },\n};\n\nexport const MOBILE_ERROR_MAPPINGS = {\n CAMERA_PERMISSION_DENIED: {\n code: ErrorCode.PermissionCameraDenied,\n message: 'Camera permission denied',\n severity: Severity.Err,\n category: Category.Configuration,\n userMessage:\n 'Camera permission is required to scan QR codes. Please enable it in your device settings.',\n },\n NOT_SUPPORTED: {\n code: ErrorCode.MobileNotSupported,\n message: 'Operation not supported on mobile',\n severity: Severity.Err,\n category: Category.DeviceState,\n userMessage: 'This operation is not supported on mobile devices.',\n },\n};\n\n/**\n * QR error mappings - static error data for QR hardware wallets and their related flows.\n */\nexport const QR_WALLET_ERROR_MAPPINGS: Record<string, ErrorMapping> = {\n CAMERA_PERMISSION_PROMPT_DISMISSED: {\n code: ErrorCode.PermissionCameraPromptDismissed,\n message: 'Camera permission prompt dismissed without granting access',\n severity: Severity.Warning,\n category: Category.Configuration,\n userMessage:\n 'MetaMask needs camera access to scan the QR code on your device.',\n },\n CAMERA_PERMISSION_BLOCKED: {\n code: ErrorCode.PermissionCameraDenied,\n message: 'Camera permission blocked by the browser',\n severity: Severity.Err,\n category: Category.Configuration,\n userMessage: 'To continue, allow camera access in your browser settings.',\n },\n};\n\n/**\n * Trezor error mappings - static error data for Trezor hardware wallets.\n * These mappings provide consistent error classification across Trezor integrations.\n */\nexport const TREZOR_ERROR_MAPPINGS: Record<string, ErrorMapping> = {\n Transport_Missing: {\n code: ErrorCode.ConnectionTransportMissing,\n message: 'Trezor transport is unavailable',\n severity: Severity.Err,\n category: Category.Connection,\n userMessage:\n 'Unable to connect to your Trezor device. Please reconnect and try again.',\n },\n Device_Disconnected: {\n code: ErrorCode.DeviceDisconnected,\n message: 'Trezor device disconnected',\n severity: Severity.Err,\n category: Category.Connection,\n userMessage:\n 'Your Trezor device was disconnected. Please reconnect and try again.',\n },\n Popup_ConnectionMissing: {\n code: ErrorCode.ConnectionClosed,\n message: 'Trezor popup connection unavailable',\n severity: Severity.Err,\n category: Category.Connection,\n userMessage: 'Connection to your Trezor device popup failed. Please retry.',\n },\n Desktop_ConnectionMissing: {\n code: ErrorCode.ConnectionClosed,\n message: 'Trezor desktop connection unavailable',\n severity: Severity.Err,\n category: Category.Connection,\n userMessage:\n 'Connection to Trezor Suite failed. Please retry with your device connected.',\n },\n Method_Interrupted: {\n code: ErrorCode.ConnectionClosed,\n message: 'Trezor action was interrupted',\n severity: Severity.Err,\n category: Category.Connection,\n userMessage:\n 'Connection to your Trezor device was closed. Please reconnect and try again.',\n },\n Method_Cancel: {\n code: ErrorCode.UserCancelled,\n message: 'User cancelled action on Trezor device',\n severity: Severity.Warning,\n category: Category.UserAction,\n userMessage: 'Action was cancelled on your Trezor device.',\n },\n Method_PermissionsNotGranted: {\n code: ErrorCode.UserRejected,\n message: 'Permission not granted on Trezor device',\n severity: Severity.Warning,\n category: Category.UserAction,\n userMessage: 'Permission was rejected on your Trezor device.',\n },\n Failure_ActionCancelled: {\n code: ErrorCode.UserCancelled,\n message: 'User cancelled action on Trezor device',\n severity: Severity.Warning,\n category: Category.UserAction,\n userMessage: 'Action was cancelled on your Trezor device.',\n },\n Device_InvalidState: {\n code: ErrorCode.AuthenticationFailed,\n message: 'Trezor device authentication failed',\n severity: Severity.Err,\n category: Category.Authentication,\n userMessage:\n 'Authentication failed on your Trezor device. Check your passphrase and retry.',\n },\n Device_CallInProgress: {\n code: ErrorCode.DeviceCallInProgress,\n message: 'Trezor device call already in progress',\n severity: Severity.Err,\n category: Category.DeviceState,\n userMessage:\n 'Your Trezor device is busy. Finish the current action and retry.',\n },\n Init_IframeTimeout: {\n code: ErrorCode.ConnectionTimeout,\n message: 'Trezor connection timed out',\n severity: Severity.Err,\n category: Category.Connection,\n userMessage:\n 'Connection to your Trezor device timed out. Please try again.',\n },\n Init_IframeBlocked: {\n code: ErrorCode.ConnectionBlocked,\n message: 'Trezor iframe blocked',\n severity: Severity.Err,\n category: Category.Connection,\n userMessage:\n 'Trezor connection popup was blocked. Please allow popups and try again.',\n },\n Init_ManifestMissing: {\n code: ErrorCode.Unknown,\n message: 'Trezor manifest is missing',\n severity: Severity.Err,\n category: Category.Configuration,\n userMessage:\n 'Trezor integration is not configured correctly. Please retry later.',\n },\n Device_NotFound: {\n code: ErrorCode.DeviceNotFound,\n message: 'Trezor device not found',\n severity: Severity.Err,\n category: Category.Connection,\n userMessage:\n 'No Trezor device found. Please connect your device and try again.',\n },\n Device_UsedElsewhere: {\n code: ErrorCode.DeviceUsedElsewhere,\n message: 'Trezor device is used elsewhere',\n severity: Severity.Err,\n category: Category.DeviceState,\n userMessage:\n 'Your Trezor device is busy in another window. Close the other flow and try again.',\n },\n Device_MultipleNotSupported: {\n code: ErrorCode.DeviceMultipleConnected,\n message: 'Multiple Trezor devices are not supported',\n severity: Severity.Err,\n category: Category.DeviceState,\n userMessage:\n 'Multiple Trezor devices are connected. Keep one connected and retry.',\n },\n Device_MissingCapability: {\n code: ErrorCode.DeviceMissingCapability,\n message: 'Trezor device is missing capability',\n severity: Severity.Err,\n category: Category.DeviceState,\n userMessage:\n 'Your Trezor firmware does not support this action. Please update and retry.',\n },\n Device_MissingCapabilityBtcOnly: {\n code: ErrorCode.DeviceBtcOnlyFirmware,\n message: 'Trezor device firmware only supports BTC',\n severity: Severity.Err,\n category: Category.DeviceState,\n userMessage:\n 'Your Trezor firmware currently supports BTC only. Update firmware and retry.',\n },\n Failure_PinCancelled: {\n code: ErrorCode.AuthenticationPinCancelled,\n message: 'Trezor PIN entry cancelled',\n severity: Severity.Warning,\n category: Category.Authentication,\n userMessage: 'PIN entry was cancelled on your Trezor device.',\n },\n Failure_PinInvalid: {\n code: ErrorCode.AuthenticationIncorrectPin,\n message: 'Trezor PIN is invalid',\n severity: Severity.Err,\n category: Category.Authentication,\n userMessage: 'The PIN is incorrect. Please try again.',\n },\n Failure_PinMismatch: {\n code: ErrorCode.AuthenticationIncorrectPin,\n message: 'Trezor PIN mismatch',\n severity: Severity.Err,\n category: Category.Authentication,\n userMessage: 'The PIN does not match. Please try again.',\n },\n Failure_WipeCodeMismatch: {\n code: ErrorCode.AuthenticationWipeCodeMismatch,\n message: 'Trezor wipe code mismatch',\n severity: Severity.Err,\n category: Category.Authentication,\n userMessage: 'The wipe code does not match. Please verify and try again.',\n },\n Device_ModeException: {\n code: ErrorCode.DeviceIncompatibleMode,\n message: 'Trezor device mode is incompatible',\n severity: Severity.Err,\n category: Category.DeviceState,\n userMessage:\n 'Your Trezor is in an incompatible mode for this action. Check the device and retry.',\n },\n Device_ThpPairingTagInvalid: {\n code: ErrorCode.AuthenticationSecurityCondition,\n message: 'Trezor pairing security check failed',\n severity: Severity.Err,\n category: Category.Authentication,\n userMessage:\n 'A security check failed on your Trezor device. Reconnect and try again.',\n },\n Backend_Disconnected: {\n code: ErrorCode.ConnectionClosed,\n message: 'Trezor backend disconnected',\n severity: Severity.Err,\n category: Category.Connection,\n userMessage: 'Trezor backend disconnected. Please retry.',\n },\n Method_NoResponse: {\n code: ErrorCode.ConnectionClosed,\n message: 'Trezor call returned no response',\n severity: Severity.Err,\n category: Category.Connection,\n userMessage:\n 'Trezor did not return a response. Reconnect your device and try again.',\n },\n Device_InitializeFailed: {\n code: ErrorCode.AuthenticationDeviceLocked,\n message: 'Trezor device initialization failed',\n severity: Severity.Err,\n category: Category.Authentication,\n userMessage:\n 'Your Trezor device failed to initialize. Please unlock it and try again.',\n },\n};\n\n/**\n * Keyring error mappings - static error data for keyring-level validation errors\n * that are not tied to a Ledger transport status code.\n *\n * TODO: Wire DeviceStateOnlyV4Supported into keyring-eth-trezor and keyring-eth-qr\n * so all hardware keyrings throw HardwareWalletError for unsupported typed data versions.\n */\nexport const KEYRING_ERROR_MAPPINGS: Partial<Record<ErrorCode, ErrorMapping>> =\n {\n [ErrorCode.DeviceStateOnlyV4Supported]: {\n code: ErrorCode.DeviceStateOnlyV4Supported,\n message: 'Only version 4 of typed data signing is supported',\n severity: Severity.Err,\n category: Category.DeviceState,\n userMessage:\n 'This device can only sign version 4 (V4) typed data. This site requested an older signature type that is not supported.',\n },\n };\n"]}
|
package/dist/index.cjs
CHANGED
|
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./hardware-errors-enums.cjs"), exports);
|
|
18
18
|
__exportStar(require("./hardware-error-mappings.cjs"), exports);
|
|
19
19
|
__exportStar(require("./hardware-error.cjs"), exports);
|
|
20
|
+
__exportStar(require("./dmk-error-mappings.cjs"), exports);
|
|
20
21
|
__exportStar(require("./types.cjs"), exports);
|
|
21
22
|
__exportStar(require("./user-rejection.cjs"), exports);
|
|
22
23
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8DAAwC;AACxC,gEAA0C;AAC1C,uDAAiC;AACjC,8CAAwB;AACxB,uDAAiC","sourcesContent":["export * from './hardware-errors-enums';\nexport * from './hardware-error-mappings';\nexport * from './hardware-error';\nexport * from './types';\nexport * from './user-rejection';\n"]}
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8DAAwC;AACxC,gEAA0C;AAC1C,uDAAiC;AACjC,2DAAqC;AACrC,8CAAwB;AACxB,uDAAiC","sourcesContent":["export * from './hardware-errors-enums';\nexport * from './hardware-error-mappings';\nexport * from './hardware-error';\nexport * from './dmk-error-mappings';\nexport * from './types';\nexport * from './user-rejection';\n"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from "./hardware-errors-enums.cjs";
|
|
2
2
|
export * from "./hardware-error-mappings.cjs";
|
|
3
3
|
export * from "./hardware-error.cjs";
|
|
4
|
+
export * from "./dmk-error-mappings.cjs";
|
|
4
5
|
export * from "./types.cjs";
|
|
5
6
|
export * from "./user-rejection.cjs";
|
|
6
7
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,4CAAwC;AACxC,8CAA0C;AAC1C,qCAAiC;AACjC,4BAAwB;AACxB,qCAAiC"}
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,4CAAwC;AACxC,8CAA0C;AAC1C,qCAAiC;AACjC,yCAAqC;AACrC,4BAAwB;AACxB,qCAAiC"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from "./hardware-errors-enums.mjs";
|
|
2
2
|
export * from "./hardware-error-mappings.mjs";
|
|
3
3
|
export * from "./hardware-error.mjs";
|
|
4
|
+
export * from "./dmk-error-mappings.mjs";
|
|
4
5
|
export * from "./types.mjs";
|
|
5
6
|
export * from "./user-rejection.mjs";
|
|
6
7
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,4CAAwC;AACxC,8CAA0C;AAC1C,qCAAiC;AACjC,4BAAwB;AACxB,qCAAiC"}
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,4CAAwC;AACxC,8CAA0C;AAC1C,qCAAiC;AACjC,yCAAqC;AACrC,4BAAwB;AACxB,qCAAiC"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from "./hardware-errors-enums.mjs";
|
|
2
2
|
export * from "./hardware-error-mappings.mjs";
|
|
3
3
|
export * from "./hardware-error.mjs";
|
|
4
|
+
export * from "./dmk-error-mappings.mjs";
|
|
4
5
|
export * from "./types.mjs";
|
|
5
6
|
export * from "./user-rejection.mjs";
|
|
6
7
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,4CAAwC;AACxC,8CAA0C;AAC1C,qCAAiC;AACjC,4BAAwB;AACxB,qCAAiC","sourcesContent":["export * from './hardware-errors-enums';\nexport * from './hardware-error-mappings';\nexport * from './hardware-error';\nexport * from './types';\nexport * from './user-rejection';\n"]}
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,4CAAwC;AACxC,8CAA0C;AAC1C,qCAAiC;AACjC,yCAAqC;AACrC,4BAAwB;AACxB,qCAAiC","sourcesContent":["export * from './hardware-errors-enums';\nexport * from './hardware-error-mappings';\nexport * from './hardware-error';\nexport * from './dmk-error-mappings';\nexport * from './types';\nexport * from './user-rejection';\n"]}
|