@onekeyfe/hd-core 0.1.28 → 0.1.31

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.
@@ -1 +1 @@
1
- {"version":3,"file":"RequestWebUsbDevice.d.ts","sourceRoot":"","sources":["../../src/api/RequestWebUsbDevice.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAQ1C,MAAM,CAAC,OAAO,OAAO,mBAAoB,SAAQ,UAAU;IACzD,IAAI;IAIE,GAAG;;;CAsCV"}
1
+ {"version":3,"file":"RequestWebUsbDevice.d.ts","sourceRoot":"","sources":["../../src/api/RequestWebUsbDevice.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAQ1C,MAAM,CAAC,OAAO,OAAO,mBAAoB,SAAQ,UAAU;IACzD,IAAI;IAIE,GAAG;;;CA+BV"}
@@ -6,7 +6,7 @@ export default class EVMSignTransaction extends BaseMethod {
6
6
  isEIP1559: boolean;
7
7
  formattedTx: EVMTransaction | EVMTransactionEIP1559 | undefined;
8
8
  init(): void;
9
- processTxRequest: (request: EthereumTxRequest, data: string, chain_id: number | undefined) => Promise<EVMSignedTx>;
9
+ processTxRequest: (request: EthereumTxRequest, data: string, chain_id?: number | undefined) => Promise<EVMSignedTx>;
10
10
  evmSignTx: (addressN: number[], tx: EVMTransaction) => Promise<EVMSignedTx>;
11
11
  evmSignTxEip1559: (addressN: number[], tx: EVMTransactionEIP1559) => Promise<EVMSignedTx>;
12
12
  getVersionRange(): {
@@ -1 +1 @@
1
- {"version":3,"file":"EVMSignTransaction.d.ts","sourceRoot":"","sources":["../../../src/api/evm/EVMSignTransaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyC,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAKlG,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EACL,WAAW,EAEX,cAAc,EACd,qBAAqB,EACtB,MAAM,oCAAoC,CAAC;AAI5C,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,UAAU;IACxD,QAAQ,EAAE,MAAM,EAAE,CAAM;IAExB,SAAS,UAAS;IAElB,WAAW,EAAE,cAAc,GAAG,qBAAqB,GAAG,SAAS,CAAC;IAEhE,IAAI;IAoCJ,gBAAgB,YACL,iBAAiB,QACpB,MAAM,YACF,MAAM,GAAG,SAAS,KAC3B,QAAQ,WAAW,CAAC,CA+BrB;IAEF,SAAS,aAAoB,MAAM,EAAE,MAAM,cAAc,0BAuCvD;IAEF,gBAAgB,aAAoB,MAAM,EAAE,MAAM,qBAAqB,0BAyCrE;IAEF,eAAe;;;;;IAeT,GAAG;CASV"}
1
+ {"version":3,"file":"EVMSignTransaction.d.ts","sourceRoot":"","sources":["../../../src/api/evm/EVMSignTransaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyC,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAKlG,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EACL,WAAW,EAEX,cAAc,EACd,qBAAqB,EACtB,MAAM,oCAAoC,CAAC;AAI5C,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,UAAU;IACxD,QAAQ,EAAE,MAAM,EAAE,CAAM;IAExB,SAAS,UAAS;IAElB,WAAW,EAAE,cAAc,GAAG,qBAAqB,GAAG,SAAS,CAAC;IAEhE,IAAI;IAoCJ,gBAAgB,YACL,iBAAiB,QACpB,MAAM,aACD,MAAM,GAAG,SAAS,KAC5B,QAAQ,WAAW,CAAC,CA+BrB;IAEF,SAAS,aAAoB,MAAM,EAAE,MAAM,cAAc,0BAuCvD;IAEF,gBAAgB,aAAoB,MAAM,EAAE,MAAM,qBAAqB,0BAyCrE;IAEF,eAAe;;;;;IAeT,GAAG;CASV"}
@@ -1 +1 @@
1
- {"version":3,"file":"Device.d.ts","sourceRoot":"","sources":["../../src/device/Device.ts"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;IAE7B,uBAAuB,EAAE,uBAAuB,CAAM;IAEtD,QAAQ,SAAK;IAEb,aAAa,EAAE,MAAM,EAAE,CAAM;IAE7B,gBAAgB,UAAS;IAKzB,WAAW,UAAS;gBAER,UAAU,EAAE,gBAAgB;IAKxC,MAAM,CAAC,cAAc,CAAC,kBAAkB,EAAE,gBAAgB;IAM1D,eAAe,IAAI,WAAW,GAAG,IAAI;IAiCrC,OAAO;IA+BD,OAAO;IA+BP,OAAO;IA2Bb,WAAW;IAIX,gBAAgB;IAIV,UAAU;IAmBV,WAAW;IAKjB,eAAe,CAAC,IAAI,EAAE,QAAQ;IAiB9B,gBAAgB,CAAC,UAAU,EAAE,gBAAgB,EAAE,WAAW,UAAQ;IAiBlE,eAAe,CAAC,MAAM,EAAE,MAAM;IASxB,GAAG,CAAC,EAAE,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,EAAE,UAAU;IAYlD,SAAS,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,MAAM,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS,EAAE,OAAO,EAAE,UAAU;IAgDpE,uBAAuB;IASvB,oBAAoB;IAS1B,OAAO;IAOP,kBAAkB;IAKlB,qBAAqB;IAKrB,MAAM;IAIN,UAAU;IAQV,eAAe,IAAI,OAAO;IAI1B,YAAY;IAIZ,aAAa;IAIb,UAAU;IAIV,YAAY,IAAI,OAAO;IAIvB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE;IAsBpD,aAAa,CAAC,QAAQ,EAAE,MAAM;CAM/B;AAED,eAAe,MAAM,CAAC"}
package/dist/index.js CHANGED
@@ -10428,9 +10428,6 @@ class DeviceCommands {
10428
10428
  if (res.type === 'Features') {
10429
10429
  return Promise.resolve(patchFeatures(res));
10430
10430
  }
10431
- if ((_a = this.device.features) === null || _a === void 0 ? void 0 : _a.passphrase_protection) {
10432
- return Promise.reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceNotSupportPassphrase));
10433
- }
10434
10431
  if (res.type === 'ButtonRequest') {
10435
10432
  if (res.message.code === 'ButtonRequest_PassphraseEntry') {
10436
10433
  this.device.emit(DEVICE.PASSPHRASE_ON_DEVICE, this.device);
@@ -10453,6 +10450,9 @@ class DeviceCommands {
10453
10450
  return this._commonCall('PinMatrixAck', { pin });
10454
10451
  }, () => this._commonCall('Cancel', {}));
10455
10452
  }
10453
+ if ((_a = this.device.features) === null || _a === void 0 ? void 0 : _a.passphrase_protection) {
10454
+ return Promise.reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceNotSupportPassphrase));
10455
+ }
10456
10456
  if (res.type === 'PassphraseRequest') {
10457
10457
  return Promise.reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceNotSupportPassphrase));
10458
10458
  }
@@ -10738,6 +10738,11 @@ class Device extends events.exports {
10738
10738
  }
10739
10739
  const { message } = yield this.commands.typedCall('Initialize', 'Features', payload);
10740
10740
  this._updateFeatures(message);
10741
+ if (message.passphrase_protection) {
10742
+ if (this.listenerCount(DEVICE.PIN) > 0) {
10743
+ yield this.commands.typedCall('ApplySettings', 'Success', { use_passphrase: false });
10744
+ }
10745
+ }
10741
10746
  });
10742
10747
  }
10743
10748
  getFeatures() {
@@ -12452,7 +12457,7 @@ class EVMSignTransaction extends BaseMethod {
12452
12457
  })),
12453
12458
  };
12454
12459
  const response = yield this.device.commands.typedCall('EthereumSignTxEIP1559', 'EthereumTxRequest', message);
12455
- return this.processTxRequest(response.message, rest, chainId);
12460
+ return this.processTxRequest(response.message, rest);
12456
12461
  });
12457
12462
  }
12458
12463
  init() {
@@ -13637,18 +13642,12 @@ class RequestWebUsbDevice extends BaseMethod {
13637
13642
  if (env !== 'webusb') {
13638
13643
  return Promise.reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, 'Not webusb environment'));
13639
13644
  }
13640
- const transport = TransportManager.getTransport();
13641
13645
  try {
13642
- const device = (yield transport.requestDevice());
13643
- if (!device) {
13644
- return yield Promise.reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, 'Please select the device to connect'));
13645
- }
13646
13646
  const deviceDiff = yield ((_a = this.connector) === null || _a === void 0 ? void 0 : _a.enumerate());
13647
13647
  const devicesDescriptor = (_b = deviceDiff === null || deviceDiff === void 0 ? void 0 : deviceDiff.descriptors) !== null && _b !== void 0 ? _b : [];
13648
13648
  const { deviceList } = yield DevicePool.getDevices(devicesDescriptor);
13649
- const _device = deviceList.find(d => d.originalDescriptor.path === device.serialNumber);
13650
- if (_device) {
13651
- return { device: _device.toMessageObject() };
13649
+ if (deviceList.length > 0) {
13650
+ return { device: deviceList[0].toMessageObject() };
13652
13651
  }
13653
13652
  return yield Promise.reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, 'Please select the device to connect'));
13654
13653
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/hd-core",
3
- "version": "0.1.28",
3
+ "version": "0.1.31",
4
4
  "description": "> TODO: description",
5
5
  "author": "OneKey",
6
6
  "homepage": "https://github.com/OneKeyHQ/hardware-js-sdk#readme",
@@ -25,8 +25,8 @@
25
25
  "url": "https://github.com/OneKeyHQ/hardware-js-sdk/issues"
26
26
  },
27
27
  "dependencies": {
28
- "@onekeyfe/hd-shared": "^0.1.28",
29
- "@onekeyfe/hd-transport": "^0.1.28",
28
+ "@onekeyfe/hd-shared": "^0.1.31",
29
+ "@onekeyfe/hd-transport": "^0.1.31",
30
30
  "axios": "^0.27.2",
31
31
  "bignumber.js": "^9.0.2",
32
32
  "js-sha256": "^0.9.0",
@@ -37,5 +37,5 @@
37
37
  "@types/parse-uri": "^1.0.0",
38
38
  "@types/semver": "^7.3.9"
39
39
  },
40
- "gitHead": "84236b7baecf937399e557aa2d9a5b47ecd01d3f"
40
+ "gitHead": "a24d4d704ba64c6194c807f901261c048f686be6"
41
41
  }
@@ -22,22 +22,15 @@ export default class RequestWebUsbDevice extends BaseMethod {
22
22
  );
23
23
  }
24
24
 
25
- const transport = TransportManager.getTransport();
26
-
27
25
  try {
28
- const device = (await transport.requestDevice()) as any;
29
- if (!device) {
30
- return await Promise.reject(
31
- ERRORS.TypedError(HardwareErrorCode.RuntimeError, 'Please select the device to connect')
32
- );
33
- }
34
-
35
26
  const deviceDiff = await this.connector?.enumerate();
36
27
  const devicesDescriptor = deviceDiff?.descriptors ?? [];
37
28
  const { deviceList } = await DevicePool.getDevices(devicesDescriptor);
38
- const _device = deviceList.find(d => d.originalDescriptor.path === device.serialNumber);
39
- if (_device) {
40
- return { device: _device.toMessageObject() };
29
+ /**
30
+ * get first onekey device
31
+ */
32
+ if (deviceList.length > 0) {
33
+ return { device: deviceList[0].toMessageObject() };
41
34
  }
42
35
 
43
36
  return await Promise.reject(
@@ -60,7 +60,7 @@ export default class EVMSignTransaction extends BaseMethod {
60
60
  processTxRequest = async (
61
61
  request: EthereumTxRequest,
62
62
  data: string,
63
- chain_id: number | undefined
63
+ chain_id?: number | undefined
64
64
  ): Promise<EVMSignedTx> => {
65
65
  if (!request.data_length) {
66
66
  let v = request.signature_v;
@@ -175,7 +175,7 @@ export default class EVMSignTransaction extends BaseMethod {
175
175
  message
176
176
  );
177
177
 
178
- return this.processTxRequest(response.message, rest, chainId);
178
+ return this.processTxRequest(response.message, rest);
179
179
  };
180
180
 
181
181
  getVersionRange() {
@@ -255,6 +255,11 @@ export class Device extends EventEmitter {
255
255
 
256
256
  const { message } = await this.commands.typedCall('Initialize', 'Features', payload);
257
257
  this._updateFeatures(message);
258
+ if (message.passphrase_protection) {
259
+ if (this.listenerCount(DEVICE.PIN) > 0) {
260
+ await this.commands.typedCall('ApplySettings', 'Success', { use_passphrase: false });
261
+ }
262
+ }
258
263
  }
259
264
 
260
265
  async getFeatures() {
@@ -181,13 +181,6 @@ export class DeviceCommands {
181
181
  return Promise.resolve(patchFeatures(res));
182
182
  }
183
183
 
184
- /**
185
- * Temporary, do not support passphrase
186
- */
187
- if (this.device.features?.passphrase_protection) {
188
- return Promise.reject(ERRORS.TypedError(HardwareErrorCode.DeviceNotSupportPassphrase));
189
- }
190
-
191
184
  if (res.type === 'ButtonRequest') {
192
185
  if (res.message.code === 'ButtonRequest_PassphraseEntry') {
193
186
  this.device.emit(DEVICE.PASSPHRASE_ON_DEVICE, this.device);
@@ -221,6 +214,13 @@ export class DeviceCommands {
221
214
  );
222
215
  }
223
216
 
217
+ /**
218
+ * Temporary, do not support passphrase
219
+ */
220
+ if (this.device.features?.passphrase_protection) {
221
+ return Promise.reject(ERRORS.TypedError(HardwareErrorCode.DeviceNotSupportPassphrase));
222
+ }
223
+
224
224
  if (res.type === 'PassphraseRequest') {
225
225
  /**
226
226
  * Temporary, do not support passphrase