@onekeyfe/hd-web-sdk 0.1.29 → 0.1.32

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.
@@ -14789,10 +14789,6 @@ class DeviceCommands {
14789
14789
  return Promise.resolve(patchFeatures(res));
14790
14790
  }
14791
14791
 
14792
- if ((_a = this.device.features) === null || _a === void 0 ? void 0 : _a.passphrase_protection) {
14793
- return Promise.reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceNotSupportPassphrase));
14794
- }
14795
-
14796
14792
  if (res.type === 'ButtonRequest') {
14797
14793
  if (res.message.code === 'ButtonRequest_PassphraseEntry') {
14798
14794
  this.device.emit(DEVICE.PASSPHRASE_ON_DEVICE, this.device);
@@ -14822,6 +14818,10 @@ class DeviceCommands {
14822
14818
  }, () => this._commonCall('Cancel', {}));
14823
14819
  }
14824
14820
 
14821
+ if ((_a = this.device.features) === null || _a === void 0 ? void 0 : _a.passphrase_protection) {
14822
+ return Promise.reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceNotSupportPassphrase));
14823
+ }
14824
+
14825
14825
  if (res.type === 'PassphraseRequest') {
14826
14826
  return Promise.reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceNotSupportPassphrase));
14827
14827
  }
@@ -14865,7 +14865,7 @@ const UI_REQUEST = {
14865
14865
  FIRMWARE_NOT_INSTALLED: 'ui-device_firmware_not_installed',
14866
14866
  NOT_USE_ONEKEY_DEVICE: 'ui-device_please_use_onekey_device'
14867
14867
  };
14868
- const DEFAULT_DOMAIN = `https://jssdk.onekey.so/${"0.1.29"}/`;
14868
+ const DEFAULT_DOMAIN = `https://jssdk.onekey.so/${"0.1.32"}/`;
14869
14869
  const DEFAULT_PRIORITY = 2;
14870
14870
  const initialSettings = {
14871
14871
  configSrc: './data/config.json',
@@ -15138,6 +15138,15 @@ class Device extends events.exports {
15138
15138
  } = yield this.commands.typedCall('Initialize', 'Features', payload);
15139
15139
 
15140
15140
  this._updateFeatures(message);
15141
+
15142
+ if (message.passphrase_protection) {
15143
+ if (this.listenerCount(DEVICE.PIN) > 0) {
15144
+ Log$3.debug('try to close passpharse');
15145
+ yield this.commands.typedCall('ApplySettings', 'Success', {
15146
+ use_passphrase: false
15147
+ });
15148
+ }
15149
+ }
15141
15150
  });
15142
15151
  }
15143
15152
 
@@ -15205,6 +15214,8 @@ class Device extends events.exports {
15205
15214
  }
15206
15215
 
15207
15216
  _runInner(fn, options) {
15217
+ var _a;
15218
+
15208
15219
  return __awaiter(this, void 0, void 0, function* () {
15209
15220
  if (!this.isUsedHere() || this.commands.disposed) {
15210
15221
  const env = DataManager.getSettings('env');
@@ -15225,6 +15236,21 @@ class Device extends events.exports {
15225
15236
 
15226
15237
  return Promise.reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceInitializeFailed, `Initialize failed: ${error.message}, code: ${error.code}`));
15227
15238
  }
15239
+ } else if (env === 'react-native') {
15240
+ if ((_a = this.features) === null || _a === void 0 ? void 0 : _a.passphrase_protection) {
15241
+ if (this.listenerCount(DEVICE.PIN) > 0) {
15242
+ Log$3.debug('try to close passpharse for mobile');
15243
+
15244
+ try {
15245
+ yield this.commands.typedCall('ApplySettings', 'Success', {
15246
+ use_passphrase: false
15247
+ });
15248
+ } catch (e) {
15249
+ this.runPromise = null;
15250
+ return Promise.reject(e);
15251
+ }
15252
+ }
15253
+ }
15228
15254
  }
15229
15255
  }
15230
15256
 
@@ -15233,7 +15259,16 @@ class Device extends events.exports {
15233
15259
  }
15234
15260
 
15235
15261
  if (fn) {
15236
- yield fn();
15262
+ try {
15263
+ yield fn();
15264
+ } catch (e) {
15265
+ if (this.runPromise) {
15266
+ this.runPromise.reject(e);
15267
+ }
15268
+
15269
+ this.runPromise = null;
15270
+ return;
15271
+ }
15237
15272
  }
15238
15273
 
15239
15274
  if (!this.keepSession && typeof options.keepSession !== 'boolean' || options.keepSession === false) {
@@ -44094,6 +44129,10 @@ const init = async settings => {
44094
44129
  instance.style.width = '0px';
44095
44130
  instance.style.height = '0px';
44096
44131
  instance.id = 'onekey-connect';
44132
+
44133
+ if (settings.env === 'webusb') {
44134
+ instance.allow = 'usb';
44135
+ }
44097
44136
  }
44098
44137
 
44099
44138
  const manifest = `version=${settings.version}`;
@@ -46491,7 +46530,7 @@ const src_init = async settings => {
46491
46530
 
46492
46531
  try {
46493
46532
  await init({ ..._settings,
46494
- version: "0.1.29"
46533
+ version: "0.1.32"
46495
46534
  });
46496
46535
  return true;
46497
46536
  } catch (e) {