@metamask/eth-ledger-bridge-keyring 5.0.1 → 7.0.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 +21 -1
- package/dist/{index.js → index.cjs} +6 -6
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +8 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +8 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +6 -0
- package/dist/index.mjs.map +1 -0
- package/dist/{ledger-bridge.js → ledger-bridge.cjs} +1 -1
- package/dist/ledger-bridge.cjs.map +1 -0
- package/dist/{ledger-bridge.d.ts → ledger-bridge.d.cts} +3 -2
- package/dist/ledger-bridge.d.cts.map +1 -0
- package/dist/ledger-bridge.d.mts +45 -0
- package/dist/ledger-bridge.d.mts.map +1 -0
- package/dist/ledger-bridge.mjs +2 -0
- package/dist/ledger-bridge.mjs.map +1 -0
- package/dist/{ledger-hw-app.js → ledger-hw-app.cjs} +2 -1
- package/dist/ledger-hw-app.cjs.map +1 -0
- package/dist/{ledger-hw-app.d.ts → ledger-hw-app.d.cts} +3 -2
- package/dist/ledger-hw-app.d.cts.map +1 -0
- package/dist/ledger-hw-app.d.mts +24 -0
- package/dist/ledger-hw-app.d.mts.map +1 -0
- package/dist/ledger-hw-app.mjs +59 -0
- package/dist/ledger-hw-app.mjs.map +1 -0
- package/dist/{ledger-iframe-bridge.js → ledger-iframe-bridge.cjs} +2 -1
- package/dist/ledger-iframe-bridge.cjs.map +1 -0
- package/dist/{ledger-iframe-bridge.d.ts → ledger-iframe-bridge.d.cts} +2 -2
- package/dist/ledger-iframe-bridge.d.cts.map +1 -0
- package/dist/ledger-iframe-bridge.d.mts +83 -0
- package/dist/ledger-iframe-bridge.d.mts.map +1 -0
- package/dist/ledger-iframe-bridge.mjs +172 -0
- package/dist/ledger-iframe-bridge.mjs.map +1 -0
- package/dist/{ledger-keyring.js → ledger-keyring.cjs} +4 -1
- package/dist/ledger-keyring.cjs.map +1 -0
- package/dist/{ledger-keyring.d.ts → ledger-keyring.d.cts} +7 -7
- package/dist/ledger-keyring.d.cts.map +1 -0
- package/dist/ledger-keyring.d.mts +82 -0
- package/dist/ledger-keyring.d.mts.map +1 -0
- package/dist/ledger-keyring.mjs +509 -0
- package/dist/ledger-keyring.mjs.map +1 -0
- package/dist/{ledger-mobile-bridge.js → ledger-mobile-bridge.cjs} +6 -2
- package/dist/ledger-mobile-bridge.cjs.map +1 -0
- package/dist/{ledger-mobile-bridge.d.ts → ledger-mobile-bridge.d.cts} +5 -4
- package/dist/ledger-mobile-bridge.d.cts.map +1 -0
- package/dist/ledger-mobile-bridge.d.mts +109 -0
- package/dist/ledger-mobile-bridge.d.mts.map +1 -0
- package/dist/ledger-mobile-bridge.mjs +179 -0
- package/dist/ledger-mobile-bridge.mjs.map +1 -0
- package/dist/{ledger-transport-middleware.js → ledger-transport-middleware.cjs} +2 -2
- package/dist/ledger-transport-middleware.cjs.map +1 -0
- package/dist/{ledger-transport-middleware.d.ts → ledger-transport-middleware.d.cts} +3 -2
- package/dist/ledger-transport-middleware.d.cts.map +1 -0
- package/dist/ledger-transport-middleware.d.mts +40 -0
- package/dist/ledger-transport-middleware.d.mts.map +1 -0
- package/dist/ledger-transport-middleware.mjs +60 -0
- package/dist/ledger-transport-middleware.mjs.map +1 -0
- package/dist/{type.js → type.cjs} +1 -1
- package/dist/type.cjs.map +1 -0
- package/dist/{type.d.ts → type.d.cts} +1 -0
- package/dist/type.d.cts.map +1 -0
- package/dist/type.d.mts +6 -0
- package/dist/type.d.mts.map +1 -0
- package/dist/type.mjs +2 -0
- package/dist/type.mjs.map +1 -0
- package/package.json +20 -10
- package/dist/index.d.ts +0 -7
- package/dist/index.js.map +0 -1
- package/dist/ledger-bridge.js.map +0 -1
- package/dist/ledger-hw-app.js.map +0 -1
- package/dist/ledger-iframe-bridge.js.map +0 -1
- package/dist/ledger-keyring.js.map +0 -1
- package/dist/ledger-mobile-bridge.js.map +0 -1
- package/dist/ledger-transport-middleware.js.map +0 -1
- package/dist/type.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type Transport from
|
|
2
|
-
import { GetPublicKeyParams, GetPublicKeyResponse, LedgerBridge, LedgerSignMessageParams, LedgerSignMessageResponse, LedgerSignTransactionParams, LedgerSignTransactionResponse, LedgerSignTypedDataParams, LedgerSignTypedDataResponse } from
|
|
3
|
-
import { TransportMiddleware } from
|
|
4
|
-
import { GetAppNameAndVersionResponse, LedgerMobileBridgeOptions } from
|
|
1
|
+
import type Transport from "@ledgerhq/hw-transport";
|
|
2
|
+
import { GetPublicKeyParams, GetPublicKeyResponse, LedgerBridge, LedgerSignMessageParams, LedgerSignMessageResponse, LedgerSignTransactionParams, LedgerSignTransactionResponse, LedgerSignTypedDataParams, LedgerSignTypedDataResponse } from "./ledger-bridge.cjs";
|
|
3
|
+
import { TransportMiddleware } from "./ledger-transport-middleware.cjs";
|
|
4
|
+
import { GetAppNameAndVersionResponse, LedgerMobileBridgeOptions } from "./type.cjs";
|
|
5
5
|
export type MobileBridge = LedgerBridge<LedgerMobileBridgeOptions> & {
|
|
6
6
|
getAppNameAndVersion(): Promise<GetAppNameAndVersionResponse>;
|
|
7
7
|
openEthApp(): Promise<void>;
|
|
@@ -106,3 +106,4 @@ export declare class LedgerMobileBridge implements MobileBridge {
|
|
|
106
106
|
*/
|
|
107
107
|
getAppNameAndVersion(): Promise<GetAppNameAndVersionResponse>;
|
|
108
108
|
}
|
|
109
|
+
//# sourceMappingURL=ledger-mobile-bridge.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ledger-mobile-bridge.d.cts","sourceRoot":"","sources":["../src/ledger-mobile-bridge.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,SAAS,+BAA+B;AAEpD,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,YAAY,EACZ,uBAAuB,EACvB,yBAAyB,EACzB,2BAA2B,EAC3B,6BAA6B,EAC7B,yBAAyB,EACzB,2BAA2B,EAC5B,4BAAwB;AAEzB,OAAO,EAAE,mBAAmB,EAAE,0CAAsC;AACpE,OAAO,EACL,4BAA4B,EAC5B,yBAAyB,EAC1B,mBAAe;AAGhB,MAAM,MAAM,YAAY,GAAG,YAAY,CAAC,yBAAyB,CAAC,GAAG;IACnE,oBAAoB,IAAI,OAAO,CAAC,4BAA4B,CAAC,CAAC;IAC9D,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5B,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5B,CAAC;AAEF;;GAEG;AACH,qBAAa,kBAAmB,YAAW,YAAY;;IAKrD,iBAAiB,UAAS;gBAGxB,mBAAmB,EAAE,mBAAmB,EACxC,IAAI,GAAE,yBAA8B;IAMtC;;;;;OAKG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAI3B;;;OAGG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAU9B;;;;;;;;OAQG;IACG,iBAAiB,CAAC,EACtB,MAAM,EACN,OAAO,GACR,EAAE,uBAAuB,GAAG,OAAO,CAAC,yBAAyB,CAAC;IAI/D;;;;;;;;;OASG;IACG,mBAAmB,CAAC,EACxB,MAAM,EACN,kBAAkB,EAClB,oBAAoB,GACrB,EAAE,yBAAyB,GAAG,OAAO,CAAC,2BAA2B,CAAC;IAQnE;;;;;;;;OAQG;IACG,qBAAqB,CAAC,EAC1B,EAAE,EACF,MAAM,GACP,EAAE,2BAA2B,GAAG,OAAO,CAAC,6BAA6B,CAAC;IAKvE;;;;;;OAMG;IACG,YAAY,CAAC,EACjB,MAAM,GACP,EAAE,kBAAkB,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAIrD;;;;OAIG;IACG,UAAU,IAAI,OAAO,CAAC,yBAAyB,CAAC;IAItD;;;;OAIG;IACG,UAAU,CAAC,IAAI,EAAE,yBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC;IAIhE;;;;;OAKG;IACG,qBAAqB,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC;IAcnE;;;OAGG;IACG,cAAc,IAAI,OAAO,CAAC,OAAO,CAAC;IAIxC;;;OAGG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAIjC;;;OAGG;IACG,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAIhC;;;;OAIG;IACG,oBAAoB,IAAI,OAAO,CAAC,4BAA4B,CAAC;CAwBpE"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import type Transport from "@ledgerhq/hw-transport";
|
|
2
|
+
import { GetPublicKeyParams, GetPublicKeyResponse, LedgerBridge, LedgerSignMessageParams, LedgerSignMessageResponse, LedgerSignTransactionParams, LedgerSignTransactionResponse, LedgerSignTypedDataParams, LedgerSignTypedDataResponse } from "./ledger-bridge.mjs";
|
|
3
|
+
import { TransportMiddleware } from "./ledger-transport-middleware.mjs";
|
|
4
|
+
import { GetAppNameAndVersionResponse, LedgerMobileBridgeOptions } from "./type.mjs";
|
|
5
|
+
export type MobileBridge = LedgerBridge<LedgerMobileBridgeOptions> & {
|
|
6
|
+
getAppNameAndVersion(): Promise<GetAppNameAndVersionResponse>;
|
|
7
|
+
openEthApp(): Promise<void>;
|
|
8
|
+
closeApps(): Promise<void>;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* LedgerMobileBridge is a bridge between the LedgerKeyring and the LedgerTransportMiddleware.
|
|
12
|
+
*/
|
|
13
|
+
export declare class LedgerMobileBridge implements MobileBridge {
|
|
14
|
+
#private;
|
|
15
|
+
isDeviceConnected: boolean;
|
|
16
|
+
constructor(transportMiddleware: TransportMiddleware, opts?: LedgerMobileBridgeOptions);
|
|
17
|
+
/**
|
|
18
|
+
* Method to initializes the keyring.
|
|
19
|
+
* Mobile ledger doesnt not require init.
|
|
20
|
+
*
|
|
21
|
+
* @returns A promise that will resolve once the bridge is initialized.
|
|
22
|
+
*/
|
|
23
|
+
init(): Promise<void>;
|
|
24
|
+
/**
|
|
25
|
+
* Method to destroy the keyring.
|
|
26
|
+
* It will dispose the transportmiddleware and set isDeviceConnected to false.
|
|
27
|
+
*/
|
|
28
|
+
destroy(): Promise<void>;
|
|
29
|
+
/**
|
|
30
|
+
* Method to sign a string Message.
|
|
31
|
+
* Sending the string message to the device and returning the signed message.
|
|
32
|
+
*
|
|
33
|
+
* @param params - An object contains hdPath and message.
|
|
34
|
+
* @param params.hdPath - The BIP 32 path of the account.
|
|
35
|
+
* @param params.message - The message to sign.
|
|
36
|
+
* @returns Retrieve v, r, s from the signed message.
|
|
37
|
+
*/
|
|
38
|
+
deviceSignMessage({ hdPath, message, }: LedgerSignMessageParams): Promise<LedgerSignMessageResponse>;
|
|
39
|
+
/**
|
|
40
|
+
* Method to sign a EIP712 Message.
|
|
41
|
+
* Sending the typed data message to the device and returning the signed message.
|
|
42
|
+
*
|
|
43
|
+
* @param params - An object contains hdPath, domainSeparatorHex and hashStructMessageHex.
|
|
44
|
+
* @param params.hdPath - The BIP 32 path of the account.
|
|
45
|
+
* @param params.domainSeparatorHex - The domain separator.
|
|
46
|
+
* @param params.hashStructMessageHex - The hashed struct message.
|
|
47
|
+
* @returns Retrieve v, r, s from the signed message.
|
|
48
|
+
*/
|
|
49
|
+
deviceSignTypedData({ hdPath, domainSeparatorHex, hashStructMessageHex, }: LedgerSignTypedDataParams): Promise<LedgerSignTypedDataResponse>;
|
|
50
|
+
/**
|
|
51
|
+
* Method to sign a transaction
|
|
52
|
+
* Sending the hexadecimal transaction message to the device and returning the signed transaction.
|
|
53
|
+
*
|
|
54
|
+
* @param params - An object contains tx, hdPath.
|
|
55
|
+
* @param params.tx - The raw ethereum transaction in hexadecimal to sign.
|
|
56
|
+
* @param params.hdPath - The BIP 32 path of the account.
|
|
57
|
+
* @returns Retrieve v, r, s from the signed transaction.
|
|
58
|
+
*/
|
|
59
|
+
deviceSignTransaction({ tx, hdPath, }: LedgerSignTransactionParams): Promise<LedgerSignTransactionResponse>;
|
|
60
|
+
/**
|
|
61
|
+
* Method to retrieve the ethereum address for a given BIP 32 path.
|
|
62
|
+
*
|
|
63
|
+
* @param params - An object contains hdPath.
|
|
64
|
+
* @param params.hdPath - The BIP 32 path of the account.
|
|
65
|
+
* @returns An object contains publicKey, address and chainCode.
|
|
66
|
+
*/
|
|
67
|
+
getPublicKey({ hdPath, }: GetPublicKeyParams): Promise<GetPublicKeyResponse>;
|
|
68
|
+
/**
|
|
69
|
+
* Method to retrieve the current configuration.
|
|
70
|
+
*
|
|
71
|
+
* @returns Retrieve current configuration.
|
|
72
|
+
*/
|
|
73
|
+
getOptions(): Promise<LedgerMobileBridgeOptions>;
|
|
74
|
+
/**
|
|
75
|
+
* Method to set the current configuration.
|
|
76
|
+
*
|
|
77
|
+
* @param opts - An configuration object.
|
|
78
|
+
*/
|
|
79
|
+
setOptions(opts: LedgerMobileBridgeOptions): Promise<void>;
|
|
80
|
+
/**
|
|
81
|
+
* Method to set the transport object to communicate with the device.
|
|
82
|
+
*
|
|
83
|
+
* @param transport - The communication interface with the Ledger hardware wallet. There are different kind of transports based on the technology (channels like U2F, HID, Bluetooth, Webusb).
|
|
84
|
+
* @returns Retrieve boolean.
|
|
85
|
+
*/
|
|
86
|
+
updateTransportMethod(transport: Transport): Promise<boolean>;
|
|
87
|
+
/**
|
|
88
|
+
* Method to init eth app object on ledger device.
|
|
89
|
+
* This method is not supported on mobile.
|
|
90
|
+
*/
|
|
91
|
+
attemptMakeApp(): Promise<boolean>;
|
|
92
|
+
/**
|
|
93
|
+
* Method to open ethereum application on ledger device.
|
|
94
|
+
*
|
|
95
|
+
*/
|
|
96
|
+
openEthApp(): Promise<void>;
|
|
97
|
+
/**
|
|
98
|
+
* Method to close all running application on ledger device.
|
|
99
|
+
*
|
|
100
|
+
*/
|
|
101
|
+
closeApps(): Promise<void>;
|
|
102
|
+
/**
|
|
103
|
+
* Method to retrieve the name and version of the running application in ledger device.
|
|
104
|
+
*
|
|
105
|
+
* @returns An object contains appName and version.
|
|
106
|
+
*/
|
|
107
|
+
getAppNameAndVersion(): Promise<GetAppNameAndVersionResponse>;
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=ledger-mobile-bridge.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ledger-mobile-bridge.d.mts","sourceRoot":"","sources":["../src/ledger-mobile-bridge.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,SAAS,+BAA+B;AAEpD,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,YAAY,EACZ,uBAAuB,EACvB,yBAAyB,EACzB,2BAA2B,EAC3B,6BAA6B,EAC7B,yBAAyB,EACzB,2BAA2B,EAC5B,4BAAwB;AAEzB,OAAO,EAAE,mBAAmB,EAAE,0CAAsC;AACpE,OAAO,EACL,4BAA4B,EAC5B,yBAAyB,EAC1B,mBAAe;AAGhB,MAAM,MAAM,YAAY,GAAG,YAAY,CAAC,yBAAyB,CAAC,GAAG;IACnE,oBAAoB,IAAI,OAAO,CAAC,4BAA4B,CAAC,CAAC;IAC9D,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5B,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5B,CAAC;AAEF;;GAEG;AACH,qBAAa,kBAAmB,YAAW,YAAY;;IAKrD,iBAAiB,UAAS;gBAGxB,mBAAmB,EAAE,mBAAmB,EACxC,IAAI,GAAE,yBAA8B;IAMtC;;;;;OAKG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAI3B;;;OAGG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAU9B;;;;;;;;OAQG;IACG,iBAAiB,CAAC,EACtB,MAAM,EACN,OAAO,GACR,EAAE,uBAAuB,GAAG,OAAO,CAAC,yBAAyB,CAAC;IAI/D;;;;;;;;;OASG;IACG,mBAAmB,CAAC,EACxB,MAAM,EACN,kBAAkB,EAClB,oBAAoB,GACrB,EAAE,yBAAyB,GAAG,OAAO,CAAC,2BAA2B,CAAC;IAQnE;;;;;;;;OAQG;IACG,qBAAqB,CAAC,EAC1B,EAAE,EACF,MAAM,GACP,EAAE,2BAA2B,GAAG,OAAO,CAAC,6BAA6B,CAAC;IAKvE;;;;;;OAMG;IACG,YAAY,CAAC,EACjB,MAAM,GACP,EAAE,kBAAkB,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAIrD;;;;OAIG;IACG,UAAU,IAAI,OAAO,CAAC,yBAAyB,CAAC;IAItD;;;;OAIG;IACG,UAAU,CAAC,IAAI,EAAE,yBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC;IAIhE;;;;;OAKG;IACG,qBAAqB,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC;IAcnE;;;OAGG;IACG,cAAc,IAAI,OAAO,CAAC,OAAO,CAAC;IAIxC;;;OAGG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAIjC;;;OAGG;IACG,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAIhC;;;;OAIG;IACG,oBAAoB,IAAI,OAAO,CAAC,4BAA4B,CAAC;CAwBpE"}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
2
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
3
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
4
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
5
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
6
|
+
};
|
|
7
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
8
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
9
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
|
+
};
|
|
12
|
+
var _LedgerMobileBridge_instances, _LedgerMobileBridge_transportMiddleware, _LedgerMobileBridge_opts, _LedgerMobileBridge_getTransportMiddleWare, _LedgerMobileBridge_getEthApp;
|
|
13
|
+
function $importDefault(module) {
|
|
14
|
+
if (module?.__esModule) {
|
|
15
|
+
return module.default;
|
|
16
|
+
}
|
|
17
|
+
return module;
|
|
18
|
+
}
|
|
19
|
+
import $ledgerService from "@ledgerhq/hw-app-eth/lib/services/ledger/index.js";
|
|
20
|
+
const ledgerService = $importDefault($ledgerService);
|
|
21
|
+
import { GetPublicKeyParams, GetPublicKeyResponse, LedgerBridge, LedgerSignMessageParams, LedgerSignMessageResponse, LedgerSignTransactionParams, LedgerSignTransactionResponse, LedgerSignTypedDataParams, LedgerSignTypedDataResponse } from "./ledger-bridge.mjs";
|
|
22
|
+
import { MetaMaskLedgerHwAppEth } from "./ledger-hw-app.mjs";
|
|
23
|
+
import { TransportMiddleware } from "./ledger-transport-middleware.mjs";
|
|
24
|
+
import { GetAppNameAndVersionResponse, LedgerMobileBridgeOptions } from "./type.mjs";
|
|
25
|
+
/**
|
|
26
|
+
* LedgerMobileBridge is a bridge between the LedgerKeyring and the LedgerTransportMiddleware.
|
|
27
|
+
*/
|
|
28
|
+
export class LedgerMobileBridge {
|
|
29
|
+
constructor(transportMiddleware, opts = {}) {
|
|
30
|
+
_LedgerMobileBridge_instances.add(this);
|
|
31
|
+
_LedgerMobileBridge_transportMiddleware.set(this, void 0);
|
|
32
|
+
_LedgerMobileBridge_opts.set(this, void 0);
|
|
33
|
+
this.isDeviceConnected = false;
|
|
34
|
+
__classPrivateFieldSet(this, _LedgerMobileBridge_opts, opts, "f");
|
|
35
|
+
__classPrivateFieldSet(this, _LedgerMobileBridge_transportMiddleware, transportMiddleware, "f");
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Method to initializes the keyring.
|
|
39
|
+
* Mobile ledger doesnt not require init.
|
|
40
|
+
*
|
|
41
|
+
* @returns A promise that will resolve once the bridge is initialized.
|
|
42
|
+
*/
|
|
43
|
+
async init() {
|
|
44
|
+
return Promise.resolve();
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Method to destroy the keyring.
|
|
48
|
+
* It will dispose the transportmiddleware and set isDeviceConnected to false.
|
|
49
|
+
*/
|
|
50
|
+
async destroy() {
|
|
51
|
+
try {
|
|
52
|
+
await __classPrivateFieldGet(this, _LedgerMobileBridge_instances, "m", _LedgerMobileBridge_getTransportMiddleWare).call(this).dispose();
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
// eslint-disable-next-line no-console
|
|
56
|
+
console.error(error);
|
|
57
|
+
}
|
|
58
|
+
this.isDeviceConnected = false;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Method to sign a string Message.
|
|
62
|
+
* Sending the string message to the device and returning the signed message.
|
|
63
|
+
*
|
|
64
|
+
* @param params - An object contains hdPath and message.
|
|
65
|
+
* @param params.hdPath - The BIP 32 path of the account.
|
|
66
|
+
* @param params.message - The message to sign.
|
|
67
|
+
* @returns Retrieve v, r, s from the signed message.
|
|
68
|
+
*/
|
|
69
|
+
async deviceSignMessage({ hdPath, message, }) {
|
|
70
|
+
return __classPrivateFieldGet(this, _LedgerMobileBridge_instances, "m", _LedgerMobileBridge_getEthApp).call(this).signPersonalMessage(hdPath, message);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Method to sign a EIP712 Message.
|
|
74
|
+
* Sending the typed data message to the device and returning the signed message.
|
|
75
|
+
*
|
|
76
|
+
* @param params - An object contains hdPath, domainSeparatorHex and hashStructMessageHex.
|
|
77
|
+
* @param params.hdPath - The BIP 32 path of the account.
|
|
78
|
+
* @param params.domainSeparatorHex - The domain separator.
|
|
79
|
+
* @param params.hashStructMessageHex - The hashed struct message.
|
|
80
|
+
* @returns Retrieve v, r, s from the signed message.
|
|
81
|
+
*/
|
|
82
|
+
async deviceSignTypedData({ hdPath, domainSeparatorHex, hashStructMessageHex, }) {
|
|
83
|
+
return __classPrivateFieldGet(this, _LedgerMobileBridge_instances, "m", _LedgerMobileBridge_getEthApp).call(this).signEIP712HashedMessage(hdPath, domainSeparatorHex, hashStructMessageHex);
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Method to sign a transaction
|
|
87
|
+
* Sending the hexadecimal transaction message to the device and returning the signed transaction.
|
|
88
|
+
*
|
|
89
|
+
* @param params - An object contains tx, hdPath.
|
|
90
|
+
* @param params.tx - The raw ethereum transaction in hexadecimal to sign.
|
|
91
|
+
* @param params.hdPath - The BIP 32 path of the account.
|
|
92
|
+
* @returns Retrieve v, r, s from the signed transaction.
|
|
93
|
+
*/
|
|
94
|
+
async deviceSignTransaction({ tx, hdPath, }) {
|
|
95
|
+
const resolution = await ledgerService.resolveTransaction(tx, {}, {});
|
|
96
|
+
return __classPrivateFieldGet(this, _LedgerMobileBridge_instances, "m", _LedgerMobileBridge_getEthApp).call(this).signTransaction(hdPath, tx, resolution);
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Method to retrieve the ethereum address for a given BIP 32 path.
|
|
100
|
+
*
|
|
101
|
+
* @param params - An object contains hdPath.
|
|
102
|
+
* @param params.hdPath - The BIP 32 path of the account.
|
|
103
|
+
* @returns An object contains publicKey, address and chainCode.
|
|
104
|
+
*/
|
|
105
|
+
async getPublicKey({ hdPath, }) {
|
|
106
|
+
return await __classPrivateFieldGet(this, _LedgerMobileBridge_instances, "m", _LedgerMobileBridge_getEthApp).call(this).getAddress(hdPath, false, true);
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Method to retrieve the current configuration.
|
|
110
|
+
*
|
|
111
|
+
* @returns Retrieve current configuration.
|
|
112
|
+
*/
|
|
113
|
+
async getOptions() {
|
|
114
|
+
return __classPrivateFieldGet(this, _LedgerMobileBridge_opts, "f");
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Method to set the current configuration.
|
|
118
|
+
*
|
|
119
|
+
* @param opts - An configuration object.
|
|
120
|
+
*/
|
|
121
|
+
async setOptions(opts) {
|
|
122
|
+
__classPrivateFieldSet(this, _LedgerMobileBridge_opts, opts, "f");
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Method to set the transport object to communicate with the device.
|
|
126
|
+
*
|
|
127
|
+
* @param transport - The communication interface with the Ledger hardware wallet. There are different kind of transports based on the technology (channels like U2F, HID, Bluetooth, Webusb).
|
|
128
|
+
* @returns Retrieve boolean.
|
|
129
|
+
*/
|
|
130
|
+
async updateTransportMethod(transport) {
|
|
131
|
+
if (!transport.deviceModel) {
|
|
132
|
+
throw new Error('Property `deviceModel` is not defined in `transport`.');
|
|
133
|
+
}
|
|
134
|
+
if (!transport.deviceModel.id) {
|
|
135
|
+
throw new Error('Property `deviceModel.id` is not defined in `transport`.');
|
|
136
|
+
}
|
|
137
|
+
__classPrivateFieldGet(this, _LedgerMobileBridge_instances, "m", _LedgerMobileBridge_getTransportMiddleWare).call(this).setTransport(transport);
|
|
138
|
+
this.isDeviceConnected = true;
|
|
139
|
+
return Promise.resolve(true);
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Method to init eth app object on ledger device.
|
|
143
|
+
* This method is not supported on mobile.
|
|
144
|
+
*/
|
|
145
|
+
async attemptMakeApp() {
|
|
146
|
+
throw new Error('Method not supported.');
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Method to open ethereum application on ledger device.
|
|
150
|
+
*
|
|
151
|
+
*/
|
|
152
|
+
async openEthApp() {
|
|
153
|
+
await __classPrivateFieldGet(this, _LedgerMobileBridge_instances, "m", _LedgerMobileBridge_getEthApp).call(this).openEthApp();
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Method to close all running application on ledger device.
|
|
157
|
+
*
|
|
158
|
+
*/
|
|
159
|
+
async closeApps() {
|
|
160
|
+
await __classPrivateFieldGet(this, _LedgerMobileBridge_instances, "m", _LedgerMobileBridge_getEthApp).call(this).closeApps();
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Method to retrieve the name and version of the running application in ledger device.
|
|
164
|
+
*
|
|
165
|
+
* @returns An object contains appName and version.
|
|
166
|
+
*/
|
|
167
|
+
async getAppNameAndVersion() {
|
|
168
|
+
return __classPrivateFieldGet(this, _LedgerMobileBridge_instances, "m", _LedgerMobileBridge_getEthApp).call(this).getAppNameAndVersion();
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
_LedgerMobileBridge_transportMiddleware = new WeakMap(), _LedgerMobileBridge_opts = new WeakMap(), _LedgerMobileBridge_instances = new WeakSet(), _LedgerMobileBridge_getTransportMiddleWare = function _LedgerMobileBridge_getTransportMiddleWare() {
|
|
172
|
+
if (__classPrivateFieldGet(this, _LedgerMobileBridge_transportMiddleware, "f")) {
|
|
173
|
+
return __classPrivateFieldGet(this, _LedgerMobileBridge_transportMiddleware, "f");
|
|
174
|
+
}
|
|
175
|
+
throw new Error('Instance `transportMiddleware` is not initialized.');
|
|
176
|
+
}, _LedgerMobileBridge_getEthApp = function _LedgerMobileBridge_getEthApp() {
|
|
177
|
+
return __classPrivateFieldGet(this, _LedgerMobileBridge_instances, "m", _LedgerMobileBridge_getTransportMiddleWare).call(this).getEthApp();
|
|
178
|
+
};
|
|
179
|
+
//# sourceMappingURL=ledger-mobile-bridge.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ledger-mobile-bridge.mjs","sourceRoot":"","sources":["../src/ledger-mobile-bridge.ts"],"names":[],"mappings":"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","sourcesContent":["import ledgerService from '@ledgerhq/hw-app-eth/lib/services/ledger';\nimport type Transport from '@ledgerhq/hw-transport';\n\nimport {\n GetPublicKeyParams,\n GetPublicKeyResponse,\n LedgerBridge,\n LedgerSignMessageParams,\n LedgerSignMessageResponse,\n LedgerSignTransactionParams,\n LedgerSignTransactionResponse,\n LedgerSignTypedDataParams,\n LedgerSignTypedDataResponse,\n} from './ledger-bridge';\nimport { MetaMaskLedgerHwAppEth } from './ledger-hw-app';\nimport { TransportMiddleware } from './ledger-transport-middleware';\nimport {\n GetAppNameAndVersionResponse,\n LedgerMobileBridgeOptions,\n} from './type';\n\n// MobileBridge Type will always use LedgerBridge with LedgerMobileBridgeOptions\nexport type MobileBridge = LedgerBridge<LedgerMobileBridgeOptions> & {\n getAppNameAndVersion(): Promise<GetAppNameAndVersionResponse>;\n openEthApp(): Promise<void>;\n closeApps(): Promise<void>;\n};\n\n/**\n * LedgerMobileBridge is a bridge between the LedgerKeyring and the LedgerTransportMiddleware.\n */\nexport class LedgerMobileBridge implements MobileBridge {\n readonly #transportMiddleware?: TransportMiddleware;\n\n #opts: LedgerMobileBridgeOptions;\n\n isDeviceConnected = false;\n\n constructor(\n transportMiddleware: TransportMiddleware,\n opts: LedgerMobileBridgeOptions = {},\n ) {\n this.#opts = opts;\n this.#transportMiddleware = transportMiddleware;\n }\n\n /**\n * Method to initializes the keyring.\n * Mobile ledger doesnt not require init.\n *\n * @returns A promise that will resolve once the bridge is initialized.\n */\n async init(): Promise<void> {\n return Promise.resolve();\n }\n\n /**\n * Method to destroy the keyring.\n * It will dispose the transportmiddleware and set isDeviceConnected to false.\n */\n async destroy(): Promise<void> {\n try {\n await this.#getTransportMiddleWare().dispose();\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error(error);\n }\n this.isDeviceConnected = false;\n }\n\n /**\n * Method to sign a string Message.\n * Sending the string message to the device and returning the signed message.\n *\n * @param params - An object contains hdPath and message.\n * @param params.hdPath - The BIP 32 path of the account.\n * @param params.message - The message to sign.\n * @returns Retrieve v, r, s from the signed message.\n */\n async deviceSignMessage({\n hdPath,\n message,\n }: LedgerSignMessageParams): Promise<LedgerSignMessageResponse> {\n return this.#getEthApp().signPersonalMessage(hdPath, message);\n }\n\n /**\n * Method to sign a EIP712 Message.\n * Sending the typed data message to the device and returning the signed message.\n *\n * @param params - An object contains hdPath, domainSeparatorHex and hashStructMessageHex.\n * @param params.hdPath - The BIP 32 path of the account.\n * @param params.domainSeparatorHex - The domain separator.\n * @param params.hashStructMessageHex - The hashed struct message.\n * @returns Retrieve v, r, s from the signed message.\n */\n async deviceSignTypedData({\n hdPath,\n domainSeparatorHex,\n hashStructMessageHex,\n }: LedgerSignTypedDataParams): Promise<LedgerSignTypedDataResponse> {\n return this.#getEthApp().signEIP712HashedMessage(\n hdPath,\n domainSeparatorHex,\n hashStructMessageHex,\n );\n }\n\n /**\n * Method to sign a transaction\n * Sending the hexadecimal transaction message to the device and returning the signed transaction.\n *\n * @param params - An object contains tx, hdPath.\n * @param params.tx - The raw ethereum transaction in hexadecimal to sign.\n * @param params.hdPath - The BIP 32 path of the account.\n * @returns Retrieve v, r, s from the signed transaction.\n */\n async deviceSignTransaction({\n tx,\n hdPath,\n }: LedgerSignTransactionParams): Promise<LedgerSignTransactionResponse> {\n const resolution = await ledgerService.resolveTransaction(tx, {}, {});\n return this.#getEthApp().signTransaction(hdPath, tx, resolution);\n }\n\n /**\n * Method to retrieve the ethereum address for a given BIP 32 path.\n *\n * @param params - An object contains hdPath.\n * @param params.hdPath - The BIP 32 path of the account.\n * @returns An object contains publicKey, address and chainCode.\n */\n async getPublicKey({\n hdPath,\n }: GetPublicKeyParams): Promise<GetPublicKeyResponse> {\n return await this.#getEthApp().getAddress(hdPath, false, true);\n }\n\n /**\n * Method to retrieve the current configuration.\n *\n * @returns Retrieve current configuration.\n */\n async getOptions(): Promise<LedgerMobileBridgeOptions> {\n return this.#opts;\n }\n\n /**\n * Method to set the current configuration.\n *\n * @param opts - An configuration object.\n */\n async setOptions(opts: LedgerMobileBridgeOptions): Promise<void> {\n this.#opts = opts;\n }\n\n /**\n * Method to set the transport object to communicate with the device.\n *\n * @param transport - The communication interface with the Ledger hardware wallet. There are different kind of transports based on the technology (channels like U2F, HID, Bluetooth, Webusb).\n * @returns Retrieve boolean.\n */\n async updateTransportMethod(transport: Transport): Promise<boolean> {\n if (!transport.deviceModel) {\n throw new Error('Property `deviceModel` is not defined in `transport`.');\n }\n if (!transport.deviceModel.id) {\n throw new Error(\n 'Property `deviceModel.id` is not defined in `transport`.',\n );\n }\n this.#getTransportMiddleWare().setTransport(transport);\n this.isDeviceConnected = true;\n return Promise.resolve(true);\n }\n\n /**\n * Method to init eth app object on ledger device.\n * This method is not supported on mobile.\n */\n async attemptMakeApp(): Promise<boolean> {\n throw new Error('Method not supported.');\n }\n\n /**\n * Method to open ethereum application on ledger device.\n *\n */\n async openEthApp(): Promise<void> {\n await this.#getEthApp().openEthApp();\n }\n\n /**\n * Method to close all running application on ledger device.\n *\n */\n async closeApps(): Promise<void> {\n await this.#getEthApp().closeApps();\n }\n\n /**\n * Method to retrieve the name and version of the running application in ledger device.\n *\n * @returns An object contains appName and version.\n */\n async getAppNameAndVersion(): Promise<GetAppNameAndVersionResponse> {\n return this.#getEthApp().getAppNameAndVersion();\n }\n\n /**\n * Method to retrieve the transport middleWare object.\n *\n * @returns The TransportMiddleware object.\n */\n #getTransportMiddleWare(): TransportMiddleware {\n if (this.#transportMiddleware) {\n return this.#transportMiddleware;\n }\n throw new Error('Instance `transportMiddleware` is not initialized.');\n }\n\n /**\n * Method to retrieve the ledger Eth App object.\n *\n * @returns The ledger Eth App object.\n */\n #getEthApp(): MetaMaskLedgerHwAppEth {\n return this.#getTransportMiddleWare().getEthApp();\n }\n}\n"]}
|
|
@@ -13,7 +13,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
13
13
|
var _LedgerTransportMiddleware_transport;
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.LedgerTransportMiddleware = void 0;
|
|
16
|
-
const ledger_hw_app_1 = require("./ledger-hw-app");
|
|
16
|
+
const ledger_hw_app_1 = require("./ledger-hw-app.cjs");
|
|
17
17
|
/**
|
|
18
18
|
* LedgerTransportMiddleware is a middleware to communicate with the Ledger device via transport or LedgerHwAppEth
|
|
19
19
|
*/
|
|
@@ -61,4 +61,4 @@ class LedgerTransportMiddleware {
|
|
|
61
61
|
}
|
|
62
62
|
exports.LedgerTransportMiddleware = LedgerTransportMiddleware;
|
|
63
63
|
_LedgerTransportMiddleware_transport = new WeakMap();
|
|
64
|
-
//# sourceMappingURL=ledger-transport-middleware.
|
|
64
|
+
//# sourceMappingURL=ledger-transport-middleware.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ledger-transport-middleware.cjs","sourceRoot":"","sources":["../src/ledger-transport-middleware.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAEA,uDAAyD;AAUzD;;GAEG;AACH,MAAa,yBAAyB;IAAtC;QACW,gBAAW,GAAG,OAAO,CAAC;QAEtB,eAAU,GAAG,UAAU,CAAC;QAExB,sBAAiB,GAAG,OAAO,CAAC;QAErC,uDAAuB;IAuCzB,CAAC;IArCC;;OAEG;IACH,KAAK,CAAC,OAAO;QACX,MAAM,SAAS,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;QACtC,MAAM,SAAS,CAAC,KAAK,EAAE,CAAC;IAC1B,CAAC;IAED;;;;OAIG;IACH,YAAY,CAAC,SAAoB;QAC/B,uBAAA,IAAI,wCAAc,SAAS,MAAA,CAAC;IAC9B,CAAC;IAED;;;;OAIG;IACH,YAAY;QACV,IAAI,CAAC,uBAAA,IAAI,4CAAW,EAAE,CAAC;YACrB,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;QAC9D,CAAC;QACD,OAAO,uBAAA,IAAI,4CAAW,CAAC;IACzB,CAAC;IAED;;;;OAIG;IACH,SAAS;QACP,OAAO,IAAI,sCAAsB,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC;IACzD,CAAC;CACF;AA9CD,8DA8CC","sourcesContent":["import type Transport from '@ledgerhq/hw-transport';\n\nimport { MetaMaskLedgerHwAppEth } from './ledger-hw-app';\n\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\nexport interface TransportMiddleware {\n setTransport(transport: Transport): void;\n getTransport(): Transport;\n getEthApp(): MetaMaskLedgerHwAppEth;\n dispose(): Promise<void>;\n}\n\n/**\n * LedgerTransportMiddleware is a middleware to communicate with the Ledger device via transport or LedgerHwAppEth\n */\nexport class LedgerTransportMiddleware implements TransportMiddleware {\n readonly mainAppName = 'BOLOS';\n\n readonly ethAppName = 'Ethereum';\n\n readonly transportEncoding = 'ascii';\n\n #transport?: Transport;\n\n /**\n * Method to close the transport connection.\n */\n async dispose(): Promise<void> {\n const transport = this.getTransport();\n await transport.close();\n }\n\n /**\n * Method to set the transport object.\n *\n * @param transport - The transport object for communicating with a Ledger hardware wallet.\n */\n setTransport(transport: Transport): void {\n this.#transport = transport;\n }\n\n /**\n * Method to retrieve the transport object.\n *\n * @returns An generic interface for communicating with a Ledger hardware wallet.\n */\n getTransport(): Transport {\n if (!this.#transport) {\n throw new Error('Instance `transport` is not initialized.');\n }\n return this.#transport;\n }\n\n /**\n * Method to get a new instance of the eth app object.\n *\n * @returns An generic interface for communicating with a Ledger hardware wallet to perform operation.\n */\n getEthApp(): MetaMaskLedgerHwAppEth {\n return new MetaMaskLedgerHwAppEth(this.getTransport());\n }\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type Transport from
|
|
2
|
-
import { MetaMaskLedgerHwAppEth } from
|
|
1
|
+
import type Transport from "@ledgerhq/hw-transport";
|
|
2
|
+
import { MetaMaskLedgerHwAppEth } from "./ledger-hw-app.cjs";
|
|
3
3
|
export interface TransportMiddleware {
|
|
4
4
|
setTransport(transport: Transport): void;
|
|
5
5
|
getTransport(): Transport;
|
|
@@ -37,3 +37,4 @@ export declare class LedgerTransportMiddleware implements TransportMiddleware {
|
|
|
37
37
|
*/
|
|
38
38
|
getEthApp(): MetaMaskLedgerHwAppEth;
|
|
39
39
|
}
|
|
40
|
+
//# sourceMappingURL=ledger-transport-middleware.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ledger-transport-middleware.d.cts","sourceRoot":"","sources":["../src/ledger-transport-middleware.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,+BAA+B;AAEpD,OAAO,EAAE,sBAAsB,EAAE,4BAAwB;AAGzD,MAAM,WAAW,mBAAmB;IAClC,YAAY,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI,CAAC;IACzC,YAAY,IAAI,SAAS,CAAC;IAC1B,SAAS,IAAI,sBAAsB,CAAC;IACpC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1B;AAED;;GAEG;AACH,qBAAa,yBAA0B,YAAW,mBAAmB;;IACnE,QAAQ,CAAC,WAAW,WAAW;IAE/B,QAAQ,CAAC,UAAU,cAAc;IAEjC,QAAQ,CAAC,iBAAiB,WAAW;IAIrC;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAK9B;;;;OAIG;IACH,YAAY,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI;IAIxC;;;;OAIG;IACH,YAAY,IAAI,SAAS;IAOzB;;;;OAIG;IACH,SAAS,IAAI,sBAAsB;CAGpC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type Transport from "@ledgerhq/hw-transport";
|
|
2
|
+
import { MetaMaskLedgerHwAppEth } from "./ledger-hw-app.mjs";
|
|
3
|
+
export interface TransportMiddleware {
|
|
4
|
+
setTransport(transport: Transport): void;
|
|
5
|
+
getTransport(): Transport;
|
|
6
|
+
getEthApp(): MetaMaskLedgerHwAppEth;
|
|
7
|
+
dispose(): Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* LedgerTransportMiddleware is a middleware to communicate with the Ledger device via transport or LedgerHwAppEth
|
|
11
|
+
*/
|
|
12
|
+
export declare class LedgerTransportMiddleware implements TransportMiddleware {
|
|
13
|
+
#private;
|
|
14
|
+
readonly mainAppName = "BOLOS";
|
|
15
|
+
readonly ethAppName = "Ethereum";
|
|
16
|
+
readonly transportEncoding = "ascii";
|
|
17
|
+
/**
|
|
18
|
+
* Method to close the transport connection.
|
|
19
|
+
*/
|
|
20
|
+
dispose(): Promise<void>;
|
|
21
|
+
/**
|
|
22
|
+
* Method to set the transport object.
|
|
23
|
+
*
|
|
24
|
+
* @param transport - The transport object for communicating with a Ledger hardware wallet.
|
|
25
|
+
*/
|
|
26
|
+
setTransport(transport: Transport): void;
|
|
27
|
+
/**
|
|
28
|
+
* Method to retrieve the transport object.
|
|
29
|
+
*
|
|
30
|
+
* @returns An generic interface for communicating with a Ledger hardware wallet.
|
|
31
|
+
*/
|
|
32
|
+
getTransport(): Transport;
|
|
33
|
+
/**
|
|
34
|
+
* Method to get a new instance of the eth app object.
|
|
35
|
+
*
|
|
36
|
+
* @returns An generic interface for communicating with a Ledger hardware wallet to perform operation.
|
|
37
|
+
*/
|
|
38
|
+
getEthApp(): MetaMaskLedgerHwAppEth;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=ledger-transport-middleware.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ledger-transport-middleware.d.mts","sourceRoot":"","sources":["../src/ledger-transport-middleware.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,+BAA+B;AAEpD,OAAO,EAAE,sBAAsB,EAAE,4BAAwB;AAGzD,MAAM,WAAW,mBAAmB;IAClC,YAAY,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI,CAAC;IACzC,YAAY,IAAI,SAAS,CAAC;IAC1B,SAAS,IAAI,sBAAsB,CAAC;IACpC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1B;AAED;;GAEG;AACH,qBAAa,yBAA0B,YAAW,mBAAmB;;IACnE,QAAQ,CAAC,WAAW,WAAW;IAE/B,QAAQ,CAAC,UAAU,cAAc;IAEjC,QAAQ,CAAC,iBAAiB,WAAW;IAIrC;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAK9B;;;;OAIG;IACH,YAAY,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI;IAIxC;;;;OAIG;IACH,YAAY,IAAI,SAAS;IAOzB;;;;OAIG;IACH,SAAS,IAAI,sBAAsB;CAGpC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
2
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
3
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
4
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
5
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
6
|
+
};
|
|
7
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
8
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
9
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
|
+
};
|
|
12
|
+
var _LedgerTransportMiddleware_transport;
|
|
13
|
+
import { MetaMaskLedgerHwAppEth } from "./ledger-hw-app.mjs";
|
|
14
|
+
/**
|
|
15
|
+
* LedgerTransportMiddleware is a middleware to communicate with the Ledger device via transport or LedgerHwAppEth
|
|
16
|
+
*/
|
|
17
|
+
export class LedgerTransportMiddleware {
|
|
18
|
+
constructor() {
|
|
19
|
+
this.mainAppName = 'BOLOS';
|
|
20
|
+
this.ethAppName = 'Ethereum';
|
|
21
|
+
this.transportEncoding = 'ascii';
|
|
22
|
+
_LedgerTransportMiddleware_transport.set(this, void 0);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Method to close the transport connection.
|
|
26
|
+
*/
|
|
27
|
+
async dispose() {
|
|
28
|
+
const transport = this.getTransport();
|
|
29
|
+
await transport.close();
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Method to set the transport object.
|
|
33
|
+
*
|
|
34
|
+
* @param transport - The transport object for communicating with a Ledger hardware wallet.
|
|
35
|
+
*/
|
|
36
|
+
setTransport(transport) {
|
|
37
|
+
__classPrivateFieldSet(this, _LedgerTransportMiddleware_transport, transport, "f");
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Method to retrieve the transport object.
|
|
41
|
+
*
|
|
42
|
+
* @returns An generic interface for communicating with a Ledger hardware wallet.
|
|
43
|
+
*/
|
|
44
|
+
getTransport() {
|
|
45
|
+
if (!__classPrivateFieldGet(this, _LedgerTransportMiddleware_transport, "f")) {
|
|
46
|
+
throw new Error('Instance `transport` is not initialized.');
|
|
47
|
+
}
|
|
48
|
+
return __classPrivateFieldGet(this, _LedgerTransportMiddleware_transport, "f");
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Method to get a new instance of the eth app object.
|
|
52
|
+
*
|
|
53
|
+
* @returns An generic interface for communicating with a Ledger hardware wallet to perform operation.
|
|
54
|
+
*/
|
|
55
|
+
getEthApp() {
|
|
56
|
+
return new MetaMaskLedgerHwAppEth(this.getTransport());
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
_LedgerTransportMiddleware_transport = new WeakMap();
|
|
60
|
+
//# sourceMappingURL=ledger-transport-middleware.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ledger-transport-middleware.mjs","sourceRoot":"","sources":["../src/ledger-transport-middleware.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,OAAO,EAAE,sBAAsB,EAAE,4BAAwB;AAUzD;;GAEG;AACH,MAAM,OAAO,yBAAyB;IAAtC;QACW,gBAAW,GAAG,OAAO,CAAC;QAEtB,eAAU,GAAG,UAAU,CAAC;QAExB,sBAAiB,GAAG,OAAO,CAAC;QAErC,uDAAuB;IAuCzB,CAAC;IArCC;;OAEG;IACH,KAAK,CAAC,OAAO;QACX,MAAM,SAAS,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;QACtC,MAAM,SAAS,CAAC,KAAK,EAAE,CAAC;IAC1B,CAAC;IAED;;;;OAIG;IACH,YAAY,CAAC,SAAoB;QAC/B,uBAAA,IAAI,wCAAc,SAAS,MAAA,CAAC;IAC9B,CAAC;IAED;;;;OAIG;IACH,YAAY;QACV,IAAI,CAAC,uBAAA,IAAI,4CAAW,EAAE,CAAC;YACrB,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;QAC9D,CAAC;QACD,OAAO,uBAAA,IAAI,4CAAW,CAAC;IACzB,CAAC;IAED;;;;OAIG;IACH,SAAS;QACP,OAAO,IAAI,sBAAsB,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC;IACzD,CAAC;CACF","sourcesContent":["import type Transport from '@ledgerhq/hw-transport';\n\nimport { MetaMaskLedgerHwAppEth } from './ledger-hw-app';\n\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\nexport interface TransportMiddleware {\n setTransport(transport: Transport): void;\n getTransport(): Transport;\n getEthApp(): MetaMaskLedgerHwAppEth;\n dispose(): Promise<void>;\n}\n\n/**\n * LedgerTransportMiddleware is a middleware to communicate with the Ledger device via transport or LedgerHwAppEth\n */\nexport class LedgerTransportMiddleware implements TransportMiddleware {\n readonly mainAppName = 'BOLOS';\n\n readonly ethAppName = 'Ethereum';\n\n readonly transportEncoding = 'ascii';\n\n #transport?: Transport;\n\n /**\n * Method to close the transport connection.\n */\n async dispose(): Promise<void> {\n const transport = this.getTransport();\n await transport.close();\n }\n\n /**\n * Method to set the transport object.\n *\n * @param transport - The transport object for communicating with a Ledger hardware wallet.\n */\n setTransport(transport: Transport): void {\n this.#transport = transport;\n }\n\n /**\n * Method to retrieve the transport object.\n *\n * @returns An generic interface for communicating with a Ledger hardware wallet.\n */\n getTransport(): Transport {\n if (!this.#transport) {\n throw new Error('Instance `transport` is not initialized.');\n }\n return this.#transport;\n }\n\n /**\n * Method to get a new instance of the eth app object.\n *\n * @returns An generic interface for communicating with a Ledger hardware wallet to perform operation.\n */\n getEthApp(): MetaMaskLedgerHwAppEth {\n return new MetaMaskLedgerHwAppEth(this.getTransport());\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.cjs","sourceRoot":"","sources":["../src/type.ts"],"names":[],"mappings":"","sourcesContent":["export type GetAppNameAndVersionResponse = {\n appName: string;\n version: string;\n};\n\nexport type LedgerMobileBridgeOptions = Record<string, never>;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.d.cts","sourceRoot":"","sources":["../src/type.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,4BAA4B,GAAG;IACzC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC"}
|
package/dist/type.d.mts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.d.mts","sourceRoot":"","sources":["../src/type.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,4BAA4B,GAAG;IACzC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC"}
|
package/dist/type.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.mjs","sourceRoot":"","sources":["../src/type.ts"],"names":[],"mappings":"","sourcesContent":["export type GetAppNameAndVersionResponse = {\n appName: string;\n version: string;\n};\n\nexport type LedgerMobileBridgeOptions = Record<string, never>;\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metamask/eth-ledger-bridge-keyring",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0",
|
|
4
4
|
"description": "A MetaMask compatible keyring, for ledger hardware wallets",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ethereum",
|
|
@@ -18,22 +18,32 @@
|
|
|
18
18
|
},
|
|
19
19
|
"license": "ISC",
|
|
20
20
|
"author": "Bruno Barbieri",
|
|
21
|
-
"
|
|
22
|
-
|
|
21
|
+
"exports": {
|
|
22
|
+
".": {
|
|
23
|
+
"import": {
|
|
24
|
+
"types": "./dist/index.d.mts",
|
|
25
|
+
"default": "./dist/index.mjs"
|
|
26
|
+
},
|
|
27
|
+
"require": {
|
|
28
|
+
"types": "./dist/index.d.cts",
|
|
29
|
+
"default": "./dist/index.cjs"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"main": "./dist/index.cjs",
|
|
34
|
+
"types": "./dist/index.d.cts",
|
|
23
35
|
"files": [
|
|
24
36
|
"dist/"
|
|
25
37
|
],
|
|
26
38
|
"scripts": {
|
|
27
|
-
"build": "
|
|
28
|
-
"build:clean": "
|
|
39
|
+
"build": "ts-bridge --project tsconfig.build.json --no-references",
|
|
40
|
+
"build:clean": "yarn build --clean",
|
|
29
41
|
"build:docs": "typedoc",
|
|
30
|
-
"build:force": "tsc --build tsconfig.build.json --force",
|
|
31
42
|
"changelog:update": "../../scripts/update-changelog.sh @metamask/eth-ledger-bridge-keyring",
|
|
32
43
|
"changelog:validate": "../../scripts/validate-changelog.sh @metamask/eth-ledger-bridge-keyring",
|
|
33
44
|
"publish:preview": "yarn npm publish --tag preview",
|
|
34
45
|
"test": "jest && jest-it-up",
|
|
35
46
|
"test:clean": "jest --clearCache",
|
|
36
|
-
"test:verbose": "jest --verbose",
|
|
37
47
|
"test:watch": "jest --watch"
|
|
38
48
|
},
|
|
39
49
|
"dependencies": {
|
|
@@ -41,7 +51,7 @@
|
|
|
41
51
|
"@ethereumjs/tx": "^4.2.0",
|
|
42
52
|
"@ethereumjs/util": "^8.1.0",
|
|
43
53
|
"@ledgerhq/hw-app-eth": "^6.39.0",
|
|
44
|
-
"@metamask/eth-sig-util": "^
|
|
54
|
+
"@metamask/eth-sig-util": "^8.0.0",
|
|
45
55
|
"hdkey": "^2.1.0"
|
|
46
56
|
},
|
|
47
57
|
"devDependencies": {
|
|
@@ -53,6 +63,7 @@
|
|
|
53
63
|
"@ledgerhq/types-devices": "^6.25.3",
|
|
54
64
|
"@metamask/auto-changelog": "^3.4.4",
|
|
55
65
|
"@metamask/utils": "^9.2.1",
|
|
66
|
+
"@ts-bridge/cli": "^0.6.0",
|
|
56
67
|
"@types/ethereumjs-tx": "^1.0.1",
|
|
57
68
|
"@types/hdkey": "^2.0.1",
|
|
58
69
|
"@types/jest": "^29.5.12",
|
|
@@ -63,11 +74,10 @@
|
|
|
63
74
|
"ethereumjs-tx": "^1.3.7",
|
|
64
75
|
"jest": "^29.5.0",
|
|
65
76
|
"jest-it-up": "^3.1.0",
|
|
66
|
-
"rimraf": "^5.0.10",
|
|
67
77
|
"ts-jest": "^29.0.5",
|
|
68
78
|
"ts-node": "^10.9.2",
|
|
69
79
|
"typedoc": "^0.25.13",
|
|
70
|
-
"typescript": "~5.
|
|
80
|
+
"typescript": "~5.6.3"
|
|
71
81
|
},
|
|
72
82
|
"engines": {
|
|
73
83
|
"node": "^18.18 || >=20"
|
package/dist/index.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export * from './ledger-keyring';
|
|
2
|
-
export * from './ledger-iframe-bridge';
|
|
3
|
-
export * from './ledger-mobile-bridge';
|
|
4
|
-
export type * from './ledger-bridge';
|
|
5
|
-
export * from './ledger-transport-middleware';
|
|
6
|
-
export type * from './type';
|
|
7
|
-
export * from './ledger-hw-app';
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC;AACjC,yDAAuC;AACvC,yDAAuC;AAEvC,gEAA8C;AAE9C,kDAAgC","sourcesContent":["export * from './ledger-keyring';\nexport * from './ledger-iframe-bridge';\nexport * from './ledger-mobile-bridge';\nexport type * from './ledger-bridge';\nexport * from './ledger-transport-middleware';\nexport type * from './type';\nexport * from './ledger-hw-app';\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ledger-bridge.js","sourceRoot":"","sources":["../src/ledger-bridge.ts"],"names":[],"mappings":"","sourcesContent":["import type LedgerHwAppEth from '@ledgerhq/hw-app-eth';\nimport type Transport from '@ledgerhq/hw-transport';\n\nexport type GetPublicKeyParams = { hdPath: string };\nexport type GetPublicKeyResponse = Awaited<\n ReturnType<LedgerHwAppEth['getAddress']>\n>;\n\nexport type LedgerSignTransactionParams = { hdPath: string; tx: string };\nexport type LedgerSignTransactionResponse = Awaited<\n ReturnType<LedgerHwAppEth['signTransaction']>\n>;\n\nexport type LedgerSignMessageParams = { hdPath: string; message: string };\nexport type LedgerSignMessageResponse = Awaited<\n ReturnType<LedgerHwAppEth['signPersonalMessage']>\n>;\n\nexport type LedgerSignTypedDataParams = {\n hdPath: string;\n domainSeparatorHex: string;\n hashStructMessageHex: string;\n};\nexport type LedgerSignTypedDataResponse = Awaited<\n ReturnType<LedgerHwAppEth['signEIP712HashedMessage']>\n>;\n\nexport type LedgerBridgeOptions = Record<string, unknown>;\n\nexport type LedgerBridge<T extends LedgerBridgeOptions> = {\n isDeviceConnected: boolean;\n\n init(): Promise<void>;\n\n destroy(): Promise<void>;\n\n /**\n * Method to get the current configuration of the ledger bridge keyring.\n */\n getOptions(): Promise<T>;\n\n /**\n * Method to set the current configuration of the ledger bridge keyring.\n *\n * @param opts - An object contains configuration of the bridge.\n */\n setOptions(opts: T): Promise<void>;\n\n attemptMakeApp(): Promise<boolean>;\n\n updateTransportMethod(transportType: string | Transport): Promise<boolean>;\n\n getPublicKey(params: GetPublicKeyParams): Promise<GetPublicKeyResponse>;\n\n deviceSignTransaction(\n params: LedgerSignTransactionParams,\n ): Promise<LedgerSignTransactionResponse>;\n\n deviceSignMessage(\n params: LedgerSignMessageParams,\n ): Promise<LedgerSignMessageResponse>;\n\n deviceSignTypedData(\n params: LedgerSignTypedDataParams,\n ): Promise<LedgerSignTypedDataResponse>;\n};\n"]}
|