@metamask/eth-ledger-bridge-keyring 12.1.0 → 12.2.0
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 +28 -8
- package/dist/dmk/__testhelpers__/mock-error.cjs +24 -0
- package/dist/dmk/__testhelpers__/mock-error.cjs.map +1 -0
- package/dist/dmk/__testhelpers__/mock-error.d.cts +13 -0
- package/dist/dmk/__testhelpers__/mock-error.d.cts.map +1 -0
- package/dist/dmk/__testhelpers__/mock-error.d.mts +13 -0
- package/dist/dmk/__testhelpers__/mock-error.d.mts.map +1 -0
- package/dist/dmk/__testhelpers__/mock-error.mjs +20 -0
- package/dist/dmk/__testhelpers__/mock-error.mjs.map +1 -0
- package/dist/dmk/dmk-error-translator.cjs +35 -0
- package/dist/dmk/dmk-error-translator.cjs.map +1 -0
- package/dist/dmk/dmk-error-translator.d.cts +12 -0
- package/dist/dmk/dmk-error-translator.d.cts.map +1 -0
- package/dist/dmk/dmk-error-translator.d.mts +12 -0
- package/dist/dmk/dmk-error-translator.d.mts.map +1 -0
- package/dist/dmk/dmk-error-translator.mjs +30 -0
- package/dist/dmk/dmk-error-translator.mjs.map +1 -0
- package/dist/dmk/eth-get-app-configuration-command.cjs +155 -0
- package/dist/dmk/eth-get-app-configuration-command.cjs.map +1 -0
- package/dist/dmk/eth-get-app-configuration-command.d.cts +71 -0
- package/dist/dmk/eth-get-app-configuration-command.d.cts.map +1 -0
- package/dist/dmk/eth-get-app-configuration-command.d.mts +71 -0
- package/dist/dmk/eth-get-app-configuration-command.d.mts.map +1 -0
- package/dist/dmk/eth-get-app-configuration-command.mjs +151 -0
- package/dist/dmk/eth-get-app-configuration-command.mjs.map +1 -0
- package/dist/dmk/internal-utils.cjs +81 -0
- package/dist/dmk/internal-utils.cjs.map +1 -0
- package/dist/dmk/internal-utils.d.cts +44 -0
- package/dist/dmk/internal-utils.d.cts.map +1 -0
- package/dist/dmk/internal-utils.d.mts +44 -0
- package/dist/dmk/internal-utils.d.mts.map +1 -0
- package/dist/dmk/internal-utils.mjs +74 -0
- package/dist/dmk/internal-utils.mjs.map +1 -0
- package/dist/dmk/ledger-dmk-bridge.cjs +379 -0
- package/dist/dmk/ledger-dmk-bridge.cjs.map +1 -0
- package/dist/dmk/ledger-dmk-bridge.d.cts +157 -0
- package/dist/dmk/ledger-dmk-bridge.d.cts.map +1 -0
- package/dist/dmk/ledger-dmk-bridge.d.mts +157 -0
- package/dist/dmk/ledger-dmk-bridge.d.mts.map +1 -0
- package/dist/dmk/ledger-dmk-bridge.mjs +375 -0
- package/dist/dmk/ledger-dmk-bridge.mjs.map +1 -0
- package/dist/dmk/ledger-dmk-transport-middleware.cjs +170 -0
- package/dist/dmk/ledger-dmk-transport-middleware.cjs.map +1 -0
- package/dist/dmk/ledger-dmk-transport-middleware.d.cts +99 -0
- package/dist/dmk/ledger-dmk-transport-middleware.d.cts.map +1 -0
- package/dist/dmk/ledger-dmk-transport-middleware.d.mts +99 -0
- package/dist/dmk/ledger-dmk-transport-middleware.d.mts.map +1 -0
- package/dist/dmk/ledger-dmk-transport-middleware.mjs +166 -0
- package/dist/dmk/ledger-dmk-transport-middleware.mjs.map +1 -0
- package/dist/index.cjs +3 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -0
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +3 -0
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +3 -0
- package/dist/index.mjs.map +1 -1
- package/dist/ledger-bridge.cjs.map +1 -1
- package/dist/ledger-bridge.d.cts +12 -0
- package/dist/ledger-bridge.d.cts.map +1 -1
- package/dist/ledger-bridge.d.mts +12 -0
- package/dist/ledger-bridge.d.mts.map +1 -1
- package/dist/ledger-bridge.mjs.map +1 -1
- package/dist/ledger-iframe-bridge.cjs +3 -0
- package/dist/ledger-iframe-bridge.cjs.map +1 -1
- package/dist/ledger-iframe-bridge.d.cts +2 -1
- package/dist/ledger-iframe-bridge.d.cts.map +1 -1
- package/dist/ledger-iframe-bridge.d.mts +2 -1
- package/dist/ledger-iframe-bridge.d.mts.map +1 -1
- package/dist/ledger-iframe-bridge.mjs +3 -0
- package/dist/ledger-iframe-bridge.mjs.map +1 -1
- package/dist/ledger-keyring.cjs +59 -3
- package/dist/ledger-keyring.cjs.map +1 -1
- package/dist/ledger-keyring.d.cts +1 -0
- package/dist/ledger-keyring.d.cts.map +1 -1
- package/dist/ledger-keyring.d.mts +1 -0
- package/dist/ledger-keyring.d.mts.map +1 -1
- package/dist/ledger-keyring.mjs +61 -5
- package/dist/ledger-keyring.mjs.map +1 -1
- package/dist/ledger-mobile-bridge.cjs +3 -0
- package/dist/ledger-mobile-bridge.cjs.map +1 -1
- package/dist/ledger-mobile-bridge.d.cts +2 -1
- package/dist/ledger-mobile-bridge.d.cts.map +1 -1
- package/dist/ledger-mobile-bridge.d.mts +2 -1
- package/dist/ledger-mobile-bridge.d.mts.map +1 -1
- package/dist/ledger-mobile-bridge.mjs +3 -0
- package/dist/ledger-mobile-bridge.mjs.map +1 -1
- package/dist/v2/ledger-keyring.cjs +2 -1
- package/dist/v2/ledger-keyring.cjs.map +1 -1
- package/dist/v2/ledger-keyring.d.cts.map +1 -1
- package/dist/v2/ledger-keyring.d.mts.map +1 -1
- package/dist/v2/ledger-keyring.mjs +3 -2
- package/dist/v2/ledger-keyring.mjs.map +1 -1
- package/package.json +9 -5
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [12.2.0]
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- Add `LedgerDmkBridge` and `LedgerDmkTransportMiddleware` for Ledger Device Management Kit (DMK) support ([#473](https://github.com/MetaMask/accounts/pull/473))
|
|
15
|
+
- New `LedgerDmkBridge` class implementing the `LedgerBridge` interface via Ledger's DMK.
|
|
16
|
+
- New `LedgerDmkTransportMiddleware` managing sessions, device discovery, and Ethereum signer lifecycle.
|
|
17
|
+
- DMK error translation utilities (`translateDmkError`, `isDeviceExchangeError`) mapping to `TransportStatusError`.
|
|
18
|
+
- Custom `EthGetAppConfigurationCommand` for retrieving Ethereum app config via DMK.
|
|
19
|
+
- Session state monitoring with `onSessionStateChange` observable and `isDeviceConnected` getter.
|
|
20
|
+
- Add EIP-7702 authorization signing to the Ledger keyring ([#564](https://github.com/MetaMask/accounts/pull/564))
|
|
21
|
+
- Not yet functional: both iframe and mobile bridges throw until DMK support lands.
|
|
22
|
+
- Fixes hex `v` parsing (`'1b'`) for personal_sign and typed data.
|
|
23
|
+
|
|
24
|
+
### Changed
|
|
25
|
+
|
|
26
|
+
- Bump `@metamask/keyring-api` from `^23.1.0` to `^23.3.0` ([#562](https://github.com/MetaMask/accounts/pull/562), [#569](https://github.com/MetaMask/accounts/pull/569))
|
|
27
|
+
- Bump `@metamask/keyring-sdk` from `^2.1.1` to `^2.2.0` ([#562](https://github.com/MetaMask/accounts/pull/562))
|
|
28
|
+
|
|
10
29
|
## [12.1.0]
|
|
11
30
|
|
|
12
31
|
### Added
|
|
@@ -75,10 +94,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
75
94
|
|
|
76
95
|
### Changed
|
|
77
96
|
|
|
78
|
-
- Add new dependency `@metamask/keyring-sdk@1.2.0` ([#478](https://github.com/MetaMask/accounts/pull/478)
|
|
97
|
+
- Add new dependency `@metamask/keyring-sdk@1.2.0` ([#478](https://github.com/MetaMask/accounts/pull/478), [#482](https://github.com/MetaMask/accounts/pull/482), [#496](https://github.com/MetaMask/accounts/pull/496), [#509](https://github.com/MetaMask/accounts/pull/509))
|
|
79
98
|
- This package now contains the keyring v2 wrapper helpers (`EthKeyringWrapper`).
|
|
80
99
|
- The account ID (generated by `KeyringAccountRegistry`) are now deterministic for EVM addresses.
|
|
81
|
-
- Bump `@metamask/hw-wallet-sdk` from `^0.6.0` to `^0.8.0` ([#482](https://github.com/MetaMask/accounts/pull/482)
|
|
100
|
+
- Bump `@metamask/hw-wallet-sdk` from `^0.6.0` to `^0.8.0` ([#482](https://github.com/MetaMask/accounts/pull/482), [#497](https://github.com/MetaMask/accounts/pull/497))
|
|
82
101
|
- Bump `@metamask/keyring-api` from `^21.6.0` to `^22.0.0` ([#482](https://github.com/MetaMask/accounts/pull/482))
|
|
83
102
|
- Bump `@metamask/account-api` from `^1.0.0` to `^1.0.1` ([#487](https://github.com/MetaMask/accounts/pull/487))
|
|
84
103
|
|
|
@@ -97,7 +116,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
97
116
|
|
|
98
117
|
### Added
|
|
99
118
|
|
|
100
|
-
- Add `LedgerKeyringV2` class implementing `KeyringV2` interface ([#416](https://github.com/MetaMask/accounts/pull/416)
|
|
119
|
+
- Add `LedgerKeyringV2` class implementing `KeyringV2` interface ([#416](https://github.com/MetaMask/accounts/pull/416), [#451](https://github.com/MetaMask/accounts/pull/451), [#453](https://github.com/MetaMask/accounts/pull/453))
|
|
101
120
|
- Wraps legacy `LedgerKeyring` to expose accounts via the unified `KeyringV2` API and the `KeyringAccount` type.
|
|
102
121
|
- Extends `EthKeyringWrapper` for common Ethereum logic.
|
|
103
122
|
|
|
@@ -197,8 +216,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
197
216
|
|
|
198
217
|
### Changed
|
|
199
218
|
|
|
200
|
-
- Bump `@metamask/eth-sig-util` dependency from `^8.0.0` to `8.2.0` ([#177](https://github.com/MetaMask/accounts/pull/177)
|
|
201
|
-
- Bump `@metamask/utils` dependency from `^9.3.1` to `11.1.0` ([#134](https://github.com/MetaMask/accounts/pull/134)
|
|
219
|
+
- Bump `@metamask/eth-sig-util` dependency from `^8.0.0` to `8.2.0` ([#177](https://github.com/MetaMask/accounts/pull/177), [#134](https://github.com/MetaMask/accounts/pull/134))
|
|
220
|
+
- Bump `@metamask/utils` dependency from `^9.3.1` to `11.1.0` ([#134](https://github.com/MetaMask/accounts/pull/134), [#167](https://github.com/MetaMask/accounts/pull/167))
|
|
202
221
|
|
|
203
222
|
## [8.0.3]
|
|
204
223
|
|
|
@@ -431,8 +450,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
431
450
|
|
|
432
451
|
### Changed
|
|
433
452
|
|
|
434
|
-
- Remove unused `events` and `ethereumjs-tx` dependencies ([#101](https://github.com/MetaMask/eth-ledger-bridge-keyring/pull/101)
|
|
435
|
-
- Update eth-ledger-bridge-keyring to support EIP-1559 transactions ([#98](https://github.com/MetaMask/eth-ledger-bridge-keyring/pull/98)
|
|
453
|
+
- Remove unused `events` and `ethereumjs-tx` dependencies ([#101](https://github.com/MetaMask/eth-ledger-bridge-keyring/pull/101), [#102](https://github.com/MetaMask/eth-ledger-bridge-keyring/pull/102))
|
|
454
|
+
- Update eth-ledger-bridge-keyring to support EIP-1559 transactions ([#98](https://github.com/MetaMask/eth-ledger-bridge-keyring/pull/98), [#97](https://github.com/MetaMask/eth-ledger-bridge-keyring/pull/97), [#96](https://github.com/MetaMask/eth-ledger-bridge-keyring/pull/96))
|
|
436
455
|
|
|
437
456
|
## [0.6.0]
|
|
438
457
|
|
|
@@ -440,7 +459,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
440
459
|
|
|
441
460
|
- Support new versions of ethereumjs/tx ([#68](https://github.com/MetaMask/eth-ledger-bridge-keyring/pull/68))
|
|
442
461
|
|
|
443
|
-
[Unreleased]: https://github.com/MetaMask/accounts/compare/@metamask/eth-ledger-bridge-keyring@12.
|
|
462
|
+
[Unreleased]: https://github.com/MetaMask/accounts/compare/@metamask/eth-ledger-bridge-keyring@12.2.0...HEAD
|
|
463
|
+
[12.2.0]: https://github.com/MetaMask/accounts/compare/@metamask/eth-ledger-bridge-keyring@12.1.0...@metamask/eth-ledger-bridge-keyring@12.2.0
|
|
444
464
|
[12.1.0]: https://github.com/MetaMask/accounts/compare/@metamask/eth-ledger-bridge-keyring@12.0.3...@metamask/eth-ledger-bridge-keyring@12.1.0
|
|
445
465
|
[12.0.3]: https://github.com/MetaMask/accounts/compare/@metamask/eth-ledger-bridge-keyring@12.0.2...@metamask/eth-ledger-bridge-keyring@12.0.3
|
|
446
466
|
[12.0.2]: https://github.com/MetaMask/accounts/compare/@metamask/eth-ledger-bridge-keyring@12.0.1...@metamask/eth-ledger-bridge-keyring@12.0.2
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createMockDeviceExchangeError = void 0;
|
|
4
|
+
const eth_get_app_configuration_command_1 = require("../eth-get-app-configuration-command.cjs");
|
|
5
|
+
/**
|
|
6
|
+
* Construct a mock {@link DeviceExchangeError} for tests.
|
|
7
|
+
*
|
|
8
|
+
* The DMK `DeviceExchangeError` is normally raised inside the DMK runtime;
|
|
9
|
+
* tests need a structurally-equivalent value without going through DMK.
|
|
10
|
+
* This helper centralises the cast so test files don't each roll their own.
|
|
11
|
+
*
|
|
12
|
+
* @param errorCode - The hex error code to embed (e.g. `'6985'`).
|
|
13
|
+
* @returns A mock `DeviceExchangeError<TErrorCode>`.
|
|
14
|
+
*/
|
|
15
|
+
function createMockDeviceExchangeError(errorCode) {
|
|
16
|
+
return {
|
|
17
|
+
_tag: eth_get_app_configuration_command_1.ETH_APP_COMMAND_ERROR_TAG,
|
|
18
|
+
message: `DMK error: ${String(errorCode)}`,
|
|
19
|
+
errorCode,
|
|
20
|
+
originalError: undefined,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
exports.createMockDeviceExchangeError = createMockDeviceExchangeError;
|
|
24
|
+
//# sourceMappingURL=mock-error.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mock-error.cjs","sourceRoot":"","sources":["../../../src/dmk/__testhelpers__/mock-error.ts"],"names":[],"mappings":";;;AAEA,gGAAiF;AAEjF;;;;;;;;;GASG;AACH,SAAgB,6BAA6B,CAC3C,SAAqB;IAErB,OAAO;QACL,IAAI,EAAE,6DAAyB;QAC/B,OAAO,EAAE,cAAc,MAAM,CAAC,SAAS,CAAC,EAAE;QAC1C,SAAS;QACT,aAAa,EAAE,SAAS;KACqB,CAAC;AAClD,CAAC;AATD,sEASC","sourcesContent":["import type { DeviceExchangeError } from '@ledgerhq/device-management-kit';\n\nimport { ETH_APP_COMMAND_ERROR_TAG } from '../eth-get-app-configuration-command';\n\n/**\n * Construct a mock {@link DeviceExchangeError} for tests.\n *\n * The DMK `DeviceExchangeError` is normally raised inside the DMK runtime;\n * tests need a structurally-equivalent value without going through DMK.\n * This helper centralises the cast so test files don't each roll their own.\n *\n * @param errorCode - The hex error code to embed (e.g. `'6985'`).\n * @returns A mock `DeviceExchangeError<TErrorCode>`.\n */\nexport function createMockDeviceExchangeError<TErrorCode = string>(\n errorCode: TErrorCode,\n): DeviceExchangeError<TErrorCode> {\n return {\n _tag: ETH_APP_COMMAND_ERROR_TAG,\n message: `DMK error: ${String(errorCode)}`,\n errorCode,\n originalError: undefined,\n } as unknown as DeviceExchangeError<TErrorCode>;\n}\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { DeviceExchangeError } from "@ledgerhq/device-management-kit";
|
|
2
|
+
/**
|
|
3
|
+
* Construct a mock {@link DeviceExchangeError} for tests.
|
|
4
|
+
*
|
|
5
|
+
* The DMK `DeviceExchangeError` is normally raised inside the DMK runtime;
|
|
6
|
+
* tests need a structurally-equivalent value without going through DMK.
|
|
7
|
+
* This helper centralises the cast so test files don't each roll their own.
|
|
8
|
+
*
|
|
9
|
+
* @param errorCode - The hex error code to embed (e.g. `'6985'`).
|
|
10
|
+
* @returns A mock `DeviceExchangeError<TErrorCode>`.
|
|
11
|
+
*/
|
|
12
|
+
export declare function createMockDeviceExchangeError<TErrorCode = string>(errorCode: TErrorCode): DeviceExchangeError<TErrorCode>;
|
|
13
|
+
//# sourceMappingURL=mock-error.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mock-error.d.cts","sourceRoot":"","sources":["../../../src/dmk/__testhelpers__/mock-error.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,wCAAwC;AAI3E;;;;;;;;;GASG;AACH,wBAAgB,6BAA6B,CAAC,UAAU,GAAG,MAAM,EAC/D,SAAS,EAAE,UAAU,GACpB,mBAAmB,CAAC,UAAU,CAAC,CAOjC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { DeviceExchangeError } from "@ledgerhq/device-management-kit";
|
|
2
|
+
/**
|
|
3
|
+
* Construct a mock {@link DeviceExchangeError} for tests.
|
|
4
|
+
*
|
|
5
|
+
* The DMK `DeviceExchangeError` is normally raised inside the DMK runtime;
|
|
6
|
+
* tests need a structurally-equivalent value without going through DMK.
|
|
7
|
+
* This helper centralises the cast so test files don't each roll their own.
|
|
8
|
+
*
|
|
9
|
+
* @param errorCode - The hex error code to embed (e.g. `'6985'`).
|
|
10
|
+
* @returns A mock `DeviceExchangeError<TErrorCode>`.
|
|
11
|
+
*/
|
|
12
|
+
export declare function createMockDeviceExchangeError<TErrorCode = string>(errorCode: TErrorCode): DeviceExchangeError<TErrorCode>;
|
|
13
|
+
//# sourceMappingURL=mock-error.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mock-error.d.mts","sourceRoot":"","sources":["../../../src/dmk/__testhelpers__/mock-error.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,wCAAwC;AAI3E;;;;;;;;;GASG;AACH,wBAAgB,6BAA6B,CAAC,UAAU,GAAG,MAAM,EAC/D,SAAS,EAAE,UAAU,GACpB,mBAAmB,CAAC,UAAU,CAAC,CAOjC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ETH_APP_COMMAND_ERROR_TAG } from "../eth-get-app-configuration-command.mjs";
|
|
2
|
+
/**
|
|
3
|
+
* Construct a mock {@link DeviceExchangeError} for tests.
|
|
4
|
+
*
|
|
5
|
+
* The DMK `DeviceExchangeError` is normally raised inside the DMK runtime;
|
|
6
|
+
* tests need a structurally-equivalent value without going through DMK.
|
|
7
|
+
* This helper centralises the cast so test files don't each roll their own.
|
|
8
|
+
*
|
|
9
|
+
* @param errorCode - The hex error code to embed (e.g. `'6985'`).
|
|
10
|
+
* @returns A mock `DeviceExchangeError<TErrorCode>`.
|
|
11
|
+
*/
|
|
12
|
+
export function createMockDeviceExchangeError(errorCode) {
|
|
13
|
+
return {
|
|
14
|
+
_tag: ETH_APP_COMMAND_ERROR_TAG,
|
|
15
|
+
message: `DMK error: ${String(errorCode)}`,
|
|
16
|
+
errorCode,
|
|
17
|
+
originalError: undefined,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=mock-error.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mock-error.mjs","sourceRoot":"","sources":["../../../src/dmk/__testhelpers__/mock-error.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,yBAAyB,EAAE,iDAA6C;AAEjF;;;;;;;;;GASG;AACH,MAAM,UAAU,6BAA6B,CAC3C,SAAqB;IAErB,OAAO;QACL,IAAI,EAAE,yBAAyB;QAC/B,OAAO,EAAE,cAAc,MAAM,CAAC,SAAS,CAAC,EAAE;QAC1C,SAAS;QACT,aAAa,EAAE,SAAS;KACqB,CAAC;AAClD,CAAC","sourcesContent":["import type { DeviceExchangeError } from '@ledgerhq/device-management-kit';\n\nimport { ETH_APP_COMMAND_ERROR_TAG } from '../eth-get-app-configuration-command';\n\n/**\n * Construct a mock {@link DeviceExchangeError} for tests.\n *\n * The DMK `DeviceExchangeError` is normally raised inside the DMK runtime;\n * tests need a structurally-equivalent value without going through DMK.\n * This helper centralises the cast so test files don't each roll their own.\n *\n * @param errorCode - The hex error code to embed (e.g. `'6985'`).\n * @returns A mock `DeviceExchangeError<TErrorCode>`.\n */\nexport function createMockDeviceExchangeError<TErrorCode = string>(\n errorCode: TErrorCode,\n): DeviceExchangeError<TErrorCode> {\n return {\n _tag: ETH_APP_COMMAND_ERROR_TAG,\n message: `DMK error: ${String(errorCode)}`,\n errorCode,\n originalError: undefined,\n } as unknown as DeviceExchangeError<TErrorCode>;\n}\n"]}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isDeviceExchangeError = exports.translateDmkError = void 0;
|
|
4
|
+
const device_management_kit_1 = require("@ledgerhq/device-management-kit");
|
|
5
|
+
const hw_transport_1 = require("@ledgerhq/hw-transport");
|
|
6
|
+
const GENERIC_ERROR_STATUS_CODE = 0x6f00;
|
|
7
|
+
/**
|
|
8
|
+
* Translates a DMK error (DeviceExchangeError with hex error codes) into a
|
|
9
|
+
* TransportStatusError that the Ledger keyring error handler can process.
|
|
10
|
+
*
|
|
11
|
+
* @param error - The error from a DMK device action or command.
|
|
12
|
+
* @returns A TransportStatusError with the corresponding APDU status code.
|
|
13
|
+
*/
|
|
14
|
+
function translateDmkError(error) {
|
|
15
|
+
if (isDeviceExchangeError(error)) {
|
|
16
|
+
const statusCode = parseHexErrorCode(error.errorCode);
|
|
17
|
+
return new hw_transport_1.TransportStatusError(statusCode);
|
|
18
|
+
}
|
|
19
|
+
return new hw_transport_1.TransportStatusError(GENERIC_ERROR_STATUS_CODE);
|
|
20
|
+
}
|
|
21
|
+
exports.translateDmkError = translateDmkError;
|
|
22
|
+
function isDeviceExchangeError(error) {
|
|
23
|
+
return (typeof error === 'object' &&
|
|
24
|
+
error !== null &&
|
|
25
|
+
'_tag' in error &&
|
|
26
|
+
'errorCode' in error);
|
|
27
|
+
}
|
|
28
|
+
exports.isDeviceExchangeError = isDeviceExchangeError;
|
|
29
|
+
function parseHexErrorCode(errorCode) {
|
|
30
|
+
if (typeof errorCode === 'string' && /^[0-9a-fA-F]{4}$/u.test(errorCode)) {
|
|
31
|
+
return parseInt(errorCode, 16);
|
|
32
|
+
}
|
|
33
|
+
return GENERIC_ERROR_STATUS_CODE;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=dmk-error-translator.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dmk-error-translator.cjs","sourceRoot":"","sources":["../../src/dmk/dmk-error-translator.ts"],"names":[],"mappings":";;;AAAA,2EAAsE;AACtE,yDAA8D;AAE9D,MAAM,yBAAyB,GAAG,MAAM,CAAC;AAEzC;;;;;;GAMG;AACH,SAAgB,iBAAiB,CAAC,KAAc;IAC9C,IAAI,qBAAqB,CAAC,KAAK,CAAC,EAAE,CAAC;QACjC,MAAM,UAAU,GAAG,iBAAiB,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QACtD,OAAO,IAAI,mCAAoB,CAAC,UAAU,CAAC,CAAC;IAC9C,CAAC;IAED,OAAO,IAAI,mCAAoB,CAAC,yBAAyB,CAAC,CAAC;AAC7D,CAAC;AAPD,8CAOC;AAED,SAAgB,qBAAqB,CACnC,KAAc;IAEd,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,MAAM,IAAI,KAAK;QACf,WAAW,IAAI,KAAK,CACrB,CAAC;AACJ,CAAC;AATD,sDASC;AAED,SAAS,iBAAiB,CAAC,SAAkB;IAC3C,IAAI,OAAO,SAAS,KAAK,QAAQ,IAAI,mBAAmB,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;QACzE,OAAO,QAAQ,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;IACjC,CAAC;IAED,OAAO,yBAAyB,CAAC;AACnC,CAAC","sourcesContent":["import { DeviceExchangeError } from '@ledgerhq/device-management-kit';\nimport { TransportStatusError } from '@ledgerhq/hw-transport';\n\nconst GENERIC_ERROR_STATUS_CODE = 0x6f00;\n\n/**\n * Translates a DMK error (DeviceExchangeError with hex error codes) into a\n * TransportStatusError that the Ledger keyring error handler can process.\n *\n * @param error - The error from a DMK device action or command.\n * @returns A TransportStatusError with the corresponding APDU status code.\n */\nexport function translateDmkError(error: unknown): TransportStatusError {\n if (isDeviceExchangeError(error)) {\n const statusCode = parseHexErrorCode(error.errorCode);\n return new TransportStatusError(statusCode);\n }\n\n return new TransportStatusError(GENERIC_ERROR_STATUS_CODE);\n}\n\nexport function isDeviceExchangeError(\n error: unknown,\n): error is DeviceExchangeError<string> {\n return (\n typeof error === 'object' &&\n error !== null &&\n '_tag' in error &&\n 'errorCode' in error\n );\n}\n\nfunction parseHexErrorCode(errorCode: unknown): number {\n if (typeof errorCode === 'string' && /^[0-9a-fA-F]{4}$/u.test(errorCode)) {\n return parseInt(errorCode, 16);\n }\n\n return GENERIC_ERROR_STATUS_CODE;\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { DeviceExchangeError } from "@ledgerhq/device-management-kit";
|
|
2
|
+
import { TransportStatusError } from "@ledgerhq/hw-transport";
|
|
3
|
+
/**
|
|
4
|
+
* Translates a DMK error (DeviceExchangeError with hex error codes) into a
|
|
5
|
+
* TransportStatusError that the Ledger keyring error handler can process.
|
|
6
|
+
*
|
|
7
|
+
* @param error - The error from a DMK device action or command.
|
|
8
|
+
* @returns A TransportStatusError with the corresponding APDU status code.
|
|
9
|
+
*/
|
|
10
|
+
export declare function translateDmkError(error: unknown): TransportStatusError;
|
|
11
|
+
export declare function isDeviceExchangeError(error: unknown): error is DeviceExchangeError<string>;
|
|
12
|
+
//# sourceMappingURL=dmk-error-translator.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dmk-error-translator.d.cts","sourceRoot":"","sources":["../../src/dmk/dmk-error-translator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,wCAAwC;AACtE,OAAO,EAAE,oBAAoB,EAAE,+BAA+B;AAI9D;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,oBAAoB,CAOtE;AAED,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,mBAAmB,CAAC,MAAM,CAAC,CAOtC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { DeviceExchangeError } from "@ledgerhq/device-management-kit";
|
|
2
|
+
import { TransportStatusError } from "@ledgerhq/hw-transport";
|
|
3
|
+
/**
|
|
4
|
+
* Translates a DMK error (DeviceExchangeError with hex error codes) into a
|
|
5
|
+
* TransportStatusError that the Ledger keyring error handler can process.
|
|
6
|
+
*
|
|
7
|
+
* @param error - The error from a DMK device action or command.
|
|
8
|
+
* @returns A TransportStatusError with the corresponding APDU status code.
|
|
9
|
+
*/
|
|
10
|
+
export declare function translateDmkError(error: unknown): TransportStatusError;
|
|
11
|
+
export declare function isDeviceExchangeError(error: unknown): error is DeviceExchangeError<string>;
|
|
12
|
+
//# sourceMappingURL=dmk-error-translator.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dmk-error-translator.d.mts","sourceRoot":"","sources":["../../src/dmk/dmk-error-translator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,wCAAwC;AACtE,OAAO,EAAE,oBAAoB,EAAE,+BAA+B;AAI9D;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,oBAAoB,CAOtE;AAED,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,mBAAmB,CAAC,MAAM,CAAC,CAOtC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { DeviceExchangeError } from "@ledgerhq/device-management-kit";
|
|
2
|
+
import { TransportStatusError } from "@ledgerhq/hw-transport";
|
|
3
|
+
const GENERIC_ERROR_STATUS_CODE = 0x6f00;
|
|
4
|
+
/**
|
|
5
|
+
* Translates a DMK error (DeviceExchangeError with hex error codes) into a
|
|
6
|
+
* TransportStatusError that the Ledger keyring error handler can process.
|
|
7
|
+
*
|
|
8
|
+
* @param error - The error from a DMK device action or command.
|
|
9
|
+
* @returns A TransportStatusError with the corresponding APDU status code.
|
|
10
|
+
*/
|
|
11
|
+
export function translateDmkError(error) {
|
|
12
|
+
if (isDeviceExchangeError(error)) {
|
|
13
|
+
const statusCode = parseHexErrorCode(error.errorCode);
|
|
14
|
+
return new TransportStatusError(statusCode);
|
|
15
|
+
}
|
|
16
|
+
return new TransportStatusError(GENERIC_ERROR_STATUS_CODE);
|
|
17
|
+
}
|
|
18
|
+
export function isDeviceExchangeError(error) {
|
|
19
|
+
return (typeof error === 'object' &&
|
|
20
|
+
error !== null &&
|
|
21
|
+
'_tag' in error &&
|
|
22
|
+
'errorCode' in error);
|
|
23
|
+
}
|
|
24
|
+
function parseHexErrorCode(errorCode) {
|
|
25
|
+
if (typeof errorCode === 'string' && /^[0-9a-fA-F]{4}$/u.test(errorCode)) {
|
|
26
|
+
return parseInt(errorCode, 16);
|
|
27
|
+
}
|
|
28
|
+
return GENERIC_ERROR_STATUS_CODE;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=dmk-error-translator.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dmk-error-translator.mjs","sourceRoot":"","sources":["../../src/dmk/dmk-error-translator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,wCAAwC;AACtE,OAAO,EAAE,oBAAoB,EAAE,+BAA+B;AAE9D,MAAM,yBAAyB,GAAG,MAAM,CAAC;AAEzC;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAc;IAC9C,IAAI,qBAAqB,CAAC,KAAK,CAAC,EAAE,CAAC;QACjC,MAAM,UAAU,GAAG,iBAAiB,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QACtD,OAAO,IAAI,oBAAoB,CAAC,UAAU,CAAC,CAAC;IAC9C,CAAC;IAED,OAAO,IAAI,oBAAoB,CAAC,yBAAyB,CAAC,CAAC;AAC7D,CAAC;AAED,MAAM,UAAU,qBAAqB,CACnC,KAAc;IAEd,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,MAAM,IAAI,KAAK;QACf,WAAW,IAAI,KAAK,CACrB,CAAC;AACJ,CAAC;AAED,SAAS,iBAAiB,CAAC,SAAkB;IAC3C,IAAI,OAAO,SAAS,KAAK,QAAQ,IAAI,mBAAmB,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;QACzE,OAAO,QAAQ,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;IACjC,CAAC;IAED,OAAO,yBAAyB,CAAC;AACnC,CAAC","sourcesContent":["import { DeviceExchangeError } from '@ledgerhq/device-management-kit';\nimport { TransportStatusError } from '@ledgerhq/hw-transport';\n\nconst GENERIC_ERROR_STATUS_CODE = 0x6f00;\n\n/**\n * Translates a DMK error (DeviceExchangeError with hex error codes) into a\n * TransportStatusError that the Ledger keyring error handler can process.\n *\n * @param error - The error from a DMK device action or command.\n * @returns A TransportStatusError with the corresponding APDU status code.\n */\nexport function translateDmkError(error: unknown): TransportStatusError {\n if (isDeviceExchangeError(error)) {\n const statusCode = parseHexErrorCode(error.errorCode);\n return new TransportStatusError(statusCode);\n }\n\n return new TransportStatusError(GENERIC_ERROR_STATUS_CODE);\n}\n\nexport function isDeviceExchangeError(\n error: unknown,\n): error is DeviceExchangeError<string> {\n return (\n typeof error === 'object' &&\n error !== null &&\n '_tag' in error &&\n 'errorCode' in error\n );\n}\n\nfunction parseHexErrorCode(errorCode: unknown): number {\n if (typeof errorCode === 'string' && /^[0-9a-fA-F]{4}$/u.test(errorCode)) {\n return parseInt(errorCode, 16);\n }\n\n return GENERIC_ERROR_STATUS_CODE;\n}\n"]}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EthGetAppConfigurationCommand = exports.ETH_APP_COMMAND_ERROR_TAG = void 0;
|
|
4
|
+
const device_management_kit_1 = require("@ledgerhq/device-management-kit");
|
|
5
|
+
const CLA = 0xe0;
|
|
6
|
+
const INS = 0x06;
|
|
7
|
+
// Feature flags defined by the Ethereum app `getAppConfiguration` APDU spec.
|
|
8
|
+
// See: https://github.com/LedgerHQ/app-ethereum/blob/master/doc/ethapp.adoc#get-app-configuration
|
|
9
|
+
// 0x01 - arbitrary data signature enabled by user (blind signing)
|
|
10
|
+
// 0x02 - ERC 20 Token information needs to be provided externally
|
|
11
|
+
// 0x10 - Transaction Check enabled (web3 checks)
|
|
12
|
+
// 0x20 - Transaction Check Opt-In done (web3 checks opt-in)
|
|
13
|
+
const BLIND_SIGNING_FLAG = 0x01;
|
|
14
|
+
const WEB3_CHECKS_ENABLED_FLAG = 0x10;
|
|
15
|
+
const WEB3_CHECKS_OPT_IN_FLAG = 0x20;
|
|
16
|
+
const SUCCESS_STATUS_WORD_HI = 0x90;
|
|
17
|
+
const SUCCESS_STATUS_WORD_LO = 0x00;
|
|
18
|
+
/**
|
|
19
|
+
* Discriminator (`_tag`) used by `EthGetAppConfigurationCommand` when raising
|
|
20
|
+
* a {@link DeviceExchangeError}. Exported so tests and translators can
|
|
21
|
+
* reference the canonical string instead of repeating a magic literal.
|
|
22
|
+
*/
|
|
23
|
+
exports.ETH_APP_COMMAND_ERROR_TAG = 'EthAppCommandError';
|
|
24
|
+
/**
|
|
25
|
+
* Reads the Ethereum app configuration via the Ethereum application's
|
|
26
|
+
* `getAppConfiguration` APDU (CLA `0xE0`, INS `0x06`).
|
|
27
|
+
*
|
|
28
|
+
* ## Wire format
|
|
29
|
+
*
|
|
30
|
+
* Defined by the Ethereum application APDU specification
|
|
31
|
+
* ([`doc/ethapp.adoc`](https://github.com/LedgerHQ/app-ethereum/blob/master/doc/ethapp.adoc#get-app-configuration),
|
|
32
|
+
* § *GET APP CONFIGURATION*).
|
|
33
|
+
*
|
|
34
|
+
* The 4-byte response payload is laid out as:
|
|
35
|
+
*
|
|
36
|
+
* ```
|
|
37
|
+
* byte 0 flags bitmask
|
|
38
|
+
* bytes 1..3 app version (major, minor, patch)
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* The `flags` byte is defined by the spec as:
|
|
42
|
+
*
|
|
43
|
+
* ```
|
|
44
|
+
* 0x01 arbitrary data signature enabled by user (blind signing)
|
|
45
|
+
* 0x02 ERC 20 Token information needs to be provided externally
|
|
46
|
+
* 0x10 Transaction Check enabled (web3 checks)
|
|
47
|
+
* 0x20 Transaction Check Opt-In done (web3 checks opt-in)
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* This command mirrors the implementation in
|
|
51
|
+
* [`@ledgerhq/device-signer-kit-ethereum`](https://github.com/LedgerHQ/device-sdk-ts/blob/main/packages/signer/signer-eth/src/internal/app-binder/command/GetAppConfigurationCommand.ts)
|
|
52
|
+
* (`internal/app-binder/command/GetAppConfigurationCommand`), which is not
|
|
53
|
+
* re-exported from that package's public entry point. Until the signer kit
|
|
54
|
+
* exposes `GetAppConfiguration` publicly, this module is the only way to
|
|
55
|
+
* invoke the Ethereum `getAppConfiguration` APDU through the DMK
|
|
56
|
+
* `sendCommand` API.
|
|
57
|
+
*
|
|
58
|
+
* ## Related APDU docs
|
|
59
|
+
*
|
|
60
|
+
* The other Ethereum APDUs the DMK signer kit sends on our behalf are also
|
|
61
|
+
* defined in the same `ethapp.adoc` document:
|
|
62
|
+
*
|
|
63
|
+
* - `GET ETH PUBLIC ADDRESS` — INS `0x02`
|
|
64
|
+
* - `SIGN ETH TRANSACTION` — INS `0x04`
|
|
65
|
+
* - `SIGN ETH PERSONAL MESSAGE` — INS `0x08`
|
|
66
|
+
* - `SIGN ETH EIP 712` — INS `0x0C`
|
|
67
|
+
* - `SIGN EIP 7702 AUTHORIZATION` — INS `0x34`
|
|
68
|
+
*
|
|
69
|
+
* ## Distinguishing DMK commands
|
|
70
|
+
*
|
|
71
|
+
* Note: this command is distinct from the DMK OS-level
|
|
72
|
+
* [`GetAppAndVersionCommand`](https://github.com/LedgerHQ/device-sdk-ts/blob/main/packages/device-management-kit/src/api/command/os/GetAppAndVersionCommand.ts)
|
|
73
|
+
* (`@ledgerhq/device-management-kit`), which returns only the app's name and
|
|
74
|
+
* version and does not expose Ethereum-specific feature flags.
|
|
75
|
+
*/
|
|
76
|
+
class EthGetAppConfigurationCommand {
|
|
77
|
+
constructor() {
|
|
78
|
+
this.name = 'getAppConfiguration';
|
|
79
|
+
}
|
|
80
|
+
getApdu() {
|
|
81
|
+
return new device_management_kit_1.ApduBuilder({ cla: CLA, ins: INS, p1: 0, p2: 0 }).build();
|
|
82
|
+
}
|
|
83
|
+
parseResponse(response) {
|
|
84
|
+
if (!isSuccessStatusCode(response.statusCode)) {
|
|
85
|
+
return (0, device_management_kit_1.CommandResultFactory)({
|
|
86
|
+
error: createEthAppCommandError(response.statusCode),
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
const parser = new device_management_kit_1.ApduParser(response);
|
|
90
|
+
const flags = parser.extract8BitUInt();
|
|
91
|
+
if (flags === undefined) {
|
|
92
|
+
return (0, device_management_kit_1.CommandResultFactory)({
|
|
93
|
+
error: new device_management_kit_1.InvalidStatusWordError('Cannot extract config flags from response body'),
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
const major = parser.extract8BitUInt();
|
|
97
|
+
const minor = parser.extract8BitUInt();
|
|
98
|
+
const patch = parser.extract8BitUInt();
|
|
99
|
+
if (major === undefined || minor === undefined || patch === undefined) {
|
|
100
|
+
return (0, device_management_kit_1.CommandResultFactory)({
|
|
101
|
+
error: new device_management_kit_1.InvalidStatusWordError('Cannot extract version bytes from response body'),
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
return (0, device_management_kit_1.CommandResultFactory)({
|
|
105
|
+
data: {
|
|
106
|
+
blindSigningEnabled: isFlagSet(flags, BLIND_SIGNING_FLAG),
|
|
107
|
+
web3ChecksEnabled: isFlagSet(flags, WEB3_CHECKS_ENABLED_FLAG),
|
|
108
|
+
web3ChecksOptIn: isFlagSet(flags, WEB3_CHECKS_OPT_IN_FLAG),
|
|
109
|
+
version: `${major}.${minor}.${patch}`,
|
|
110
|
+
},
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
exports.EthGetAppConfigurationCommand = EthGetAppConfigurationCommand;
|
|
115
|
+
/**
|
|
116
|
+
* Test whether a single-bit flag is set in a bitmask.
|
|
117
|
+
*
|
|
118
|
+
* Per the Ethereum `getAppConfiguration` APDU spec
|
|
119
|
+
* ([ethapp.adoc](https://github.com/LedgerHQ/app-ethereum/blob/master/doc/ethapp.adoc#get-app-configuration)),
|
|
120
|
+
* each supported feature occupies one bit of the `flags` byte. The spec
|
|
121
|
+
* defines *which* bits carry meaning (`0x01`, `0x10`, `0x20`); it does not
|
|
122
|
+
* prescribe an implementation technique for testing them. Bitwise AND is
|
|
123
|
+
* the idiomatic way to test a single bit in any language, and is the
|
|
124
|
+
* same formulation used by Ledger's own
|
|
125
|
+
* [`GetAppConfiguration`](https://github.com/LedgerHQ/device-sdk-ts/blob/main/packages/signer/signer-eth/src/internal/app-binder/command/GetAppConfigurationCommand.ts)
|
|
126
|
+
* implementation upstream.
|
|
127
|
+
*
|
|
128
|
+
* @param flags - The bitmask (the first response byte).
|
|
129
|
+
* @param flag - The single-bit value to test (e.g. `0x01`, `0x10`, `0x20`).
|
|
130
|
+
* @returns `true` if the bit is set, `false` otherwise.
|
|
131
|
+
*/
|
|
132
|
+
function isFlagSet(flags, flag) {
|
|
133
|
+
// Bitwise AND is the idiomatic way to test a single-bit flag in a
|
|
134
|
+
// bitmask and matches the upstream Ledger implementation; the
|
|
135
|
+
// `ethapp.adoc` spec defines the flag *values* (0x01, 0x10, 0x20) but
|
|
136
|
+
// leaves the testing technique to the implementer.
|
|
137
|
+
// eslint-disable-next-line no-bitwise
|
|
138
|
+
return (flags & flag) !== 0;
|
|
139
|
+
}
|
|
140
|
+
function isSuccessStatusCode(statusCode) {
|
|
141
|
+
return (statusCode[0] === SUCCESS_STATUS_WORD_HI &&
|
|
142
|
+
statusCode[1] === SUCCESS_STATUS_WORD_LO);
|
|
143
|
+
}
|
|
144
|
+
function createEthAppCommandError(statusCode) {
|
|
145
|
+
const errorCode = Array.from(statusCode)
|
|
146
|
+
.map((byte) => byte.toString(16).padStart(2, '0'))
|
|
147
|
+
.join('');
|
|
148
|
+
return {
|
|
149
|
+
_tag: exports.ETH_APP_COMMAND_ERROR_TAG,
|
|
150
|
+
errorCode,
|
|
151
|
+
message: `Ledger Ethereum app command failed with status 0x${errorCode}.`,
|
|
152
|
+
originalError: undefined,
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
//# sourceMappingURL=eth-get-app-configuration-command.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eth-get-app-configuration-command.cjs","sourceRoot":"","sources":["../../src/dmk/eth-get-app-configuration-command.ts"],"names":[],"mappings":"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","sourcesContent":["import type {\n Apdu,\n ApduResponse,\n Command,\n CommandResult,\n DeviceExchangeError,\n} from '@ledgerhq/device-management-kit';\nimport {\n ApduBuilder,\n ApduParser,\n CommandResultFactory,\n InvalidStatusWordError,\n} from '@ledgerhq/device-management-kit';\n\nexport type EthGetAppConfigurationResponse = {\n readonly blindSigningEnabled: boolean;\n readonly web3ChecksEnabled: boolean;\n readonly web3ChecksOptIn: boolean;\n readonly version: string;\n};\n\nconst CLA = 0xe0;\nconst INS = 0x06;\n// Feature flags defined by the Ethereum app `getAppConfiguration` APDU spec.\n// See: https://github.com/LedgerHQ/app-ethereum/blob/master/doc/ethapp.adoc#get-app-configuration\n// 0x01 - arbitrary data signature enabled by user (blind signing)\n// 0x02 - ERC 20 Token information needs to be provided externally\n// 0x10 - Transaction Check enabled (web3 checks)\n// 0x20 - Transaction Check Opt-In done (web3 checks opt-in)\nconst BLIND_SIGNING_FLAG = 0x01;\nconst WEB3_CHECKS_ENABLED_FLAG = 0x10;\nconst WEB3_CHECKS_OPT_IN_FLAG = 0x20;\nconst SUCCESS_STATUS_WORD_HI = 0x90;\nconst SUCCESS_STATUS_WORD_LO = 0x00;\n\n/**\n * Discriminator (`_tag`) used by `EthGetAppConfigurationCommand` when raising\n * a {@link DeviceExchangeError}. Exported so tests and translators can\n * reference the canonical string instead of repeating a magic literal.\n */\nexport const ETH_APP_COMMAND_ERROR_TAG = 'EthAppCommandError';\n\n/**\n * Reads the Ethereum app configuration via the Ethereum application's\n * `getAppConfiguration` APDU (CLA `0xE0`, INS `0x06`).\n *\n * ## Wire format\n *\n * Defined by the Ethereum application APDU specification\n * ([`doc/ethapp.adoc`](https://github.com/LedgerHQ/app-ethereum/blob/master/doc/ethapp.adoc#get-app-configuration),\n * § *GET APP CONFIGURATION*).\n *\n * The 4-byte response payload is laid out as:\n *\n * ```\n * byte 0 flags bitmask\n * bytes 1..3 app version (major, minor, patch)\n * ```\n *\n * The `flags` byte is defined by the spec as:\n *\n * ```\n * 0x01 arbitrary data signature enabled by user (blind signing)\n * 0x02 ERC 20 Token information needs to be provided externally\n * 0x10 Transaction Check enabled (web3 checks)\n * 0x20 Transaction Check Opt-In done (web3 checks opt-in)\n * ```\n *\n * This command mirrors the implementation in\n * [`@ledgerhq/device-signer-kit-ethereum`](https://github.com/LedgerHQ/device-sdk-ts/blob/main/packages/signer/signer-eth/src/internal/app-binder/command/GetAppConfigurationCommand.ts)\n * (`internal/app-binder/command/GetAppConfigurationCommand`), which is not\n * re-exported from that package's public entry point. Until the signer kit\n * exposes `GetAppConfiguration` publicly, this module is the only way to\n * invoke the Ethereum `getAppConfiguration` APDU through the DMK\n * `sendCommand` API.\n *\n * ## Related APDU docs\n *\n * The other Ethereum APDUs the DMK signer kit sends on our behalf are also\n * defined in the same `ethapp.adoc` document:\n *\n * - `GET ETH PUBLIC ADDRESS` — INS `0x02`\n * - `SIGN ETH TRANSACTION` — INS `0x04`\n * - `SIGN ETH PERSONAL MESSAGE` — INS `0x08`\n * - `SIGN ETH EIP 712` — INS `0x0C`\n * - `SIGN EIP 7702 AUTHORIZATION` — INS `0x34`\n *\n * ## Distinguishing DMK commands\n *\n * Note: this command is distinct from the DMK OS-level\n * [`GetAppAndVersionCommand`](https://github.com/LedgerHQ/device-sdk-ts/blob/main/packages/device-management-kit/src/api/command/os/GetAppAndVersionCommand.ts)\n * (`@ledgerhq/device-management-kit`), which returns only the app's name and\n * version and does not expose Ethereum-specific feature flags.\n */\nexport class EthGetAppConfigurationCommand implements Command<\n EthGetAppConfigurationResponse,\n void,\n string\n> {\n readonly name = 'getAppConfiguration';\n\n getApdu(): Apdu {\n return new ApduBuilder({ cla: CLA, ins: INS, p1: 0, p2: 0 }).build();\n }\n\n parseResponse(\n response: ApduResponse,\n ): CommandResult<EthGetAppConfigurationResponse, string> {\n if (!isSuccessStatusCode(response.statusCode)) {\n return CommandResultFactory({\n error: createEthAppCommandError(response.statusCode),\n });\n }\n\n const parser = new ApduParser(response);\n\n const flags = parser.extract8BitUInt();\n if (flags === undefined) {\n return CommandResultFactory({\n error: new InvalidStatusWordError(\n 'Cannot extract config flags from response body',\n ),\n });\n }\n\n const major = parser.extract8BitUInt();\n const minor = parser.extract8BitUInt();\n const patch = parser.extract8BitUInt();\n if (major === undefined || minor === undefined || patch === undefined) {\n return CommandResultFactory({\n error: new InvalidStatusWordError(\n 'Cannot extract version bytes from response body',\n ),\n });\n }\n\n return CommandResultFactory({\n data: {\n blindSigningEnabled: isFlagSet(flags, BLIND_SIGNING_FLAG),\n web3ChecksEnabled: isFlagSet(flags, WEB3_CHECKS_ENABLED_FLAG),\n web3ChecksOptIn: isFlagSet(flags, WEB3_CHECKS_OPT_IN_FLAG),\n version: `${major}.${minor}.${patch}`,\n },\n });\n }\n}\n\n/**\n * Test whether a single-bit flag is set in a bitmask.\n *\n * Per the Ethereum `getAppConfiguration` APDU spec\n * ([ethapp.adoc](https://github.com/LedgerHQ/app-ethereum/blob/master/doc/ethapp.adoc#get-app-configuration)),\n * each supported feature occupies one bit of the `flags` byte. The spec\n * defines *which* bits carry meaning (`0x01`, `0x10`, `0x20`); it does not\n * prescribe an implementation technique for testing them. Bitwise AND is\n * the idiomatic way to test a single bit in any language, and is the\n * same formulation used by Ledger's own\n * [`GetAppConfiguration`](https://github.com/LedgerHQ/device-sdk-ts/blob/main/packages/signer/signer-eth/src/internal/app-binder/command/GetAppConfigurationCommand.ts)\n * implementation upstream.\n *\n * @param flags - The bitmask (the first response byte).\n * @param flag - The single-bit value to test (e.g. `0x01`, `0x10`, `0x20`).\n * @returns `true` if the bit is set, `false` otherwise.\n */\nfunction isFlagSet(flags: number, flag: number): boolean {\n // Bitwise AND is the idiomatic way to test a single-bit flag in a\n // bitmask and matches the upstream Ledger implementation; the\n // `ethapp.adoc` spec defines the flag *values* (0x01, 0x10, 0x20) but\n // leaves the testing technique to the implementer.\n // eslint-disable-next-line no-bitwise\n return (flags & flag) !== 0;\n}\n\nfunction isSuccessStatusCode(statusCode: Uint8Array): boolean {\n return (\n statusCode[0] === SUCCESS_STATUS_WORD_HI &&\n statusCode[1] === SUCCESS_STATUS_WORD_LO\n );\n}\n\nfunction createEthAppCommandError(\n statusCode: Uint8Array,\n): DeviceExchangeError<string> {\n const errorCode = Array.from(statusCode)\n .map((byte) => byte.toString(16).padStart(2, '0'))\n .join('');\n\n return {\n _tag: ETH_APP_COMMAND_ERROR_TAG,\n errorCode,\n message: `Ledger Ethereum app command failed with status 0x${errorCode}.`,\n originalError: undefined,\n };\n}\n"]}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { Apdu, ApduResponse, Command, CommandResult } from "@ledgerhq/device-management-kit";
|
|
2
|
+
export type EthGetAppConfigurationResponse = {
|
|
3
|
+
readonly blindSigningEnabled: boolean;
|
|
4
|
+
readonly web3ChecksEnabled: boolean;
|
|
5
|
+
readonly web3ChecksOptIn: boolean;
|
|
6
|
+
readonly version: string;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Discriminator (`_tag`) used by `EthGetAppConfigurationCommand` when raising
|
|
10
|
+
* a {@link DeviceExchangeError}. Exported so tests and translators can
|
|
11
|
+
* reference the canonical string instead of repeating a magic literal.
|
|
12
|
+
*/
|
|
13
|
+
export declare const ETH_APP_COMMAND_ERROR_TAG = "EthAppCommandError";
|
|
14
|
+
/**
|
|
15
|
+
* Reads the Ethereum app configuration via the Ethereum application's
|
|
16
|
+
* `getAppConfiguration` APDU (CLA `0xE0`, INS `0x06`).
|
|
17
|
+
*
|
|
18
|
+
* ## Wire format
|
|
19
|
+
*
|
|
20
|
+
* Defined by the Ethereum application APDU specification
|
|
21
|
+
* ([`doc/ethapp.adoc`](https://github.com/LedgerHQ/app-ethereum/blob/master/doc/ethapp.adoc#get-app-configuration),
|
|
22
|
+
* § *GET APP CONFIGURATION*).
|
|
23
|
+
*
|
|
24
|
+
* The 4-byte response payload is laid out as:
|
|
25
|
+
*
|
|
26
|
+
* ```
|
|
27
|
+
* byte 0 flags bitmask
|
|
28
|
+
* bytes 1..3 app version (major, minor, patch)
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* The `flags` byte is defined by the spec as:
|
|
32
|
+
*
|
|
33
|
+
* ```
|
|
34
|
+
* 0x01 arbitrary data signature enabled by user (blind signing)
|
|
35
|
+
* 0x02 ERC 20 Token information needs to be provided externally
|
|
36
|
+
* 0x10 Transaction Check enabled (web3 checks)
|
|
37
|
+
* 0x20 Transaction Check Opt-In done (web3 checks opt-in)
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* This command mirrors the implementation in
|
|
41
|
+
* [`@ledgerhq/device-signer-kit-ethereum`](https://github.com/LedgerHQ/device-sdk-ts/blob/main/packages/signer/signer-eth/src/internal/app-binder/command/GetAppConfigurationCommand.ts)
|
|
42
|
+
* (`internal/app-binder/command/GetAppConfigurationCommand`), which is not
|
|
43
|
+
* re-exported from that package's public entry point. Until the signer kit
|
|
44
|
+
* exposes `GetAppConfiguration` publicly, this module is the only way to
|
|
45
|
+
* invoke the Ethereum `getAppConfiguration` APDU through the DMK
|
|
46
|
+
* `sendCommand` API.
|
|
47
|
+
*
|
|
48
|
+
* ## Related APDU docs
|
|
49
|
+
*
|
|
50
|
+
* The other Ethereum APDUs the DMK signer kit sends on our behalf are also
|
|
51
|
+
* defined in the same `ethapp.adoc` document:
|
|
52
|
+
*
|
|
53
|
+
* - `GET ETH PUBLIC ADDRESS` — INS `0x02`
|
|
54
|
+
* - `SIGN ETH TRANSACTION` — INS `0x04`
|
|
55
|
+
* - `SIGN ETH PERSONAL MESSAGE` — INS `0x08`
|
|
56
|
+
* - `SIGN ETH EIP 712` — INS `0x0C`
|
|
57
|
+
* - `SIGN EIP 7702 AUTHORIZATION` — INS `0x34`
|
|
58
|
+
*
|
|
59
|
+
* ## Distinguishing DMK commands
|
|
60
|
+
*
|
|
61
|
+
* Note: this command is distinct from the DMK OS-level
|
|
62
|
+
* [`GetAppAndVersionCommand`](https://github.com/LedgerHQ/device-sdk-ts/blob/main/packages/device-management-kit/src/api/command/os/GetAppAndVersionCommand.ts)
|
|
63
|
+
* (`@ledgerhq/device-management-kit`), which returns only the app's name and
|
|
64
|
+
* version and does not expose Ethereum-specific feature flags.
|
|
65
|
+
*/
|
|
66
|
+
export declare class EthGetAppConfigurationCommand implements Command<EthGetAppConfigurationResponse, void, string> {
|
|
67
|
+
readonly name = "getAppConfiguration";
|
|
68
|
+
getApdu(): Apdu;
|
|
69
|
+
parseResponse(response: ApduResponse): CommandResult<EthGetAppConfigurationResponse, string>;
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=eth-get-app-configuration-command.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eth-get-app-configuration-command.d.cts","sourceRoot":"","sources":["../../src/dmk/eth-get-app-configuration-command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,IAAI,EACJ,YAAY,EACZ,OAAO,EACP,aAAa,EAEd,wCAAwC;AAQzC,MAAM,MAAM,8BAA8B,GAAG;IAC3C,QAAQ,CAAC,mBAAmB,EAAE,OAAO,CAAC;IACtC,QAAQ,CAAC,iBAAiB,EAAE,OAAO,CAAC;IACpC,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAC;IAClC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B,CAAC;AAgBF;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,uBAAuB,CAAC;AAE9D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,qBAAa,6BAA8B,YAAW,OAAO,CAC3D,8BAA8B,EAC9B,IAAI,EACJ,MAAM,CACP;IACC,QAAQ,CAAC,IAAI,yBAAyB;IAEtC,OAAO,IAAI,IAAI;IAIf,aAAa,CACX,QAAQ,EAAE,YAAY,GACrB,aAAa,CAAC,8BAA8B,EAAE,MAAM,CAAC;CAsCzD"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { Apdu, ApduResponse, Command, CommandResult } from "@ledgerhq/device-management-kit";
|
|
2
|
+
export type EthGetAppConfigurationResponse = {
|
|
3
|
+
readonly blindSigningEnabled: boolean;
|
|
4
|
+
readonly web3ChecksEnabled: boolean;
|
|
5
|
+
readonly web3ChecksOptIn: boolean;
|
|
6
|
+
readonly version: string;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Discriminator (`_tag`) used by `EthGetAppConfigurationCommand` when raising
|
|
10
|
+
* a {@link DeviceExchangeError}. Exported so tests and translators can
|
|
11
|
+
* reference the canonical string instead of repeating a magic literal.
|
|
12
|
+
*/
|
|
13
|
+
export declare const ETH_APP_COMMAND_ERROR_TAG = "EthAppCommandError";
|
|
14
|
+
/**
|
|
15
|
+
* Reads the Ethereum app configuration via the Ethereum application's
|
|
16
|
+
* `getAppConfiguration` APDU (CLA `0xE0`, INS `0x06`).
|
|
17
|
+
*
|
|
18
|
+
* ## Wire format
|
|
19
|
+
*
|
|
20
|
+
* Defined by the Ethereum application APDU specification
|
|
21
|
+
* ([`doc/ethapp.adoc`](https://github.com/LedgerHQ/app-ethereum/blob/master/doc/ethapp.adoc#get-app-configuration),
|
|
22
|
+
* § *GET APP CONFIGURATION*).
|
|
23
|
+
*
|
|
24
|
+
* The 4-byte response payload is laid out as:
|
|
25
|
+
*
|
|
26
|
+
* ```
|
|
27
|
+
* byte 0 flags bitmask
|
|
28
|
+
* bytes 1..3 app version (major, minor, patch)
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* The `flags` byte is defined by the spec as:
|
|
32
|
+
*
|
|
33
|
+
* ```
|
|
34
|
+
* 0x01 arbitrary data signature enabled by user (blind signing)
|
|
35
|
+
* 0x02 ERC 20 Token information needs to be provided externally
|
|
36
|
+
* 0x10 Transaction Check enabled (web3 checks)
|
|
37
|
+
* 0x20 Transaction Check Opt-In done (web3 checks opt-in)
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* This command mirrors the implementation in
|
|
41
|
+
* [`@ledgerhq/device-signer-kit-ethereum`](https://github.com/LedgerHQ/device-sdk-ts/blob/main/packages/signer/signer-eth/src/internal/app-binder/command/GetAppConfigurationCommand.ts)
|
|
42
|
+
* (`internal/app-binder/command/GetAppConfigurationCommand`), which is not
|
|
43
|
+
* re-exported from that package's public entry point. Until the signer kit
|
|
44
|
+
* exposes `GetAppConfiguration` publicly, this module is the only way to
|
|
45
|
+
* invoke the Ethereum `getAppConfiguration` APDU through the DMK
|
|
46
|
+
* `sendCommand` API.
|
|
47
|
+
*
|
|
48
|
+
* ## Related APDU docs
|
|
49
|
+
*
|
|
50
|
+
* The other Ethereum APDUs the DMK signer kit sends on our behalf are also
|
|
51
|
+
* defined in the same `ethapp.adoc` document:
|
|
52
|
+
*
|
|
53
|
+
* - `GET ETH PUBLIC ADDRESS` — INS `0x02`
|
|
54
|
+
* - `SIGN ETH TRANSACTION` — INS `0x04`
|
|
55
|
+
* - `SIGN ETH PERSONAL MESSAGE` — INS `0x08`
|
|
56
|
+
* - `SIGN ETH EIP 712` — INS `0x0C`
|
|
57
|
+
* - `SIGN EIP 7702 AUTHORIZATION` — INS `0x34`
|
|
58
|
+
*
|
|
59
|
+
* ## Distinguishing DMK commands
|
|
60
|
+
*
|
|
61
|
+
* Note: this command is distinct from the DMK OS-level
|
|
62
|
+
* [`GetAppAndVersionCommand`](https://github.com/LedgerHQ/device-sdk-ts/blob/main/packages/device-management-kit/src/api/command/os/GetAppAndVersionCommand.ts)
|
|
63
|
+
* (`@ledgerhq/device-management-kit`), which returns only the app's name and
|
|
64
|
+
* version and does not expose Ethereum-specific feature flags.
|
|
65
|
+
*/
|
|
66
|
+
export declare class EthGetAppConfigurationCommand implements Command<EthGetAppConfigurationResponse, void, string> {
|
|
67
|
+
readonly name = "getAppConfiguration";
|
|
68
|
+
getApdu(): Apdu;
|
|
69
|
+
parseResponse(response: ApduResponse): CommandResult<EthGetAppConfigurationResponse, string>;
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=eth-get-app-configuration-command.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eth-get-app-configuration-command.d.mts","sourceRoot":"","sources":["../../src/dmk/eth-get-app-configuration-command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,IAAI,EACJ,YAAY,EACZ,OAAO,EACP,aAAa,EAEd,wCAAwC;AAQzC,MAAM,MAAM,8BAA8B,GAAG;IAC3C,QAAQ,CAAC,mBAAmB,EAAE,OAAO,CAAC;IACtC,QAAQ,CAAC,iBAAiB,EAAE,OAAO,CAAC;IACpC,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAC;IAClC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B,CAAC;AAgBF;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,uBAAuB,CAAC;AAE9D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,qBAAa,6BAA8B,YAAW,OAAO,CAC3D,8BAA8B,EAC9B,IAAI,EACJ,MAAM,CACP;IACC,QAAQ,CAAC,IAAI,yBAAyB;IAEtC,OAAO,IAAI,IAAI;IAIf,aAAa,CACX,QAAQ,EAAE,YAAY,GACrB,aAAa,CAAC,8BAA8B,EAAE,MAAM,CAAC;CAsCzD"}
|