@onekeyfe/hd-web-sdk 0.1.25 → 0.1.26

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.
@@ -4133,6 +4133,10 @@ const inject = ({
4133
4133
  connectId,
4134
4134
  method: 'deviceUpdateReboot'
4135
4135
  }),
4136
+ deviceSupportFeatures: connectId => call({
4137
+ connectId,
4138
+ method: 'deviceSupportFeatures'
4139
+ }),
4136
4140
  deviceVerify: (connectId, params) => call(Object.assign(Object.assign({}, params), {
4137
4141
  connectId,
4138
4142
  method: 'deviceVerify'
@@ -13670,9 +13674,25 @@ const getDeviceBLEFirmwareVersion = features => {
13670
13674
  return null;
13671
13675
  }
13672
13676
 
13677
+ if (!semver__default["default"].valid(features.ble_ver)) {
13678
+ return null;
13679
+ }
13680
+
13673
13681
  return features.ble_ver.split('.');
13674
13682
  };
13675
13683
 
13684
+ const supportInputPinOnSoftware = features => {
13685
+ if (!features) return false;
13686
+ const deviceType = getDeviceType(features);
13687
+
13688
+ if (deviceType === 'touch') {
13689
+ return false;
13690
+ }
13691
+
13692
+ const currentVersion = getDeviceFirmwareVersion(features).join('.');
13693
+ return semver__default["default"].gte(currentVersion, '2.3.0');
13694
+ };
13695
+
13676
13696
  const HD_HARDENED = 0x80000000;
13677
13697
 
13678
13698
  const toHardened = n => (n | HD_HARDENED) >>> 0;
@@ -14351,6 +14371,7 @@ const DEVICE = {
14351
14371
  PASSPHRASE: 'passphrase',
14352
14372
  PASSPHRASE_ON_DEVICE: 'passphrase_on_device',
14353
14373
  WORD: 'word',
14374
+ SUPPORT_FEATURES: 'support_features',
14354
14375
  FEATURES: 'features'
14355
14376
  };
14356
14377
 
@@ -14579,7 +14600,7 @@ const UI_REQUEST = {
14579
14600
  FIRMWARE_NOT_INSTALLED: 'ui-device_firmware_not_installed',
14580
14601
  NOT_USE_ONEKEY_DEVICE: 'ui-device_please_use_onekey_device'
14581
14602
  };
14582
- const DEFAULT_DOMAIN = `https://jssdk.onekey.so/${"0.1.25"}/`;
14603
+ const DEFAULT_DOMAIN = `https://jssdk.onekey.so/${"0.1.26"}/`;
14583
14604
  const DEFAULT_PRIORITY = 2;
14584
14605
  const initialSettings = {
14585
14606
  configSrc: './data/config.json',
@@ -15218,6 +15239,15 @@ class BaseMethod {
15218
15239
  })));
15219
15240
  }
15220
15241
 
15242
+ checkDeviceSupportFeature() {
15243
+ if (!this.device || !this.device.features) return;
15244
+ const inputPinOnSoftware = supportInputPinOnSoftware(this.device.features);
15245
+ this.postMessage(createDeviceMessage(DEVICE.SUPPORT_FEATURES, {
15246
+ inputPinOnSoftware,
15247
+ device: this.device.toMessageObject()
15248
+ }));
15249
+ }
15250
+
15221
15251
  dispose() {}
15222
15252
 
15223
15253
  }
@@ -16872,6 +16902,20 @@ class DeviceUpdateReboot extends BaseMethod {
16872
16902
 
16873
16903
  }
16874
16904
 
16905
+ class DeviceSupportFeatures extends BaseMethod {
16906
+ init() {}
16907
+
16908
+ run() {
16909
+ if (!this.device.features) return Promise.reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, 'Device not initialized'));
16910
+ const inputPinOnSoftware = supportInputPinOnSoftware(this.device.features);
16911
+ return Promise.resolve({
16912
+ inputPinOnSoftware,
16913
+ device: this.device.toMessageObject()
16914
+ });
16915
+ }
16916
+
16917
+ }
16918
+
16875
16919
  class DeviceVerify extends BaseMethod {
16876
16920
  init() {
16877
16921
  validateParams(this.payload, [{
@@ -18905,6 +18949,7 @@ var ApiMethods = /*#__PURE__*/Object.freeze({
18905
18949
  deviceReset: DeviceReset,
18906
18950
  deviceSettings: DeviceSettings,
18907
18951
  deviceUpdateReboot: DeviceUpdateReboot,
18952
+ deviceSupportFeatures: DeviceSupportFeatures,
18908
18953
  deviceVerify: DeviceVerify,
18909
18954
  deviceWipe: DeviceWipe,
18910
18955
  evmGetAddress: EvmGetAddress,
@@ -19232,6 +19277,7 @@ const callAPI = message => __awaiter(void 0, void 0, void 0, function* () {
19232
19277
  }
19233
19278
 
19234
19279
  method.checkFirmwareRelease();
19280
+ method.checkDeviceSupportFeature();
19235
19281
 
19236
19282
  if (_deviceList) {
19237
19283
  yield TransportManager.reconfigure(device.getFirmwareVersion());
@@ -46078,6 +46124,10 @@ const handleMessage = async message => {
46078
46124
  eventEmitter.emit(message.type, message.payload);
46079
46125
  }
46080
46126
 
46127
+ if (message.type === dist/* DEVICE.SUPPORT_FEATURES */.Td.SUPPORT_FEATURES) {
46128
+ eventEmitter.emit(message.type, message.payload);
46129
+ }
46130
+
46081
46131
  break;
46082
46132
 
46083
46133
  default:
@@ -46168,7 +46218,7 @@ const src_init = async settings => {
46168
46218
 
46169
46219
  try {
46170
46220
  await init({ ..._settings,
46171
- version: "0.1.25"
46221
+ version: "0.1.26"
46172
46222
  });
46173
46223
  return true;
46174
46224
  } catch (e) {