@metamask-previews/eth-trezor-keyring 3.1.0-preview-46bb5ff → 4.0.0-d5a036e

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 CHANGED
@@ -7,6 +7,35 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [4.0.0]
11
+
12
+ ### Changed
13
+
14
+ - **BREAKING**: `addAccounts` will now only return newly created accounts ([#64](https://github.com/MetaMask/accounts/pull/64))
15
+ - This keyring was initially returning every accounts (previous and new ones), which is different from what is expected in the [`Keyring` interface].(https://github.com/MetaMask/utils/blob/v9.2.1/src/keyring.ts#L65)
16
+
17
+ ## [3.1.3]
18
+
19
+ ### Changed
20
+
21
+ - Bump `sinon` and `@types/sinon` to latest versions ([#51](https://github.com/metamask/accounts/pull/51))
22
+ - Add `syncpack` and sync dependencies ([#53](https://github.com/metamask/accounts/pull/53))
23
+
24
+ ## [3.1.2]
25
+
26
+ ### Changed
27
+
28
+ - Bump `@metamask/*` and `@lavamoat/*` dependencies ([#46](https://github.com/MetaMask/accounts/pull/46))
29
+ - Move `deepmerge` and `jest-environment-jsdom` to `devDependencies` ([#44](https://github.com/MetaMask/accounts/pull/44))
30
+
31
+ ## [3.1.1]
32
+
33
+ ### Changed
34
+
35
+ - Convert to monorepo
36
+ - Package name does not change (`@metamask/eth-trezor-keyring`) and sources have been moved to: `packages/keyring-eth-trezor`.
37
+ - You can find all the changes [here](https://github.com/MetaMask/accounts/compare/6da58b4...38794aa).
38
+
10
39
  ## [3.1.0]
11
40
 
12
41
  ### Changed
@@ -98,7 +127,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
98
127
 
99
128
  - Support new versions of ethereumjs/tx ([#88](https://github.com/metamask/eth-trezor-keyring/pull/88))
100
129
 
101
- [Unreleased]: https://github.com/MetaMask/accounts/compare/@metamask/eth-trezor-keyring@3.1.0...HEAD
130
+ [Unreleased]: https://github.com/MetaMask/accounts/compare/@metamask/eth-trezor-keyring@4.0.0...HEAD
131
+ [4.0.0]: https://github.com/MetaMask/accounts/compare/@metamask/eth-trezor-keyring@3.1.3...@metamask/eth-trezor-keyring@4.0.0
132
+ [3.1.3]: https://github.com/MetaMask/accounts/compare/@metamask/eth-trezor-keyring@3.1.2...@metamask/eth-trezor-keyring@3.1.3
133
+ [3.1.2]: https://github.com/MetaMask/accounts/compare/@metamask/eth-trezor-keyring@3.1.1...@metamask/eth-trezor-keyring@3.1.2
134
+ [3.1.1]: https://github.com/MetaMask/accounts/compare/@metamask/eth-trezor-keyring@3.1.0...@metamask/eth-trezor-keyring@3.1.1
102
135
  [3.1.0]: https://github.com/MetaMask/accounts/compare/@metamask/eth-trezor-keyring@3.0.0...@metamask/eth-trezor-keyring@3.1.0
103
136
  [3.0.0]: https://github.com/MetaMask/accounts/compare/@metamask/eth-trezor-keyring@2.0.0...@metamask/eth-trezor-keyring@3.0.0
104
137
  [2.0.0]: https://github.com/MetaMask/accounts/compare/@metamask/eth-trezor-keyring@1.1.0...@metamask/eth-trezor-keyring@2.0.0
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  export * from './trezor-keyring';
2
- export * from './trezor-bridge';
2
+ export type * from './trezor-bridge';
3
3
  export * from './trezor-connect-bridge';
package/dist/index.js CHANGED
@@ -15,6 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./trezor-keyring"), exports);
18
- __exportStar(require("./trezor-bridge"), exports);
19
18
  __exportStar(require("./trezor-connect-bridge"), exports);
20
19
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC;AACjC,kDAAgC;AAChC,0DAAwC","sourcesContent":["export * from './trezor-keyring';\nexport * from './trezor-bridge';\nexport * from './trezor-connect-bridge';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC;AAEjC,0DAAwC","sourcesContent":["export * from './trezor-keyring';\nexport type * from './trezor-bridge';\nexport * from './trezor-connect-bridge';\n"]}
@@ -1,4 +1,5 @@
1
- import type { Manifest, ConnectSettings, EthereumSignTransaction, Params, EthereumSignMessage, EthereumSignTypedDataTypes, EthereumSignTypedHash } from '@trezor/connect-web';
1
+ import type { HDNodeResponse } from '@trezor/connect/lib/types/api/getPublicKey';
2
+ import type { EthereumSignedTx, PROTO, Response, Manifest, ConnectSettings, EthereumSignTransaction, Params, EthereumSignMessage, EthereumSignTypedDataTypes, EthereumSignTypedHash } from '@trezor/connect-web';
2
3
  import type { TrezorBridge } from './trezor-bridge';
3
4
  export declare class TrezorConnectBridge implements TrezorBridge {
4
5
  model?: string;
@@ -10,30 +11,8 @@ export declare class TrezorConnectBridge implements TrezorBridge {
10
11
  getPublicKey(params: {
11
12
  path: string;
12
13
  coin: string;
13
- }): import("@trezor/connect-web").Response<{
14
- xpubSegwit?: string | undefined;
15
- descriptorChecksum?: string | undefined;
16
- path: number[];
17
- serializedPath: string;
18
- childNum: number;
19
- xpub: string;
20
- chainCode: string;
21
- publicKey: string;
22
- fingerprint: number;
23
- depth: number;
24
- }>;
25
- ethereumSignTransaction(params: Params<EthereumSignTransaction>): import("@trezor/connect-web").Response<{
26
- v: string;
27
- r: string;
28
- s: string;
29
- serializedTx: string;
30
- }>;
31
- ethereumSignMessage(params: Params<EthereumSignMessage>): import("@trezor/connect-web").Response<{
32
- address: string;
33
- signature: string;
34
- }>;
35
- ethereumSignTypedData<T extends EthereumSignTypedDataTypes>(params: Params<EthereumSignTypedHash<T>>): import("@trezor/connect-web").Response<{
36
- address: string;
37
- signature: string;
38
- }>;
14
+ }): Response<HDNodeResponse>;
15
+ ethereumSignTransaction(params: Params<EthereumSignTransaction>): Response<EthereumSignedTx>;
16
+ ethereumSignMessage(params: Params<EthereumSignMessage>): Response<PROTO.MessageSignature>;
17
+ ethereumSignTypedData<T extends EthereumSignTypedDataTypes>(params: Params<EthereumSignTypedHash<T>>): Response<PROTO.EthereumTypedDataSignature>;
39
18
  }
@@ -43,7 +43,7 @@ class TrezorConnectBridge {
43
43
  await connect_web_1.default.init(settings);
44
44
  this.trezorConnectInitiated = true;
45
45
  }
46
- dispose() {
46
+ async dispose() {
47
47
  // This removes the Trezor Connect iframe from the DOM
48
48
  // This method is not well documented, but the code it calls can be seen
49
49
  // here: https://github.com/trezor/connect/blob/dec4a56af8a65a6059fb5f63fa3c6690d2c37e00/src/js/iframe/builder.js#L181
@@ -1 +1 @@
1
- {"version":3,"file":"trezor-connect-bridge.js","sourceRoot":"","sources":["../src/trezor-connect-bridge.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mEAA0E;AAY1E,MAAa,mBAAmB;IAAhC;QAGE,2BAAsB,GAAG,KAAK,CAAC;IA+CjC,CAAC;IA7CC,KAAK,CAAC,IAAI,CACR,QAE4B;QAE5B,qBAAa,CAAC,EAAE,CAAC,0BAAY,EAAE,CAAC,KAAK,EAAE,EAAE;;YACvC,IAAI,KAAK,CAAC,IAAI,KAAK,oBAAM,CAAC,OAAO,EAAE;gBACjC,OAAO;aACR;YACD,IAAI,CAAC,KAAK,GAAG,MAAA,KAAK,CAAC,OAAO,CAAC,QAAQ,0CAAE,KAAK,CAAC;QAC7C,CAAC,CAAC,CAAC;QAEH,IAAI,IAAI,CAAC,sBAAsB,EAAE;YAC/B,OAAO;SACR;QAED,MAAM,qBAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACnC,IAAI,CAAC,sBAAsB,GAAG,IAAI,CAAC;IACrC,CAAC;IAED,OAAO;QACL,sDAAsD;QACtD,wEAAwE;QACxE,sHAAsH;QACtH,qBAAa,CAAC,OAAO,EAAE,CAAC;QACxB,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;IAED,YAAY,CAAC,MAAsC;QACjD,OAAO,qBAAa,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;IAC5C,CAAC;IAED,uBAAuB,CAAC,MAAuC;QAC7D,OAAO,qBAAa,CAAC,uBAAuB,CAAC,MAAM,CAAC,CAAC;IACvD,CAAC;IAED,mBAAmB,CAAC,MAAmC;QACrD,OAAO,qBAAa,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC;IACnD,CAAC;IAED,qBAAqB,CACnB,MAAwC;QAExC,OAAO,qBAAa,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC;IACrD,CAAC;CACF;AAlDD,kDAkDC","sourcesContent":["import TrezorConnect, { DEVICE_EVENT, DEVICE } from '@trezor/connect-web';\nimport type {\n Manifest,\n ConnectSettings,\n EthereumSignTransaction,\n Params,\n EthereumSignMessage,\n EthereumSignTypedDataTypes,\n EthereumSignTypedHash,\n} from '@trezor/connect-web';\nimport type { TrezorBridge } from './trezor-bridge';\n\nexport class TrezorConnectBridge implements TrezorBridge {\n model?: string;\n\n trezorConnectInitiated = false;\n\n async init(\n settings: {\n manifest: Manifest;\n } & Partial<ConnectSettings>,\n ) {\n TrezorConnect.on(DEVICE_EVENT, (event) => {\n if (event.type !== DEVICE.CONNECT) {\n return;\n }\n this.model = event.payload.features?.model;\n });\n\n if (this.trezorConnectInitiated) {\n return;\n }\n\n await TrezorConnect.init(settings);\n this.trezorConnectInitiated = true;\n }\n\n dispose() {\n // This removes the Trezor Connect iframe from the DOM\n // This method is not well documented, but the code it calls can be seen\n // here: https://github.com/trezor/connect/blob/dec4a56af8a65a6059fb5f63fa3c6690d2c37e00/src/js/iframe/builder.js#L181\n TrezorConnect.dispose();\n return Promise.resolve();\n }\n\n getPublicKey(params: { path: string; coin: string }) {\n return TrezorConnect.getPublicKey(params);\n }\n\n ethereumSignTransaction(params: Params<EthereumSignTransaction>) {\n return TrezorConnect.ethereumSignTransaction(params);\n }\n\n ethereumSignMessage(params: Params<EthereumSignMessage>) {\n return TrezorConnect.ethereumSignMessage(params);\n }\n\n ethereumSignTypedData<T extends EthereumSignTypedDataTypes>(\n params: Params<EthereumSignTypedHash<T>>,\n ) {\n return TrezorConnect.ethereumSignTypedData(params);\n }\n}\n"]}
1
+ {"version":3,"file":"trezor-connect-bridge.js","sourceRoot":"","sources":["../src/trezor-connect-bridge.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,mEAA0E;AAgB1E,MAAa,mBAAmB;IAAhC;QAGE,2BAAsB,GAAG,KAAK,CAAC;IAsDjC,CAAC;IApDC,KAAK,CAAC,IAAI,CACR,QAE4B;QAE5B,qBAAa,CAAC,EAAE,CAAC,0BAAY,EAAE,CAAC,KAAK,EAAE,EAAE;;YACvC,IAAI,KAAK,CAAC,IAAI,KAAK,oBAAM,CAAC,OAAO,EAAE,CAAC;gBAClC,OAAO;YACT,CAAC;YACD,IAAI,CAAC,KAAK,GAAG,MAAA,KAAK,CAAC,OAAO,CAAC,QAAQ,0CAAE,KAAK,CAAC;QAC7C,CAAC,CAAC,CAAC;QAEH,IAAI,IAAI,CAAC,sBAAsB,EAAE,CAAC;YAChC,OAAO;QACT,CAAC;QAED,MAAM,qBAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACnC,IAAI,CAAC,sBAAsB,GAAG,IAAI,CAAC;IACrC,CAAC;IAED,KAAK,CAAC,OAAO;QACX,sDAAsD;QACtD,wEAAwE;QACxE,sHAAsH;QACtH,qBAAa,CAAC,OAAO,EAAE,CAAC;QACxB,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;IAED,YAAY,CAAC,MAGZ;QACC,OAAO,qBAAa,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;IAC5C,CAAC;IAED,uBAAuB,CACrB,MAAuC;QAEvC,OAAO,qBAAa,CAAC,uBAAuB,CAAC,MAAM,CAAC,CAAC;IACvD,CAAC;IAED,mBAAmB,CACjB,MAAmC;QAEnC,OAAO,qBAAa,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC;IACnD,CAAC;IAED,qBAAqB,CACnB,MAAwC;QAExC,OAAO,qBAAa,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC;IACrD,CAAC;CACF;AAzDD,kDAyDC","sourcesContent":["import type { HDNodeResponse } from '@trezor/connect/lib/types/api/getPublicKey';\nimport TrezorConnect, { DEVICE_EVENT, DEVICE } from '@trezor/connect-web';\nimport type {\n EthereumSignedTx,\n PROTO,\n Response,\n Manifest,\n ConnectSettings,\n EthereumSignTransaction,\n Params,\n EthereumSignMessage,\n EthereumSignTypedDataTypes,\n EthereumSignTypedHash,\n} from '@trezor/connect-web';\n\nimport type { TrezorBridge } from './trezor-bridge';\n\nexport class TrezorConnectBridge implements TrezorBridge {\n model?: string;\n\n trezorConnectInitiated = false;\n\n async init(\n settings: {\n manifest: Manifest;\n } & Partial<ConnectSettings>,\n ): Promise<void> {\n TrezorConnect.on(DEVICE_EVENT, (event) => {\n if (event.type !== DEVICE.CONNECT) {\n return;\n }\n this.model = event.payload.features?.model;\n });\n\n if (this.trezorConnectInitiated) {\n return;\n }\n\n await TrezorConnect.init(settings);\n this.trezorConnectInitiated = true;\n }\n\n async dispose(): Promise<void> {\n // This removes the Trezor Connect iframe from the DOM\n // This method is not well documented, but the code it calls can be seen\n // here: https://github.com/trezor/connect/blob/dec4a56af8a65a6059fb5f63fa3c6690d2c37e00/src/js/iframe/builder.js#L181\n TrezorConnect.dispose();\n return Promise.resolve();\n }\n\n getPublicKey(params: {\n path: string;\n coin: string;\n }): Response<HDNodeResponse> {\n return TrezorConnect.getPublicKey(params);\n }\n\n ethereumSignTransaction(\n params: Params<EthereumSignTransaction>,\n ): Response<EthereumSignedTx> {\n return TrezorConnect.ethereumSignTransaction(params);\n }\n\n ethereumSignMessage(\n params: Params<EthereumSignMessage>,\n ): Response<PROTO.MessageSignature> {\n return TrezorConnect.ethereumSignMessage(params);\n }\n\n ethereumSignTypedData<T extends EthereumSignTypedDataTypes>(\n params: Params<EthereumSignTypedHash<T>>,\n ): Response<PROTO.EthereumTypedDataSignature> {\n return TrezorConnect.ethereumSignTypedData(params);\n }\n}\n"]}
@@ -1,9 +1,9 @@
1
1
  /// <reference types="node" />
2
- import { EventEmitter } from 'events';
3
- import HDKey from 'hdkey';
4
2
  import type { TypedTransaction } from '@ethereumjs/tx';
5
- import type OldEthJsTransaction from 'ethereumjs-tx';
6
3
  import { TypedMessage, SignTypedDataVersion, MessageTypes } from '@metamask/eth-sig-util';
4
+ import type OldEthJsTransaction from 'ethereumjs-tx';
5
+ import { EventEmitter } from 'events';
6
+ import HDKey from 'hdkey';
7
7
  import { TrezorBridge } from './trezor-bridge';
8
8
  declare const ALLOWED_HD_PATHS: {
9
9
  readonly "m/44'/60'/0'/0": true;
@@ -14,6 +14,12 @@ export declare const TREZOR_CONNECT_MANIFEST: {
14
14
  email: string;
15
15
  appUrl: string;
16
16
  };
17
+ export type AccountPageEntry = {
18
+ address: string;
19
+ balance: number | null;
20
+ index: number;
21
+ };
22
+ export type AccountPage = AccountPageEntry[];
17
23
  export interface TrezorControllerOptions {
18
24
  hdPath?: string;
19
25
  accounts?: string[];
@@ -55,24 +61,12 @@ export declare class TrezorKeyring extends EventEmitter {
55
61
  serialize(): Promise<TrezorControllerState>;
56
62
  deserialize(opts?: TrezorControllerOptions): Promise<void>;
57
63
  isUnlocked(): boolean;
58
- unlock(): Promise<unknown>;
64
+ unlock(): Promise<string>;
59
65
  setAccountToUnlock(index: number | string): void;
60
66
  addAccounts(n?: number): Promise<readonly string[]>;
61
- getFirstPage(): Promise<{
62
- address: string;
63
- balance: number | null;
64
- index: number;
65
- }[]>;
66
- getNextPage(): Promise<{
67
- address: string;
68
- balance: number | null;
69
- index: number;
70
- }[]>;
71
- getPreviousPage(): Promise<{
72
- address: string;
73
- balance: number | null;
74
- index: number;
75
- }[]>;
67
+ getFirstPage(): Promise<AccountPage>;
68
+ getNextPage(): Promise<AccountPage>;
69
+ getPreviousPage(): Promise<AccountPage>;
76
70
  getAccounts(): Promise<string[]>;
77
71
  removeAccount(address: string): void;
78
72
  /**
@@ -86,12 +80,9 @@ export declare class TrezorKeyring extends EventEmitter {
86
80
  * @returns The signed transaction, an instance of either new-style or old-style
87
81
  * ethereumjs transaction.
88
82
  */
89
- signTransaction(address: string, tx: TypedTransaction | OldEthJsTransaction): Promise<OldEthJsTransaction | TypedTransaction>;
90
- signMessage(withAccount: string, data: string): Promise<unknown>;
91
- signPersonalMessage(withAccount: string, message: string): Promise<unknown>;
92
- /**
93
- * EIP-712 Sign Typed Data
94
- */
83
+ signTransaction(address: string, tx: TypedTransaction | OldEthJsTransaction): Promise<TypedTransaction | OldEthJsTransaction>;
84
+ signMessage(withAccount: string, data: string): Promise<string>;
85
+ signPersonalMessage(withAccount: string, message: string): Promise<string>;
95
86
  signTypedData<T extends MessageTypes>(address: string, data: TypedMessage<T>, { version }: {
96
87
  version: SignTypedDataVersion;
97
88
  }): Promise<string>;
@@ -33,11 +33,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
33
33
  var _TrezorKeyring_instances, _TrezorKeyring_getPage, _TrezorKeyring_signTransaction, _TrezorKeyring_normalize, _TrezorKeyring_addressFromIndex, _TrezorKeyring_pathFromAddress;
34
34
  Object.defineProperty(exports, "__esModule", { value: true });
35
35
  exports.TrezorKeyring = exports.TREZOR_CONNECT_MANIFEST = void 0;
36
- const events_1 = require("events");
37
- const ethUtil = __importStar(require("@ethereumjs/util"));
38
- const hdkey_1 = __importDefault(require("hdkey"));
39
36
  const tx_1 = require("@ethereumjs/tx");
37
+ const ethUtil = __importStar(require("@ethereumjs/util"));
38
+ const eth_sig_util_1 = require("@metamask/eth-sig-util");
40
39
  const connect_plugin_ethereum_1 = require("@trezor/connect-plugin-ethereum");
40
+ const events_1 = require("events");
41
+ const hdkey_1 = __importDefault(require("hdkey"));
41
42
  const hdPathString = `m/44'/60'/0'/0`;
42
43
  const SLIP0044TestnetPath = `m/44'/1'/0'/0`;
43
44
  const legacyMewPath = `m/44'/60'/0'`;
@@ -99,7 +100,7 @@ class TrezorKeyring extends events_1.EventEmitter {
99
100
  getModel() {
100
101
  return this.bridge.model;
101
102
  }
102
- init() {
103
+ async init() {
103
104
  return this.bridge.init({
104
105
  manifest: exports.TREZOR_CONNECT_MANIFEST,
105
106
  lazyLoad: true,
@@ -165,14 +166,16 @@ class TrezorKeyring extends events_1.EventEmitter {
165
166
  .then((_) => {
166
167
  const from = this.unlockedAccount;
167
168
  const to = from + n;
169
+ const newAccounts = [];
168
170
  for (let i = from; i < to; i++) {
169
171
  const address = __classPrivateFieldGet(this, _TrezorKeyring_instances, "m", _TrezorKeyring_addressFromIndex).call(this, pathBase, i);
170
172
  if (!this.accounts.includes(address)) {
171
173
  this.accounts = [...this.accounts, address];
174
+ newAccounts.push(address);
172
175
  }
173
176
  this.page = 0;
174
177
  }
175
- resolve(this.accounts);
178
+ resolve(newAccounts);
176
179
  })
177
180
  .catch((e) => {
178
181
  reject(e);
@@ -288,12 +291,10 @@ class TrezorKeyring extends events_1.EventEmitter {
288
291
  });
289
292
  });
290
293
  }
291
- /**
292
- * EIP-712 Sign Typed Data
293
- */
294
+ // EIP-712 Sign Typed Data
294
295
  async signTypedData(address, data, { version }) {
295
296
  var _a, _b;
296
- const dataWithHashes = (0, connect_plugin_ethereum_1.transformTypedData)(data, version === 'V4');
297
+ const dataWithHashes = (0, connect_plugin_ethereum_1.transformTypedData)(data, version === eth_sig_util_1.SignTypedDataVersion.V4);
297
298
  // set default values for signTypedData
298
299
  // Trezor is stricter than @metamask/eth-sig-util in what it accepts
299
300
  const { types, message = {}, domain = {}, primaryType,
@@ -313,9 +314,9 @@ class TrezorKeyring extends events_1.EventEmitter {
313
314
  domain,
314
315
  primaryType,
315
316
  },
316
- metamask_v4_compat: true,
317
+ metamask_v4_compat: true, // eslint-disable-line camelcase
317
318
  // Trezor 1 only supports blindly signing hashes
318
- domain_separator_hash,
319
+ domain_separator_hash, // eslint-disable-line camelcase
319
320
  message_hash: message_hash !== null && message_hash !== void 0 ? message_hash : '', // eslint-disable-line camelcase
320
321
  });
321
322
  if (response.success) {
@@ -1 +1 @@
1
- {"version":3,"file":"trezor-keyring.js","sourceRoot":"","sources":["../src/trezor-keyring.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAAsC;AACtC,0DAA4C;AAC5C,kDAA0B;AAM1B,uCAAoD;AAGpD,6EAAqE;AAQrE,MAAM,YAAY,GAAG,gBAAgB,CAAC;AACtC,MAAM,mBAAmB,GAAG,eAAe,CAAC;AAC5C,MAAM,aAAa,GAAG,cAAc,CAAC;AAErC,MAAM,gBAAgB,GAAG;IACvB,CAAC,YAAY,CAAC,EAAE,IAAI;IACpB,CAAC,aAAa,CAAC,EAAE,IAAI;IACrB,CAAC,mBAAmB,CAAC,EAAE,IAAI;CACnB,CAAC;AAEX,MAAM,WAAW,GAAG,iBAAiB,CAAC;AACtC,MAAM,QAAQ,GAAG,GAAG,CAAC;AACrB,MAAM,SAAS,GAAG,IAAI,CAAC;AACvB,MAAM,oBAAoB,GAAG,IAAI,CAAC;AACrB,QAAA,uBAAuB,GAAG;IACrC,KAAK,EAAE,qBAAqB;IAC5B,MAAM,EAAE,qBAAqB;CAC9B,CAAC;AAkBF,KAAK,UAAU,IAAI,CAAC,EAAU;IAC5B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAC3D,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,SAAS,sBAAsB,CAC7B,EAA0C;IAE1C,OAAO,OAAQ,EAA0B,CAAC,UAAU,KAAK,UAAU,CAAC;AACtE,CAAC;AAED,MAAa,aAAc,SAAQ,qBAAY;IAqB7C,YAAY,EAAE,MAA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M,kBAAkB,GAAG,OAAO,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;IAC9D,IAAI,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;IAC3C,IAAI,OAAO,KAAK,KAAK,WAAW,EAAE;QAChC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,EAAE,CAAC,EAAE,EAAE;YAClC,IAAI,kBAAkB,KAAK,uBAAA,IAAI,iEAAkB,MAAtB,IAAI,EAAmB,QAAQ,EAAE,CAAC,CAAC,EAAE;gBAC9D,KAAK,GAAG,CAAC,CAAC;gBACV,MAAM;aACP;SACF;KACF;IAED,IAAI,OAAO,KAAK,KAAK,WAAW,EAAE;QAChC,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;KACpC;IACD,OAAO,GAAG,IAAI,CAAC,MAAM,IAAI,KAAK,EAAE,CAAC;AACnC,CAAC;AAveM,kBAAI,GAAW,WAAW,CAAC","sourcesContent":["import { EventEmitter } from 'events';\nimport * as ethUtil from '@ethereumjs/util';\nimport HDKey from 'hdkey';\nimport type {\n EthereumTransactionEIP1559,\n EthereumSignedTx,\n EthereumTransaction,\n} from '@trezor/connect-web';\nimport { TransactionFactory } from '@ethereumjs/tx';\nimport type { TypedTransaction, TxData } from '@ethereumjs/tx';\nimport type OldEthJsTransaction from 'ethereumjs-tx';\nimport { transformTypedData } from '@trezor/connect-plugin-ethereum';\nimport {\n TypedMessage,\n SignTypedDataVersion,\n MessageTypes,\n} from '@metamask/eth-sig-util';\nimport { TrezorBridge } from './trezor-bridge';\n\nconst hdPathString = `m/44'/60'/0'/0`;\nconst SLIP0044TestnetPath = `m/44'/1'/0'/0`;\nconst legacyMewPath = `m/44'/60'/0'`;\n\nconst ALLOWED_HD_PATHS = {\n [hdPathString]: true,\n [legacyMewPath]: true,\n [SLIP0044TestnetPath]: true,\n} as const;\n\nconst keyringType = 'Trezor Hardware';\nconst pathBase = 'm';\nconst MAX_INDEX = 1000;\nconst DELAY_BETWEEN_POPUPS = 1000;\nexport const TREZOR_CONNECT_MANIFEST = {\n email: 'support@metamask.io',\n appUrl: 'https://metamask.io',\n};\n\nexport interface TrezorControllerOptions {\n hdPath?: string;\n accounts?: string[];\n page?: number;\n perPage?: number;\n}\n\nexport interface TrezorControllerState {\n hdPath: string;\n accounts: readonly string[];\n page: number;\n paths: Record<string, number>;\n perPage: number;\n unlockedAccount: number;\n}\n\nasync function wait(ms: number) {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\n/**\n * Check if the given transaction is made with ethereumjs-tx or @ethereumjs/tx\n *\n * Transactions built with older versions of ethereumjs-tx have a\n * getChainId method that newer versions do not.\n * Older versions are mutable\n * while newer versions default to being immutable.\n * Expected shape and type\n * of data for v, r and s differ (Buffer (old) vs BN (new)).\n *\n * @param tx\n * @returns Returns `true` if tx is an old-style ethereumjs-tx transaction.\n */\nfunction isOldStyleEthereumjsTx(\n tx: TypedTransaction | OldEthJsTransaction,\n): tx is OldEthJsTransaction {\n return typeof (tx as OldEthJsTransaction).getChainId === 'function';\n}\n\nexport class TrezorKeyring extends EventEmitter {\n static type: string = keyringType;\n\n readonly type: string = keyringType;\n\n accounts: readonly string[] = [];\n\n hdk: HDKey = new HDKey();\n\n hdPath: string = hdPathString;\n\n page = 0;\n\n perPage = 5;\n\n unlockedAccount = 0;\n\n paths: Record<string, number> = {};\n\n bridge: TrezorBridge;\n\n constructor({ bridge }: { bridge: TrezorBridge }) {\n super();\n\n if (!bridge) {\n throw new Error('Bridge is a required dependency for the keyring');\n }\n\n this.bridge = bridge;\n }\n\n /**\n * Gets the model, if known.\n * This may be `undefined` if the model hasn't been loaded yet.\n *\n * @returns\n */\n getModel(): string | undefined {\n return this.bridge.model;\n }\n\n init() {\n return this.bridge.init({\n manifest: TREZOR_CONNECT_MANIFEST,\n lazyLoad: true,\n });\n }\n\n async destroy() {\n return this.bridge.dispose();\n }\n\n async serialize(): Promise<TrezorControllerState> {\n return Promise.resolve({\n hdPath: this.hdPath,\n accounts: this.accounts,\n page: this.page,\n paths: this.paths,\n perPage: this.perPage,\n unlockedAccount: this.unlockedAccount,\n });\n }\n\n async deserialize(opts: TrezorControllerOptions = {}) {\n this.hdPath = opts.hdPath ?? hdPathString;\n this.accounts = opts.accounts ?? [];\n this.page = opts.page ?? 0;\n this.perPage = opts.perPage ?? 5;\n return Promise.resolve();\n }\n\n isUnlocked() {\n return Boolean(this.hdk?.publicKey);\n }\n\n async unlock() {\n if (this.isUnlocked()) {\n return Promise.resolve('already unlocked');\n }\n return new Promise((resolve, reject) => {\n this.bridge\n .getPublicKey({\n path: this.hdPath,\n coin: 'ETH',\n })\n .then((response) => {\n if (response.success) {\n this.hdk.publicKey = Buffer.from(response.payload.publicKey, 'hex');\n this.hdk.chainCode = Buffer.from(response.payload.chainCode, 'hex');\n resolve('just unlocked');\n } else {\n reject(new Error(response.payload?.error || 'Unknown error'));\n }\n })\n .catch((e) => {\n reject(new Error(e?.toString() || 'Unknown error'));\n });\n });\n }\n\n setAccountToUnlock(index: number | string) {\n this.unlockedAccount = parseInt(String(index), 10);\n }\n\n async addAccounts(n = 1): Promise<readonly string[]> {\n return new Promise((resolve, reject) => {\n this.unlock()\n .then((_) => {\n const from = this.unlockedAccount;\n const to = from + n;\n\n for (let i = from; i < to; i++) {\n const address = this.#addressFromIndex(pathBase, i);\n if (!this.accounts.includes(address)) {\n this.accounts = [...this.accounts, address];\n }\n this.page = 0;\n }\n resolve(this.accounts);\n })\n .catch((e) => {\n reject(e);\n });\n });\n }\n\n async getFirstPage() {\n this.page = 0;\n return this.#getPage(1);\n }\n\n async getNextPage() {\n return this.#getPage(1);\n }\n\n async getPreviousPage() {\n return this.#getPage(-1);\n }\n\n async #getPage(\n increment: number,\n ): Promise<{ address: string; balance: number | null; index: number }[]> {\n this.page += increment;\n\n if (this.page <= 0) {\n this.page = 1;\n }\n\n return new Promise((resolve, reject) => {\n this.unlock()\n .then((_) => {\n const from = (this.page - 1) * this.perPage;\n const to = from + this.perPage;\n\n const accounts = [];\n\n for (let i = from; i < to; i++) {\n const address = this.#addressFromIndex(pathBase, i);\n accounts.push({\n address,\n balance: null,\n index: i,\n });\n this.paths[ethUtil.toChecksumAddress(address)] = i;\n }\n resolve(accounts);\n })\n .catch((e) => {\n reject(e);\n });\n });\n }\n\n async getAccounts() {\n return Promise.resolve(this.accounts.slice());\n }\n\n removeAccount(address: string) {\n if (\n !this.accounts.map((a) => a.toLowerCase()).includes(address.toLowerCase())\n ) {\n throw new Error(`Address ${address} not found in this keyring`);\n }\n\n this.accounts = this.accounts.filter(\n (a) => a.toLowerCase() !== address.toLowerCase(),\n );\n }\n\n /**\n * Signs a transaction using Trezor.\n *\n * Accepts either an ethereumjs-tx or @ethereumjs/tx transaction, and returns\n * the same type.\n *\n * @param address - Hex string address.\n * @param tx - Instance of either new-style or old-style ethereumjs transaction.\n * @returns The signed transaction, an instance of either new-style or old-style\n * ethereumjs transaction.\n */\n async signTransaction(\n address: string,\n tx: TypedTransaction | OldEthJsTransaction,\n ) {\n if (isOldStyleEthereumjsTx(tx)) {\n // In this version of ethereumjs-tx we must add the chainId in hex format\n // to the initial v value. The chainId must be included in the serialized\n // transaction which is only communicated to ethereumjs-tx in this\n // value. In newer versions the chainId is communicated via the 'Common'\n // object.\n return this.#signTransaction(\n address,\n // @types/ethereumjs-tx and old ethereumjs-tx versions document\n // this function return value as Buffer, but the actual\n // Transaction._chainId will always be a number.\n // See https://github.com/ethereumjs/ethereumjs-tx/blob/v1.3.7/index.js#L126\n tx.getChainId() as unknown as number,\n tx,\n (payload) => {\n tx.v = Buffer.from(payload.v, 'hex');\n tx.r = Buffer.from(payload.r, 'hex');\n tx.s = Buffer.from(payload.s, 'hex');\n return tx;\n },\n );\n }\n return this.#signTransaction(\n address,\n Number(tx.common.chainId()),\n tx,\n (payload) => {\n // Because tx will be immutable, first get a plain javascript object that\n // represents the transaction. Using txData here as it aligns with the\n // nomenclature of ethereumjs/tx.\n const txData: TxData = tx.toJSON();\n // The fromTxData utility expects a type to support transactions with a type other than 0\n txData.type = tx.type;\n // The fromTxData utility expects v,r and s to be hex prefixed\n txData.v = ethUtil.addHexPrefix(payload.v);\n txData.r = ethUtil.addHexPrefix(payload.r);\n txData.s = ethUtil.addHexPrefix(payload.s);\n // Adopt the 'common' option from the original transaction and set the\n // returned object to be frozen if the original is frozen.\n return TransactionFactory.fromTxData(txData, {\n common: tx.common,\n freeze: Object.isFrozen(tx),\n });\n },\n );\n }\n\n /**\n *\n * @param address - Hex string address.\n * @param chainId - Chain ID\n * @param tx - Instance of either new-style or old-style ethereumjs transaction.\n * @param handleSigning - Converts signed transaction\n * to the same new-style or old-style ethereumjs-tx.\n * @returns The signed transaction, an instance of either new-style or old-style\n * ethereumjs transaction.\n */\n async #signTransaction<T extends TypedTransaction | OldEthJsTransaction>(\n address: string,\n chainId: number,\n tx: T,\n handleSigning: (tx: EthereumSignedTx) => T,\n ): Promise<T> {\n let transaction: EthereumTransaction | EthereumTransactionEIP1559;\n if (isOldStyleEthereumjsTx(tx)) {\n // legacy transaction from ethereumjs-tx package has no .toJSON() function,\n // so we need to convert to hex-strings manually manually\n transaction = {\n to: this.#normalize(tx.to),\n value: this.#normalize(tx.value),\n data: this.#normalize(tx.data),\n chainId,\n nonce: this.#normalize(tx.nonce),\n gasLimit: this.#normalize(tx.gasLimit),\n gasPrice: this.#normalize(tx.gasPrice),\n };\n } else {\n // new-style transaction from @ethereumjs/tx package\n // we can just copy tx.toJSON() for everything except chainId, which must be a number\n transaction = {\n ...tx.toJSON(),\n chainId,\n to: this.#normalize(ethUtil.toBuffer(tx.to)),\n } as EthereumTransaction | EthereumTransactionEIP1559;\n }\n\n try {\n const status = await this.unlock();\n await wait(status === 'just unlocked' ? DELAY_BETWEEN_POPUPS : 0);\n const response = await this.bridge.ethereumSignTransaction({\n path: this.#pathFromAddress(address),\n transaction,\n });\n if (response.success) {\n const newOrMutatedTx = handleSigning(response.payload);\n\n const addressSignedWith = ethUtil.toChecksumAddress(\n ethUtil.addHexPrefix(\n newOrMutatedTx.getSenderAddress().toString('hex'),\n ),\n );\n const correctAddress = ethUtil.toChecksumAddress(address);\n if (addressSignedWith !== correctAddress) {\n throw new Error(\"signature doesn't match the right address\");\n }\n\n return newOrMutatedTx;\n }\n throw new Error(response.payload?.error || 'Unknown error');\n } catch (e) {\n throw new Error(e?.toString() ?? 'Unknown error');\n }\n }\n\n async signMessage(withAccount: string, data: string) {\n return this.signPersonalMessage(withAccount, data);\n }\n\n // For personal_sign, we need to prefix the message:\n async signPersonalMessage(withAccount: string, message: string) {\n return new Promise((resolve, reject) => {\n this.unlock()\n .then((status) => {\n setTimeout(\n () => {\n this.bridge\n .ethereumSignMessage({\n path: this.#pathFromAddress(withAccount),\n message: ethUtil.stripHexPrefix(message),\n hex: true,\n })\n .then((response) => {\n if (response.success) {\n if (\n response.payload.address !==\n ethUtil.toChecksumAddress(withAccount)\n ) {\n reject(\n new Error('signature doesnt match the right address'),\n );\n }\n const signature = `0x${response.payload.signature}`;\n resolve(signature);\n } else {\n reject(\n new Error(response.payload?.error || 'Unknown error'),\n );\n }\n })\n .catch((e) => {\n reject(new Error(e?.toString() || 'Unknown error'));\n });\n // This is necessary to avoid popup collision\n // between the unlock & sign trezor popups\n },\n status === 'just unlocked' ? DELAY_BETWEEN_POPUPS : 0,\n );\n })\n .catch((e) => {\n reject(new Error(e?.toString() || 'Unknown error'));\n });\n });\n }\n\n /**\n * EIP-712 Sign Typed Data\n */\n async signTypedData<T extends MessageTypes>(\n address: string,\n data: TypedMessage<T>,\n { version }: { version: SignTypedDataVersion },\n ) {\n const dataWithHashes = transformTypedData(data, version === 'V4');\n\n // set default values for signTypedData\n // Trezor is stricter than @metamask/eth-sig-util in what it accepts\n const {\n types,\n message = {},\n domain = {},\n primaryType,\n // snake_case since Trezor uses Protobuf naming conventions here\n domain_separator_hash, // eslint-disable-line camelcase\n message_hash, // eslint-disable-line camelcase\n } = dataWithHashes;\n\n // This is necessary to avoid popup collision\n // between the unlock & sign trezor popups\n const status = await this.unlock();\n await wait(status === 'just unlocked' ? DELAY_BETWEEN_POPUPS : 0);\n\n const response = await this.bridge.ethereumSignTypedData({\n path: this.#pathFromAddress(address),\n data: {\n types: { ...types, EIP712Domain: types.EIP712Domain ?? [] },\n message,\n domain,\n primaryType,\n },\n metamask_v4_compat: true, // eslint-disable-line camelcase\n // Trezor 1 only supports blindly signing hashes\n domain_separator_hash, // eslint-disable-line camelcase\n message_hash: message_hash ?? '', // eslint-disable-line camelcase\n });\n\n if (response.success) {\n if (ethUtil.toChecksumAddress(address) !== response.payload.address) {\n throw new Error('signature doesnt match the right address');\n }\n return response.payload.signature;\n }\n\n throw new Error(response.payload?.error || 'Unknown error');\n }\n\n async exportAccount() {\n return Promise.reject(new Error('Not supported on this device'));\n }\n\n forgetDevice() {\n this.accounts = [];\n this.hdk = new HDKey();\n this.page = 0;\n this.unlockedAccount = 0;\n this.paths = {};\n }\n\n /**\n * Set the HD path to be used by the keyring. Only known supported HD paths are allowed.\n *\n * If the given HD path is already the current HD path, nothing happens. Otherwise the new HD\n * path is set, and the wallet state is completely reset.\n *\n * @throws {Error] Throws if the HD path is not supported.\n *\n * @param hdPath - The HD path to set.\n */\n setHdPath(hdPath: keyof typeof ALLOWED_HD_PATHS) {\n if (!ALLOWED_HD_PATHS[hdPath]) {\n throw new Error(\n `The setHdPath method does not support setting HD Path to ${hdPath}`,\n );\n }\n\n // Reset HDKey if the path changes\n if (this.hdPath !== hdPath) {\n this.hdk = new HDKey();\n this.accounts = [];\n this.page = 0;\n this.perPage = 5;\n this.unlockedAccount = 0;\n this.paths = {};\n }\n this.hdPath = hdPath;\n }\n\n #normalize(buf: Buffer) {\n return ethUtil.bufferToHex(buf).toString();\n }\n\n #addressFromIndex(basePath: string, i: number) {\n const dkey = this.hdk.derive(`${basePath}/${i}`);\n const address = ethUtil\n .publicToAddress(dkey.publicKey, true)\n .toString('hex');\n return ethUtil.toChecksumAddress(`0x${address}`);\n }\n\n #pathFromAddress(address: string) {\n const checksummedAddress = ethUtil.toChecksumAddress(address);\n let index = this.paths[checksummedAddress];\n if (typeof index === 'undefined') {\n for (let i = 0; i < MAX_INDEX; i++) {\n if (checksummedAddress === this.#addressFromIndex(pathBase, i)) {\n index = i;\n break;\n }\n }\n }\n\n if (typeof index === 'undefined') {\n throw new Error('Unknown address');\n }\n return `${this.hdPath}/${index}`;\n }\n}\n"]}
1
+ {"version":3,"file":"trezor-keyring.js","sourceRoot":"","sources":["../src/trezor-keyring.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAoD;AAEpD,0DAA4C;AAC5C,yDAIgC;AAChC,6EAAqE;AAOrE,mCAAsC;AACtC,kDAA0B;AAI1B,MAAM,YAAY,GAAG,gBAAgB,CAAC;AACtC,MAAM,mBAAmB,GAAG,eAAe,CAAC;AAC5C,MAAM,aAAa,GAAG,cAAc,CAAC;AAErC,MAAM,gBAAgB,GAAG;IACvB,CAAC,YAAY,CAAC,EAAE,IAAI;IACpB,CAAC,aAAa,CAAC,EAAE,IAAI;IACrB,CAAC,mBAAmB,CAAC,EAAE,IAAI;CACnB,CAAC;AAEX,MAAM,WAAW,GAAG,iBAAiB,CAAC;AACtC,MAAM,QAAQ,GAAG,GAAG,CAAC;AACrB,MAAM,SAAS,GAAG,IAAI,CAAC;AACvB,MAAM,oBAAoB,GAAG,IAAI,CAAC;AACrB,QAAA,uBAAuB,GAAG;IACrC,KAAK,EAAE,qBAAqB;IAC5B,MAAM,EAAE,qBAAqB;CAC9B,CAAC;AA0BF,KAAK,UAAU,IAAI,CAAC,EAAU;IAC5B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAC3D,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,SAAS,sBAAsB,CAC7B,EAA0C;IAE1C,OAAO,OAAQ,EAA0B,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x';\nimport type { TypedTransaction, TxData } from '@ethereumjs/tx';\nimport * as ethUtil from '@ethereumjs/util';\nimport {\n TypedMessage,\n SignTypedDataVersion,\n MessageTypes,\n} from '@metamask/eth-sig-util';\nimport { transformTypedData } from '@trezor/connect-plugin-ethereum';\nimport type {\n EthereumTransactionEIP1559,\n EthereumSignedTx,\n EthereumTransaction,\n} from '@trezor/connect-web';\nimport type OldEthJsTransaction from 'ethereumjs-tx';\nimport { EventEmitter } from 'events';\nimport HDKey from 'hdkey';\n\nimport { TrezorBridge } from './trezor-bridge';\n\nconst hdPathString = `m/44'/60'/0'/0`;\nconst SLIP0044TestnetPath = `m/44'/1'/0'/0`;\nconst legacyMewPath = `m/44'/60'/0'`;\n\nconst ALLOWED_HD_PATHS = {\n [hdPathString]: true,\n [legacyMewPath]: true,\n [SLIP0044TestnetPath]: true,\n} as const;\n\nconst keyringType = 'Trezor Hardware';\nconst pathBase = 'm';\nconst MAX_INDEX = 1000;\nconst DELAY_BETWEEN_POPUPS = 1000;\nexport const TREZOR_CONNECT_MANIFEST = {\n email: 'support@metamask.io',\n appUrl: 'https://metamask.io',\n};\n\nexport type AccountPageEntry = {\n address: string;\n balance: number | null;\n index: number;\n};\n\nexport type AccountPage = AccountPageEntry[];\n\nexport interface TrezorControllerOptions {\n hdPath?: string;\n accounts?: string[];\n page?: number;\n perPage?: number;\n}\n\nexport interface TrezorControllerState {\n hdPath: string;\n accounts: readonly string[];\n page: number;\n paths: Record<string, number>;\n perPage: number;\n unlockedAccount: number;\n}\n\nasync function wait(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\n/**\n * Check if the given transaction is made with ethereumjs-tx or @ethereumjs/tx\n *\n * Transactions built with older versions of ethereumjs-tx have a\n * getChainId method that newer versions do not.\n * Older versions are mutable\n * while newer versions default to being immutable.\n * Expected shape and type\n * of data for v, r and s differ (Buffer (old) vs BN (new)).\n *\n * @param tx\n * @returns Returns `true` if tx is an old-style ethereumjs-tx transaction.\n */\nfunction isOldStyleEthereumjsTx(\n tx: TypedTransaction | OldEthJsTransaction,\n): tx is OldEthJsTransaction {\n return typeof (tx as OldEthJsTransaction).getChainId === 'function';\n}\n\nexport class TrezorKeyring extends EventEmitter {\n static type: string = keyringType;\n\n readonly type: string = keyringType;\n\n accounts: readonly string[] = [];\n\n hdk: HDKey = new HDKey();\n\n hdPath: string = hdPathString;\n\n page = 0;\n\n perPage = 5;\n\n unlockedAccount = 0;\n\n paths: Record<string, number> = {};\n\n bridge: TrezorBridge;\n\n constructor({ bridge }: { bridge: TrezorBridge }) {\n super();\n\n if (!bridge) {\n throw new Error('Bridge is a required dependency for the keyring');\n }\n\n this.bridge = bridge;\n }\n\n /**\n * Gets the model, if known.\n * This may be `undefined` if the model hasn't been loaded yet.\n *\n * @returns\n */\n getModel(): string | undefined {\n return this.bridge.model;\n }\n\n async init(): Promise<void> {\n return this.bridge.init({\n manifest: TREZOR_CONNECT_MANIFEST,\n lazyLoad: true,\n });\n }\n\n async destroy(): Promise<void> {\n return this.bridge.dispose();\n }\n\n async serialize(): Promise<TrezorControllerState> {\n return Promise.resolve({\n hdPath: this.hdPath,\n accounts: this.accounts,\n page: this.page,\n paths: this.paths,\n perPage: this.perPage,\n unlockedAccount: this.unlockedAccount,\n });\n }\n\n async deserialize(opts: TrezorControllerOptions = {}): Promise<void> {\n this.hdPath = opts.hdPath ?? hdPathString;\n this.accounts = opts.accounts ?? [];\n this.page = opts.page ?? 0;\n this.perPage = opts.perPage ?? 5;\n return Promise.resolve();\n }\n\n isUnlocked(): boolean {\n return Boolean(this.hdk?.publicKey);\n }\n\n async unlock(): Promise<string> {\n if (this.isUnlocked()) {\n return Promise.resolve('already unlocked');\n }\n return new Promise((resolve, reject) => {\n this.bridge\n .getPublicKey({\n path: this.hdPath,\n coin: 'ETH',\n })\n .then((response) => {\n if (response.success) {\n this.hdk.publicKey = Buffer.from(response.payload.publicKey, 'hex');\n this.hdk.chainCode = Buffer.from(response.payload.chainCode, 'hex');\n resolve('just unlocked');\n } else {\n reject(new Error(response.payload?.error || 'Unknown error'));\n }\n })\n .catch((e) => {\n reject(new Error(e?.toString() || 'Unknown error'));\n });\n });\n }\n\n setAccountToUnlock(index: number | string): void {\n this.unlockedAccount = parseInt(String(index), 10);\n }\n\n async addAccounts(n = 1): Promise<readonly string[]> {\n return new Promise((resolve, reject) => {\n this.unlock()\n .then((_) => {\n const from = this.unlockedAccount;\n const to = from + n;\n const newAccounts = [];\n\n for (let i = from; i < to; i++) {\n const address = this.#addressFromIndex(pathBase, i);\n if (!this.accounts.includes(address)) {\n this.accounts = [...this.accounts, address];\n newAccounts.push(address);\n }\n this.page = 0;\n }\n resolve(newAccounts);\n })\n .catch((e: Error) => {\n reject(e);\n });\n });\n }\n\n async getFirstPage(): Promise<AccountPage> {\n this.page = 0;\n return this.#getPage(1);\n }\n\n async getNextPage(): Promise<AccountPage> {\n return this.#getPage(1);\n }\n\n async getPreviousPage(): Promise<AccountPage> {\n return this.#getPage(-1);\n }\n\n async #getPage(increment: number): Promise<AccountPage> {\n this.page += increment;\n\n if (this.page <= 0) {\n this.page = 1;\n }\n\n return new Promise((resolve, reject) => {\n this.unlock()\n .then((_) => {\n const from = (this.page - 1) * this.perPage;\n const to = from + this.perPage;\n\n const accounts = [];\n\n for (let i = from; i < to; i++) {\n const address = this.#addressFromIndex(pathBase, i);\n accounts.push({\n address,\n balance: null,\n index: i,\n });\n this.paths[ethUtil.toChecksumAddress(address)] = i;\n }\n resolve(accounts);\n })\n .catch((e: Error) => {\n reject(e);\n });\n });\n }\n\n async getAccounts(): Promise<string[]> {\n return Promise.resolve(this.accounts.slice());\n }\n\n removeAccount(address: string): void {\n if (\n !this.accounts.map((a) => a.toLowerCase()).includes(address.toLowerCase())\n ) {\n throw new Error(`Address ${address} not found in this keyring`);\n }\n\n this.accounts = this.accounts.filter(\n (a) => a.toLowerCase() !== address.toLowerCase(),\n );\n }\n\n /**\n * Signs a transaction using Trezor.\n *\n * Accepts either an ethereumjs-tx or @ethereumjs/tx transaction, and returns\n * the same type.\n *\n * @param address - Hex string address.\n * @param tx - Instance of either new-style or old-style ethereumjs transaction.\n * @returns The signed transaction, an instance of either new-style or old-style\n * ethereumjs transaction.\n */\n async signTransaction(\n address: string,\n tx: TypedTransaction | OldEthJsTransaction,\n ): Promise<TypedTransaction | OldEthJsTransaction> {\n if (isOldStyleEthereumjsTx(tx)) {\n // In this version of ethereumjs-tx we must add the chainId in hex format\n // to the initial v value. The chainId must be included in the serialized\n // transaction which is only communicated to ethereumjs-tx in this\n // value. In newer versions the chainId is communicated via the 'Common'\n // object.\n return this.#signTransaction(\n address,\n // @types/ethereumjs-tx and old ethereumjs-tx versions document\n // this function return value as Buffer, but the actual\n // Transaction._chainId will always be a number.\n // See https://github.com/ethereumjs/ethereumjs-tx/blob/v1.3.7/index.js#L126\n tx.getChainId() as unknown as number,\n tx,\n (payload) => {\n tx.v = Buffer.from(payload.v, 'hex');\n tx.r = Buffer.from(payload.r, 'hex');\n tx.s = Buffer.from(payload.s, 'hex');\n return tx;\n },\n );\n }\n return this.#signTransaction(\n address,\n Number(tx.common.chainId()),\n tx,\n (payload) => {\n // Because tx will be immutable, first get a plain javascript object that\n // represents the transaction. Using txData here as it aligns with the\n // nomenclature of ethereumjs/tx.\n const txData: TxData = tx.toJSON();\n // The fromTxData utility expects a type to support transactions with a type other than 0\n txData.type = tx.type;\n // The fromTxData utility expects v,r and s to be hex prefixed\n txData.v = ethUtil.addHexPrefix(payload.v);\n txData.r = ethUtil.addHexPrefix(payload.r);\n txData.s = ethUtil.addHexPrefix(payload.s);\n // Adopt the 'common' option from the original transaction and set the\n // returned object to be frozen if the original is frozen.\n return TransactionFactory.fromTxData(txData, {\n common: tx.common,\n freeze: Object.isFrozen(tx),\n });\n },\n );\n }\n\n /**\n *\n * @param address - Hex string address.\n * @param chainId - Chain ID\n * @param tx - Instance of either new-style or old-style ethereumjs transaction.\n * @param handleSigning - Converts signed transaction\n * to the same new-style or old-style ethereumjs-tx.\n * @returns The signed transaction, an instance of either new-style or old-style\n * ethereumjs transaction.\n */\n async #signTransaction<T extends TypedTransaction | OldEthJsTransaction>(\n address: string,\n chainId: number,\n tx: T,\n handleSigning: (tx: EthereumSignedTx) => T,\n ): Promise<T> {\n let transaction: EthereumTransaction | EthereumTransactionEIP1559;\n if (isOldStyleEthereumjsTx(tx)) {\n // legacy transaction from ethereumjs-tx package has no .toJSON() function,\n // so we need to convert to hex-strings manually manually\n transaction = {\n to: this.#normalize(tx.to),\n value: this.#normalize(tx.value),\n data: this.#normalize(tx.data),\n chainId,\n nonce: this.#normalize(tx.nonce),\n gasLimit: this.#normalize(tx.gasLimit),\n gasPrice: this.#normalize(tx.gasPrice),\n };\n } else {\n // new-style transaction from @ethereumjs/tx package\n // we can just copy tx.toJSON() for everything except chainId, which must be a number\n transaction = {\n ...tx.toJSON(),\n chainId,\n to: this.#normalize(ethUtil.toBuffer(tx.to)),\n } as EthereumTransaction | EthereumTransactionEIP1559;\n }\n\n try {\n const status = await this.unlock();\n await wait(status === 'just unlocked' ? DELAY_BETWEEN_POPUPS : 0);\n const response = await this.bridge.ethereumSignTransaction({\n path: this.#pathFromAddress(address),\n transaction,\n });\n if (response.success) {\n const newOrMutatedTx = handleSigning(response.payload);\n\n const addressSignedWith = ethUtil.toChecksumAddress(\n ethUtil.addHexPrefix(\n newOrMutatedTx.getSenderAddress().toString('hex'),\n ),\n );\n const correctAddress = ethUtil.toChecksumAddress(address);\n if (addressSignedWith !== correctAddress) {\n throw new Error(\"signature doesn't match the right address\");\n }\n\n return newOrMutatedTx;\n }\n throw new Error(response.payload?.error || 'Unknown error');\n } catch (e) {\n throw new Error(e?.toString() ?? 'Unknown error');\n }\n }\n\n async signMessage(withAccount: string, data: string): Promise<string> {\n return this.signPersonalMessage(withAccount, data);\n }\n\n // For personal_sign, we need to prefix the message:\n async signPersonalMessage(\n withAccount: string,\n message: string,\n ): Promise<string> {\n return new Promise((resolve, reject) => {\n this.unlock()\n .then((status) => {\n setTimeout(\n () => {\n this.bridge\n .ethereumSignMessage({\n path: this.#pathFromAddress(withAccount),\n message: ethUtil.stripHexPrefix(message),\n hex: true,\n })\n .then((response) => {\n if (response.success) {\n if (\n response.payload.address !==\n ethUtil.toChecksumAddress(withAccount)\n ) {\n reject(\n new Error('signature doesnt match the right address'),\n );\n }\n const signature = `0x${response.payload.signature}`;\n resolve(signature);\n } else {\n reject(\n new Error(response.payload?.error || 'Unknown error'),\n );\n }\n })\n .catch((e) => {\n reject(new Error(e?.toString() || 'Unknown error'));\n });\n // This is necessary to avoid popup collision\n // between the unlock & sign trezor popups\n },\n status === 'just unlocked' ? DELAY_BETWEEN_POPUPS : 0,\n );\n })\n .catch((e) => {\n reject(new Error(e?.toString() || 'Unknown error'));\n });\n });\n }\n\n // EIP-712 Sign Typed Data\n async signTypedData<T extends MessageTypes>(\n address: string,\n data: TypedMessage<T>,\n { version }: { version: SignTypedDataVersion },\n ): Promise<string> {\n const dataWithHashes = transformTypedData(\n data,\n version === SignTypedDataVersion.V4,\n );\n\n // set default values for signTypedData\n // Trezor is stricter than @metamask/eth-sig-util in what it accepts\n const {\n types,\n message = {},\n domain = {},\n primaryType,\n // snake_case since Trezor uses Protobuf naming conventions here\n domain_separator_hash, // eslint-disable-line camelcase\n message_hash, // eslint-disable-line camelcase\n } = dataWithHashes;\n\n // This is necessary to avoid popup collision\n // between the unlock & sign trezor popups\n const status = await this.unlock();\n await wait(status === 'just unlocked' ? DELAY_BETWEEN_POPUPS : 0);\n\n const response = await this.bridge.ethereumSignTypedData({\n path: this.#pathFromAddress(address),\n data: {\n types: { ...types, EIP712Domain: types.EIP712Domain ?? [] },\n message,\n domain,\n primaryType,\n },\n metamask_v4_compat: true, // eslint-disable-line camelcase\n // Trezor 1 only supports blindly signing hashes\n domain_separator_hash, // eslint-disable-line camelcase\n message_hash: message_hash ?? '', // eslint-disable-line camelcase\n });\n\n if (response.success) {\n if (ethUtil.toChecksumAddress(address) !== response.payload.address) {\n throw new Error('signature doesnt match the right address');\n }\n return response.payload.signature;\n }\n\n throw new Error(response.payload?.error || 'Unknown error');\n }\n\n async exportAccount(): Promise<never> {\n return Promise.reject(new Error('Not supported on this device'));\n }\n\n forgetDevice(): void {\n this.accounts = [];\n this.hdk = new HDKey();\n this.page = 0;\n this.unlockedAccount = 0;\n this.paths = {};\n }\n\n /**\n * Set the HD path to be used by the keyring. Only known supported HD paths are allowed.\n *\n * If the given HD path is already the current HD path, nothing happens. Otherwise the new HD\n * path is set, and the wallet state is completely reset.\n *\n * @throws {Error] Throws if the HD path is not supported.\n *\n * @param hdPath - The HD path to set.\n */\n setHdPath(hdPath: keyof typeof ALLOWED_HD_PATHS): void {\n if (!ALLOWED_HD_PATHS[hdPath]) {\n throw new Error(\n `The setHdPath method does not support setting HD Path to ${hdPath}`,\n );\n }\n\n // Reset HDKey if the path changes\n if (this.hdPath !== hdPath) {\n this.hdk = new HDKey();\n this.accounts = [];\n this.page = 0;\n this.perPage = 5;\n this.unlockedAccount = 0;\n this.paths = {};\n }\n this.hdPath = hdPath;\n }\n\n #normalize(buf: Buffer): string {\n return ethUtil.bufferToHex(buf).toString();\n }\n\n #addressFromIndex(basePath: string, i: number): string {\n const dkey = this.hdk.derive(`${basePath}/${i}`);\n const address = ethUtil\n .publicToAddress(dkey.publicKey, true)\n .toString('hex');\n return ethUtil.toChecksumAddress(`0x${address}`);\n }\n\n #pathFromAddress(address: string): string {\n const checksummedAddress = ethUtil.toChecksumAddress(address);\n let index = this.paths[checksummedAddress];\n if (typeof index === 'undefined') {\n for (let i = 0; i < MAX_INDEX; i++) {\n if (checksummedAddress === this.#addressFromIndex(pathBase, i)) {\n index = i;\n break;\n }\n }\n }\n\n if (typeof index === 'undefined') {\n throw new Error('Unknown address');\n }\n return `${this.hdPath}/${index}`;\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask-previews/eth-trezor-keyring",
3
- "version": "3.1.0-preview-46bb5ff",
3
+ "version": "4.0.0-d5a036e",
4
4
  "description": "A MetaMask compatible keyring, for trezor hardware wallets",
5
5
  "keywords": [
6
6
  "ethereum",
@@ -37,35 +37,37 @@
37
37
  "test:watch": "jest --watch"
38
38
  },
39
39
  "dependencies": {
40
- "@ethereumjs/tx": "^4.0.0",
41
- "@ethereumjs/util": "^8.0.0",
42
- "@metamask/eth-sig-util": "^7.0.1",
40
+ "@ethereumjs/tx": "^4.2.0",
41
+ "@ethereumjs/util": "^8.1.0",
42
+ "@metamask/eth-sig-util": "^7.0.3",
43
43
  "@trezor/connect-plugin-ethereum": "^9.0.3",
44
44
  "@trezor/connect-web": "^9.1.11",
45
- "deepmerge": "^4.2.2",
46
45
  "hdkey": "^2.1.0",
47
- "jest-environment-jsdom": "^29.7.0"
46
+ "tslib": "^2.6.2"
48
47
  },
49
48
  "devDependencies": {
50
- "@ethereumjs/common": "^3.0.0",
51
- "@lavamoat/allow-scripts": "^3.0.4",
52
- "@metamask/auto-changelog": "^3.0.0",
49
+ "@ethereumjs/common": "^3.2.0",
50
+ "@lavamoat/allow-scripts": "^3.2.1",
51
+ "@lavamoat/preinstall-always-fail": "^2.1.0",
52
+ "@metamask/auto-changelog": "^3.4.4",
53
53
  "@types/ethereumjs-tx": "^1.0.1",
54
54
  "@types/hdkey": "^2.0.1",
55
- "@types/jest": "^28.1.6",
56
- "@types/node": "^16.18.57",
57
- "@types/sinon": "^9.0.10",
55
+ "@types/jest": "^29.5.12",
56
+ "@types/node": "^20.12.12",
57
+ "@types/sinon": "^17.0.3",
58
58
  "@types/w3c-web-usb": "^1.0.6",
59
- "depcheck": "^1.4.3",
60
- "ethereumjs-tx": "^1.3.4",
61
- "jest": "^28.1.3",
62
- "jest-it-up": "^2.2.0",
63
- "rimraf": "^4.1.2",
64
- "sinon": "^9.2.3",
65
- "ts-jest": "^28.0.7",
66
- "ts-node": "^10.7.0",
67
- "typedoc": "^0.23.15",
68
- "typescript": "~4.8.4"
59
+ "deepmerge": "^4.2.2",
60
+ "depcheck": "^1.4.7",
61
+ "ethereumjs-tx": "^1.3.7",
62
+ "jest": "^29.5.0",
63
+ "jest-environment-jsdom": "^29.7.0",
64
+ "jest-it-up": "^3.1.0",
65
+ "rimraf": "^5.0.10",
66
+ "sinon": "^19.0.2",
67
+ "ts-jest": "^29.0.5",
68
+ "ts-node": "^10.9.2",
69
+ "typedoc": "^0.25.13",
70
+ "typescript": "~5.4.5"
69
71
  },
70
72
  "engines": {
71
73
  "node": "^18.18 || >=20"