@onekeyfe/hd-core 1.0.39-alpha.0 → 1.0.39-alpha.10

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.
Files changed (48) hide show
  1. package/dist/api/FirmwareUpdateV3.d.ts.map +1 -1
  2. package/dist/api/GetPassphraseState.d.ts.map +1 -1
  3. package/dist/api/device/DeviceUnlock.d.ts +2 -0
  4. package/dist/api/device/DeviceUnlock.d.ts.map +1 -1
  5. package/dist/api/stellar/StellarSignTransaction.d.ts.map +1 -1
  6. package/dist/core/index.d.ts.map +1 -1
  7. package/dist/data-manager/DataManager.d.ts.map +1 -1
  8. package/dist/data-manager/TransportManager.d.ts.map +1 -1
  9. package/dist/device/Device.d.ts +2 -3
  10. package/dist/device/Device.d.ts.map +1 -1
  11. package/dist/device/DeviceCommands.d.ts +4 -4
  12. package/dist/device/DeviceCommands.d.ts.map +1 -1
  13. package/dist/events/ui-request.d.ts +3 -1
  14. package/dist/events/ui-request.d.ts.map +1 -1
  15. package/dist/index.d.ts +13 -10
  16. package/dist/index.js +116 -62
  17. package/dist/types/settings.d.ts +1 -1
  18. package/dist/types/settings.d.ts.map +1 -1
  19. package/dist/utils/capabilitieUtils.d.ts +5 -0
  20. package/dist/utils/capabilitieUtils.d.ts.map +1 -0
  21. package/dist/utils/deviceFeaturesUtils.d.ts.map +1 -1
  22. package/dist/utils/deviceInfoUtils.d.ts +2 -0
  23. package/dist/utils/deviceInfoUtils.d.ts.map +1 -1
  24. package/dist/utils/index.d.ts +1 -1
  25. package/dist/utils/index.d.ts.map +1 -1
  26. package/dist/utils/logger.d.ts +2 -0
  27. package/dist/utils/logger.d.ts.map +1 -1
  28. package/dist/utils/patch.d.ts +1 -1
  29. package/dist/utils/patch.d.ts.map +1 -1
  30. package/package.json +4 -4
  31. package/src/api/FirmwareUpdate.ts +1 -1
  32. package/src/api/FirmwareUpdateV3.ts +2 -0
  33. package/src/api/GetPassphraseState.ts +1 -17
  34. package/src/api/device/DeviceUnlock.ts +33 -0
  35. package/src/api/stellar/StellarSignTransaction.ts +0 -3
  36. package/src/core/index.ts +17 -7
  37. package/src/data/messages/messages.json +23 -6
  38. package/src/data-manager/DataManager.ts +1 -1
  39. package/src/data-manager/TransportManager.ts +3 -0
  40. package/src/device/Device.ts +34 -37
  41. package/src/device/DeviceCommands.ts +0 -1
  42. package/src/events/ui-request.ts +5 -0
  43. package/src/types/settings.ts +10 -1
  44. package/src/utils/capabilitieUtils.ts +12 -0
  45. package/src/utils/deviceFeaturesUtils.ts +12 -18
  46. package/src/utils/deviceInfoUtils.ts +17 -1
  47. package/src/utils/index.ts +1 -0
  48. package/src/utils/logger.ts +2 -0
package/dist/index.js CHANGED
@@ -6,11 +6,11 @@ var semver = require('semver');
6
6
  var hdShared = require('@onekeyfe/hd-shared');
7
7
  var axios = require('axios');
8
8
  var lodash = require('lodash');
9
+ var hdTransport = require('@onekeyfe/hd-transport');
9
10
  var ByteBuffer = require('bytebuffer');
10
11
  var BigNumber = require('bignumber.js');
11
12
  var utils = require('@noble/hashes/utils');
12
13
  var blake2s = require('@noble/hashes/blake2s');
13
- var hdTransport = require('@onekeyfe/hd-transport');
14
14
  var sha256 = require('@noble/hashes/sha256');
15
15
  var JSZip = require('jszip');
16
16
  var sha3 = require('@noble/hashes/sha3');
@@ -877,6 +877,7 @@ exports.LoggerNames = void 0;
877
877
  LoggerNames["HdTransportHttp"] = "@onekey/hd-transport-http";
878
878
  LoggerNames["HdTransportLowLevel"] = "@onekey/hd-transport-lowlevel";
879
879
  LoggerNames["HdBleTransport"] = "@onekey/hd-ble-transport";
880
+ LoggerNames["HdWebBleTransport"] = "@onekey/hd-web-ble-transport";
880
881
  LoggerNames["Connect"] = "@onekey/connect";
881
882
  LoggerNames["Iframe"] = "IFrame";
882
883
  LoggerNames["SendMessage"] = "[SendMessage]";
@@ -893,6 +894,7 @@ const LoggerMap = {
893
894
  [exports.LoggerNames.HdBleSdk]: initLog(exports.LoggerNames.HdBleSdk),
894
895
  [exports.LoggerNames.HdTransportHttp]: initLog(exports.LoggerNames.HdTransportHttp),
895
896
  [exports.LoggerNames.HdBleTransport]: initLog(exports.LoggerNames.HdBleTransport),
897
+ [exports.LoggerNames.HdWebBleTransport]: initLog(exports.LoggerNames.HdWebBleTransport),
896
898
  [exports.LoggerNames.HdTransportLowLevel]: initLog(exports.LoggerNames.HdTransportLowLevel),
897
899
  [exports.LoggerNames.Connect]: initLog(exports.LoggerNames.Connect),
898
900
  [exports.LoggerNames.Iframe]: initLog(exports.LoggerNames.Iframe),
@@ -1030,6 +1032,8 @@ const DeviceTypeToModels = {
1030
1032
  [hdShared.EDeviceType.Unknown]: [],
1031
1033
  };
1032
1034
 
1035
+ const existCapability = (features, capability) => { var _a; return (_a = features === null || features === void 0 ? void 0 : features.capabilities) === null || _a === void 0 ? void 0 : _a.includes(capability); };
1036
+
1033
1037
  const getDeviceType = (features) => {
1034
1038
  if (!features || typeof features !== 'object') {
1035
1039
  return hdShared.EDeviceType.Unknown;
@@ -1136,6 +1140,19 @@ const getMethodVersionRange = (features, getVersionRange) => {
1136
1140
  }
1137
1141
  return versionRange;
1138
1142
  };
1143
+ const getFirmwareType = (features) => {
1144
+ var _a;
1145
+ if (!features) {
1146
+ return hdShared.EFirmwareType.Universal;
1147
+ }
1148
+ if (features.fw_vendor === 'OneKey Bitcoin-only') {
1149
+ return hdShared.EFirmwareType.BitcoinOnly;
1150
+ }
1151
+ return ((_a = features === null || features === void 0 ? void 0 : features.capabilities) === null || _a === void 0 ? void 0 : _a.length) > 0 &&
1152
+ !existCapability(features, hdTransport.Enum_Capability.Capability_Bitcoin_like)
1153
+ ? hdShared.EFirmwareType.BitcoinOnly
1154
+ : hdShared.EFirmwareType.Universal;
1155
+ };
1139
1156
 
1140
1157
  const getDeviceFirmwareVersion = (features) => {
1141
1158
  var _a, _b;
@@ -7380,6 +7397,10 @@ var nested$1 = {
7380
7397
  passphrase_state: {
7381
7398
  type: "string",
7382
7399
  id: 8000
7400
+ },
7401
+ is_contains_attach: {
7402
+ type: "bool",
7403
+ id: 8001
7383
7404
  }
7384
7405
  }
7385
7406
  },
@@ -8890,22 +8911,34 @@ var nested$1 = {
8890
8911
  }
8891
8912
  }
8892
8913
  },
8893
- GetPassphraseState: {
8914
+ UnLockDevice: {
8894
8915
  fields: {
8895
- passphrase_state: {
8896
- type: "string",
8916
+ }
8917
+ },
8918
+ UnLockDeviceResponse: {
8919
+ fields: {
8920
+ unlocked: {
8921
+ type: "bool",
8897
8922
  id: 1
8898
8923
  },
8899
- _only_main_pin: {
8924
+ unlocked_attach_pin: {
8900
8925
  type: "bool",
8901
8926
  id: 2
8902
8927
  },
8903
- allow_create_attach_pin: {
8928
+ passphrase_protection: {
8904
8929
  type: "bool",
8905
8930
  id: 3
8906
8931
  }
8907
8932
  }
8908
8933
  },
8934
+ GetPassphraseState: {
8935
+ fields: {
8936
+ passphrase_state: {
8937
+ type: "string",
8938
+ id: 1
8939
+ }
8940
+ }
8941
+ },
8909
8942
  PassphraseState: {
8910
8943
  fields: {
8911
8944
  passphrase_state: {
@@ -13548,7 +13581,9 @@ var nested$1 = {
13548
13581
  MessageType_OnekeyGetFeatures: 10025,
13549
13582
  MessageType_OnekeyFeatures: 10026,
13550
13583
  MessageType_GetPassphraseState: 10028,
13551
- MessageType_PassphraseState: 10029
13584
+ MessageType_PassphraseState: 10029,
13585
+ MessageType_UnLockDevice: 10030,
13586
+ MessageType_UnLockDeviceResponse: 10031
13552
13587
  }
13553
13588
  },
13554
13589
  google: {
@@ -24949,7 +24984,7 @@ DataManager.getTransportStatus = (localVersion) => {
24949
24984
  return isLatest ? 'valid' : 'outdated';
24950
24985
  };
24951
24986
  DataManager.getBridgeChangelog = () => { var _b; return (_b = _a$1.assets) === null || _b === void 0 ? void 0 : _b.bridge.changelog; };
24952
- DataManager.isBleConnect = (env) => env === 'react-native' || env === 'lowlevel';
24987
+ DataManager.isBleConnect = (env) => env === 'react-native' || env === 'lowlevel' || env === 'desktop-web-ble';
24953
24988
  DataManager.isWebUsbConnect = (env) => env === 'webusb';
24954
24989
 
24955
24990
  const PROTOBUF_MESSAGE_CONFIG = {
@@ -25012,19 +25047,19 @@ const supportNewPassphrase = (features) => {
25012
25047
  return { support: semver__default["default"].gte(currentVersion, '2.4.0'), require: '2.4.0' };
25013
25048
  };
25014
25049
  const getPassphraseStateWithRefreshDeviceInfo = (device, options) => __awaiter(void 0, void 0, void 0, function* () {
25050
+ var _a, _b, _c, _d, _e;
25015
25051
  const { features, commands } = device;
25016
25052
  const locked = (features === null || features === void 0 ? void 0 : features.unlocked) === false;
25017
25053
  const { passphraseState, newSession, unlockedAttachPin } = yield getPassphraseState(features, commands, Object.assign({}, options));
25018
- if (newSession && passphraseState && (features === null || features === void 0 ? void 0 : features.device_id)) {
25019
- console.log('=====>>>>>> run updateInternalState newSession:', newSession);
25020
- device.updateInternalState(passphraseState, features.device_id, newSession);
25021
- }
25022
25054
  const isModeT = getDeviceType(features) === hdShared.EDeviceType.Touch || getDeviceType(features) === hdShared.EDeviceType.Pro;
25023
25055
  const needRefreshWithPassphrase = passphraseState && (features === null || features === void 0 ? void 0 : features.passphrase_protection) !== true;
25024
25056
  const needRefreshWithLocked = isModeT && locked;
25025
25057
  if (needRefreshWithLocked || needRefreshWithPassphrase) {
25026
25058
  yield device.getFeatures();
25027
25059
  }
25060
+ if (features === null || features === void 0 ? void 0 : features.device_id) {
25061
+ device.updateInternalState((_b = (_a = device.features) === null || _a === void 0 ? void 0 : _a.passphrase_protection) !== null && _b !== void 0 ? _b : false, passphraseState, (_d = (_c = device.features) === null || _c === void 0 ? void 0 : _c.device_id) !== null && _d !== void 0 ? _d : '', newSession, (_e = device.features) === null || _e === void 0 ? void 0 : _e.session_id);
25062
+ }
25028
25063
  return { passphraseState, newSession, unlockedAttachPin };
25029
25064
  });
25030
25065
  const getPassphraseState = (features, commands, options) => __awaiter(void 0, void 0, void 0, function* () {
@@ -25032,12 +25067,10 @@ const getPassphraseState = (features, commands, options) => __awaiter(void 0, vo
25032
25067
  return { passphraseState: undefined, newSession: undefined, unlockedAttachPin: undefined };
25033
25068
  const firmwareVersion = getDeviceFirmwareVersion(features);
25034
25069
  const deviceType = getDeviceType(features);
25035
- if (deviceType === hdShared.EDeviceType.Pro && semver__default["default"].gte(firmwareVersion.join('.'), '4.14.0')) {
25036
- console.log('=====>>>>>> getPassphraseState begin: ', options === null || options === void 0 ? void 0 : options.onlyMainPin, options === null || options === void 0 ? void 0 : options.expectPassphraseState);
25070
+ if (deviceType === hdShared.EDeviceType.Pro && semver__default["default"].gte(firmwareVersion.join('.'), '4.15.0')) {
25037
25071
  const { message, type } = yield commands.typedCall('GetPassphraseState', 'PassphraseState', {
25038
25072
  passphrase_state: (options === null || options === void 0 ? void 0 : options.onlyMainPin) ? undefined : options === null || options === void 0 ? void 0 : options.expectPassphraseState,
25039
25073
  });
25040
- console.log('=====>>>>>> getPassphraseState end: result ', message);
25041
25074
  if (type === 'CallMethodError') {
25042
25075
  throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, 'Get the passphrase state error');
25043
25076
  }
@@ -25700,6 +25733,8 @@ const UI_REQUEST = {
25700
25733
  CLOSE_UI_WINDOW: 'ui-close_window',
25701
25734
  DEVICE_PROGRESS: 'ui-device_progress',
25702
25735
  BLUETOOTH_PERMISSION: 'ui-bluetooth_permission',
25736
+ BLUETOOTH_UNSUPPORTED: 'ui-bluetooth_unsupported',
25737
+ BLUETOOTH_POWERED_OFF: 'ui-bluetooth_powered_off',
25703
25738
  BLUETOOTH_CHARACTERISTIC_NOTIFY_CHANGE_FAILURE: 'ui-bluetooth_characteristic_notify_change_failure',
25704
25739
  LOCATION_PERMISSION: 'ui-location_permission',
25705
25740
  LOCATION_SERVICE_PERMISSION: 'ui-location_service_permission',
@@ -26040,6 +26075,7 @@ const Log$c = getLogger(exports.LoggerNames.Transport);
26040
26075
  const BleLogger = getLogger(exports.LoggerNames.HdBleTransport);
26041
26076
  const HttpLogger = getLogger(exports.LoggerNames.HdTransportHttp);
26042
26077
  const LowLevelLogger = getLogger(exports.LoggerNames.HdTransportLowLevel);
26078
+ const WebBleLogger = getLogger(exports.LoggerNames.HdWebBleTransport);
26043
26079
  class TransportManager {
26044
26080
  static load() {
26045
26081
  Log$c.debug('transport manager load');
@@ -26067,6 +26103,9 @@ class TransportManager {
26067
26103
  }
26068
26104
  yield this.transport.init(LowLevelLogger, DevicePool.emitter, this.plugin);
26069
26105
  }
26106
+ else if (env === 'desktop-web-ble') {
26107
+ yield this.transport.init(WebBleLogger);
26108
+ }
26070
26109
  else {
26071
26110
  yield this.transport.init(HttpLogger);
26072
26111
  }
@@ -26280,7 +26319,6 @@ class DeviceCommands {
26280
26319
  this.callPromise = promise;
26281
26320
  const res = yield promise;
26282
26321
  Log$b.debug('[DeviceCommands] [call] Received', res.type);
26283
- console.log('[DeviceCommands] [call] Received', res.type);
26284
26322
  return res;
26285
26323
  }
26286
26324
  catch (error) {
@@ -26684,8 +26722,8 @@ class Device extends events.exports {
26684
26722
  }
26685
26723
  getInternalState(_deviceId) {
26686
26724
  var _a, _b;
26687
- Log$a.debug('getInternalState session param: ', `device_id: ${_deviceId}`, `features.device_id: ${(_a = this.features) === null || _a === void 0 ? void 0 : _a.device_id}`, `passphraseState: ${this.passphraseState}`);
26688
26725
  Log$a.debug('getInternalState session cache: ', deviceSessionCache);
26726
+ Log$a.debug('getInternalState session param: ', `device_id: ${_deviceId}`, `features.device_id: ${(_a = this.features) === null || _a === void 0 ? void 0 : _a.device_id}`, `passphraseState: ${this.passphraseState}`);
26689
26727
  const deviceId = _deviceId || ((_b = this.features) === null || _b === void 0 ? void 0 : _b.device_id);
26690
26728
  if (!deviceId)
26691
26729
  return undefined;
@@ -26694,27 +26732,19 @@ class Device extends events.exports {
26694
26732
  const usePassKey = this.generateStateKey(deviceId, this.passphraseState);
26695
26733
  return deviceSessionCache[usePassKey];
26696
26734
  }
26697
- tryFixInternalState(state, deviceId, sessionId = null) {
26698
- Log$a.debug('tryFixInternalState session param: ', `device_id: ${deviceId}`, `passphraseState: ${state}`, `sessionId: ${sessionId}`);
26699
- const key = `${deviceId}`;
26700
- const session = deviceSessionCache[key];
26701
- if (session) {
26702
- deviceSessionCache[this.generateStateKey(deviceId, state)] = session;
26703
- delete deviceSessionCache[key];
26704
- }
26705
- else if (sessionId) {
26706
- deviceSessionCache[this.generateStateKey(deviceId, state)] = sessionId;
26707
- }
26708
- Log$a.debug('tryFixInternalState session cache: ', deviceSessionCache);
26709
- }
26710
- updateInternalState(state, deviceId, sessionId = null) {
26711
- Log$a.debug('updateInternalState session param: ', `device_id: ${deviceId}`, `passphraseState: ${state}`, `sessionId: ${sessionId}`);
26712
- if (sessionId) {
26713
- deviceSessionCache[this.generateStateKey(deviceId, state)] = sessionId;
26714
- const oldKey = `${deviceId}`;
26715
- if (deviceSessionCache[oldKey]) {
26716
- delete deviceSessionCache[oldKey];
26735
+ updateInternalState(enablePassphrase, passphraseState, deviceId, sessionId = null, featuresSessionId = null) {
26736
+ Log$a.debug('updateInternalState session param: ', `device_id: ${deviceId}`, `enablePassphrase: ${enablePassphrase}`, `passphraseState: ${passphraseState}`, `sessionId: ${sessionId}`, `featuresSessionId: ${featuresSessionId}`);
26737
+ if (enablePassphrase) {
26738
+ if (sessionId) {
26739
+ deviceSessionCache[this.generateStateKey(deviceId, passphraseState)] = sessionId;
26717
26740
  }
26741
+ else if (featuresSessionId) {
26742
+ deviceSessionCache[this.generateStateKey(deviceId, passphraseState)] = featuresSessionId;
26743
+ }
26744
+ }
26745
+ const oldKey = `${deviceId}`;
26746
+ if (deviceSessionCache[oldKey]) {
26747
+ delete deviceSessionCache[oldKey];
26718
26748
  }
26719
26749
  Log$a.debug('updateInternalState session cache: ', deviceSessionCache);
26720
26750
  }
@@ -26762,10 +26792,12 @@ class Device extends events.exports {
26762
26792
  payload.derive_cardano = true;
26763
26793
  }
26764
26794
  payload.passphrase_state = options === null || options === void 0 ? void 0 : options.passphraseState;
26765
- console.log('=====>>>>>> initialize device begin: ', payload, {
26795
+ payload.is_contains_attach = true;
26796
+ Log$a.debug('Initialize device begin:', {
26766
26797
  deviceId: options === null || options === void 0 ? void 0 : options.deviceId,
26767
26798
  passphraseState: options === null || options === void 0 ? void 0 : options.passphraseState,
26768
26799
  initSession: options === null || options === void 0 ? void 0 : options.initSession,
26800
+ InitializePayload: payload,
26769
26801
  });
26770
26802
  try {
26771
26803
  const { message } = yield Promise.race([
@@ -26776,7 +26808,7 @@ class Device extends events.exports {
26776
26808
  }, 25 * 1000);
26777
26809
  }),
26778
26810
  ]);
26779
- console.log('=====>>>>>> initialize device end: ', message);
26811
+ Log$a.debug('Initialize device end: ', message);
26780
26812
  this._updateFeatures(message, options === null || options === void 0 ? void 0 : options.initSession);
26781
26813
  yield TransportManager.reconfigure(this.features);
26782
26814
  }
@@ -27034,24 +27066,24 @@ class Device extends events.exports {
27034
27066
  return res.message;
27035
27067
  });
27036
27068
  }
27037
- checkPassphraseStateSafety(passphraseState, useEmptyPassphraseState, skipPassphraseCheck) {
27069
+ checkPassphraseStateSafety(passphraseState, useEmptyPassphrase, skipPassphraseCheck) {
27038
27070
  return __awaiter(this, void 0, void 0, function* () {
27039
27071
  if (!this.features)
27040
27072
  return false;
27041
27073
  const { passphraseState: newPassphraseState, unlockedAttachPin } = yield getPassphraseStateWithRefreshDeviceInfo(this, {
27042
27074
  expectPassphraseState: passphraseState,
27043
- onlyMainPin: useEmptyPassphraseState,
27075
+ onlyMainPin: useEmptyPassphrase,
27044
27076
  });
27045
27077
  if (skipPassphraseCheck) {
27046
27078
  return true;
27047
27079
  }
27048
- const mainWalletUseAttachPin = unlockedAttachPin && useEmptyPassphraseState;
27080
+ const mainWalletUseAttachPin = unlockedAttachPin && useEmptyPassphrase;
27049
27081
  const useErrorAttachPin = unlockedAttachPin && passphraseState && passphraseState !== newPassphraseState;
27050
- console.log('=====>>>>>> checkPassphraseStateSafety passphraseState: ', {
27082
+ Log$a.debug('Check passphrase state safety: ', {
27051
27083
  passphraseState,
27052
27084
  newPassphraseState,
27053
27085
  unlockedAttachPin,
27054
- useEmptyPassphraseState,
27086
+ useEmptyPassphrase,
27055
27087
  });
27056
27088
  if (mainWalletUseAttachPin || useErrorAttachPin) {
27057
27089
  try {
@@ -27329,18 +27361,9 @@ class GetPassphraseState extends BaseMethod {
27329
27361
  return __awaiter(this, void 0, void 0, function* () {
27330
27362
  if (!this.device.features)
27331
27363
  return Promise.reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceInitializeFailed));
27332
- const { passphraseState, newSession } = yield getPassphraseStateWithRefreshDeviceInfo(this.device);
27333
- console.log('=====>>>>>> GetPassphraseState run passphraseState: ', passphraseState);
27334
- console.log('=====>>>>>> GetPassphraseState run newSession: ', newSession);
27335
- console.log('=====>>>>>> GetPassphraseState run features: ', this.device.features.passphrase_protection);
27364
+ const { passphraseState } = yield getPassphraseStateWithRefreshDeviceInfo(this.device);
27336
27365
  const { features } = this.device;
27337
27366
  if (features && features.passphrase_protection === true) {
27338
- if (!newSession) {
27339
- console.log('=====>>>>>> GetPassphraseState run tryFixInternalState', newSession);
27340
- if (passphraseState && features.device_id) {
27341
- this.device.tryFixInternalState(passphraseState, features.device_id, features.session_id);
27342
- }
27343
- }
27344
27367
  return Promise.resolve(passphraseState);
27345
27368
  }
27346
27369
  return Promise.resolve(undefined);
@@ -28615,8 +28638,31 @@ class DeviceUnlock extends BaseMethod {
28615
28638
  init() {
28616
28639
  this.useDevicePassphraseState = false;
28617
28640
  }
28641
+ supportUnlockVersionRange() {
28642
+ return {
28643
+ pro: {
28644
+ min: '4.15.0',
28645
+ },
28646
+ };
28647
+ }
28618
28648
  run() {
28649
+ var _a;
28619
28650
  return __awaiter(this, void 0, void 0, function* () {
28651
+ const firmwareVersion = (_a = getDeviceFirmwareVersion(this.device.features)) === null || _a === void 0 ? void 0 : _a.join('.');
28652
+ const versionRange = getMethodVersionRange(this.device.features, type => this.supportUnlockVersionRange()[type]);
28653
+ if (versionRange && semver__default["default"].gte(firmwareVersion, versionRange.min)) {
28654
+ const res = yield this.device.commands.typedCall('UnLockDevice', 'UnLockDeviceResponse');
28655
+ if (this.device.features) {
28656
+ this.device.features.unlocked = res.message.unlocked == null ? null : res.message.unlocked;
28657
+ this.device.features.unlocked_attach_pin =
28658
+ res.message.unlocked_attach_pin == null ? undefined : res.message.unlocked_attach_pin;
28659
+ this.device.features.passphrase_protection =
28660
+ res.message.passphrase_protection == null ? null : res.message.passphrase_protection;
28661
+ return Promise.resolve(this.device.features);
28662
+ }
28663
+ const featuresRes = yield this.device.commands.typedCall('GetFeatures', 'Features');
28664
+ return Promise.resolve(featuresRes.message);
28665
+ }
28620
28666
  const { type } = yield this.device.commands.typedCall('GetAddress', 'Address', {
28621
28667
  address_n: [toHardened(44), toHardened(1), toHardened(0), 0, 0],
28622
28668
  coin_name: 'Testnet',
@@ -28776,7 +28822,7 @@ class FirmwareUpdate extends BaseMethod {
28776
28822
  if (e instanceof hdShared.HardwareError) {
28777
28823
  return Promise.reject(e);
28778
28824
  }
28779
- console.log('auto go to bootloader mode failed: ', e);
28825
+ Log$7.log('auto go to bootloader mode failed: ', e);
28780
28826
  return Promise.reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.FirmwareUpdateAutoEnterBootFailure));
28781
28827
  }
28782
28828
  }
@@ -29584,6 +29630,8 @@ class FirmwareUpdateV3 extends FirmwareUpdateBaseMethod {
29584
29630
  hdShared.HardwareErrorCode.ActionCancelled,
29585
29631
  hdShared.HardwareErrorCode.BleDeviceNotBonded,
29586
29632
  hdShared.HardwareErrorCode.BleServiceNotFound,
29633
+ hdShared.HardwareErrorCode.BlePoweredOff,
29634
+ hdShared.HardwareErrorCode.BleUnsupported,
29587
29635
  hdShared.HardwareErrorCode.BlePermissionError,
29588
29636
  hdShared.HardwareErrorCode.BleLocationError,
29589
29637
  hdShared.HardwareErrorCode.BleDeviceBondError,
@@ -33275,8 +33323,6 @@ class StellarSignTransaction extends BaseMethod {
33275
33323
  this.operations.push(transformed);
33276
33324
  }
33277
33325
  });
33278
- console.log('StellarSignTransactionParams', this.params);
33279
- console.log('StellarSignTransactionOperations', this.operations);
33280
33326
  }
33281
33327
  run() {
33282
33328
  return __awaiter(this, void 0, void 0, function* () {
@@ -38542,6 +38588,7 @@ const onCallDevice = (context, message, method) => __awaiter(void 0, void 0, voi
38542
38588
  DevicePool.clearDeviceCache(method.payload.connectId);
38543
38589
  return Promise.reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceCheckPassphraseStateError));
38544
38590
  }
38591
+ postMessage(createUiMessage(UI_REQUEST.CLOSE_UI_WINDOW));
38545
38592
  }
38546
38593
  try {
38547
38594
  yield method.checkSafetyLevelOnTestNet();
@@ -38770,6 +38817,8 @@ const ensureConnected = (_context, method, pollingId, abortSignal) => __awaiter(
38770
38817
  postMessage(createUiMessage(UI_REQUEST.BLUETOOTH_CHARACTERISTIC_NOTIFY_CHANGE_FAILURE));
38771
38818
  }
38772
38819
  if ([
38820
+ hdShared.HardwareErrorCode.BlePoweredOff,
38821
+ hdShared.HardwareErrorCode.BleUnsupported,
38773
38822
  hdShared.HardwareErrorCode.BlePermissionError,
38774
38823
  hdShared.HardwareErrorCode.BleLocationError,
38775
38824
  hdShared.HardwareErrorCode.BleLocationServicesDisabled,
@@ -38868,11 +38917,13 @@ const cancel = (context, connectId) => {
38868
38917
  const checkPassphraseEnableState = (method, features) => {
38869
38918
  if (!method.useDevicePassphraseState)
38870
38919
  return;
38871
- if ((features === null || features === void 0 ? void 0 : features.passphrase_protection) === true &&
38872
- (method.payload.passphraseState == null || method.payload.passphraseState === '') &&
38873
- (!method.payload.useEmptyPassphrase || !method.payload.skipPassphraseCheck)) {
38874
- DevicePool.clearDeviceCache(method.payload.connectId);
38875
- throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceOpenedPassphrase);
38920
+ if ((features === null || features === void 0 ? void 0 : features.passphrase_protection) === true) {
38921
+ const hasNoPassphraseState = method.payload.passphraseState == null || method.payload.passphraseState === '';
38922
+ const shouldRequirePassphrase = !method.payload.useEmptyPassphrase && !method.payload.skipPassphraseCheck;
38923
+ if (hasNoPassphraseState && shouldRequirePassphrase) {
38924
+ DevicePool.clearDeviceCache(method.payload.connectId);
38925
+ throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceOpenedPassphrase);
38926
+ }
38876
38927
  }
38877
38928
  if ((features === null || features === void 0 ? void 0 : features.passphrase_protection) === false && method.payload.passphraseState) {
38878
38929
  DevicePool.clearDeviceCache(method.payload.connectId);
@@ -39006,6 +39057,8 @@ class Core extends events.exports {
39006
39057
  }
39007
39058
  break;
39008
39059
  }
39060
+ case UI_REQUEST.BLUETOOTH_UNSUPPORTED:
39061
+ case UI_REQUEST.BLUETOOTH_POWERED_OFF:
39009
39062
  case UI_REQUEST.BLUETOOTH_PERMISSION:
39010
39063
  case UI_REQUEST.BLUETOOTH_CHARACTERISTIC_NOTIFY_CHANGE_FAILURE:
39011
39064
  case UI_REQUEST.LOCATION_PERMISSION:
@@ -39147,6 +39200,7 @@ exports.getDeviceType = getDeviceType;
39147
39200
  exports.getDeviceTypeByBleName = getDeviceTypeByBleName;
39148
39201
  exports.getDeviceUUID = getDeviceUUID;
39149
39202
  exports.getEnv = getEnv;
39203
+ exports.getFirmwareType = getFirmwareType;
39150
39204
  exports.getFirmwareUpdateField = getFirmwareUpdateField;
39151
39205
  exports.getFirmwareUpdateFieldArray = getFirmwareUpdateFieldArray;
39152
39206
  exports.getHDPath = getHDPath;
@@ -12,7 +12,7 @@ export type ConnectSettings = {
12
12
  priority: number;
13
13
  trustedHost: boolean;
14
14
  supportedBrowser?: boolean;
15
- env: 'node' | 'web' | 'webextension' | 'electron' | 'react-native' | 'webusb' | 'lowlevel';
15
+ env: 'node' | 'web' | 'webextension' | 'electron' | 'react-native' | 'webusb' | 'emulator' | 'desktop-web-ble' | 'lowlevel';
16
16
  timestamp: number;
17
17
  isFrame?: boolean;
18
18
  pre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,OAAO,EAAE,aAAa,CAAC;QACvB,UAAU,EAAE,MAAM,CAAC;QACnB,UAAU,EAAE,MAAM,CAAC;QACnB,UAAU,EAAE,MAAM,CAAC;QACnB,UAAU,EAAE,MAAM,CAAC;QACnB,GAAG,EAAE,MAAM,CAAC;QACZ,GAAG,EAAE,MAAM,CAAC;QACZ,YAAY,EAAE,MAAM,CAAC;QACrB,SAAS,EAAE;aACR,CAAC,IAAI,OAAO,GAAG,MAAM;SACvB,CAAC;KACH,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,MAAM,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC;CAC7B,GAAG,aAAa,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { Enum_Capability } from '@onekeyfe/hd-transport';
2
+ import { Features } from '../types/device';
3
+ export declare const existCapability: (features: Features, capability: Enum_Capability) => boolean;
4
+ export declare const requireCapability: (features: Features, capability: Enum_Capability) => void;
5
+ //# sourceMappingURL=capabilitieUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capabilitieUtils.d.ts","sourceRoot":"","sources":["../../src/utils/capabilitieUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3C,eAAO,MAAM,eAAe,aAAc,QAAQ,cAAc,eAAe,YAEjC,CAAC;AAE/C,eAAO,MAAM,iBAAiB,aAAc,QAAQ,cAAc,eAAe,SAIhF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"deviceFeaturesUtils.d.ts","sourceRoot":"","sources":["../../src/utils/deviceFeaturesUtils.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAE7D,OAAoB,EAAE,cAAc,EAAE,c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,eAAO,MAAM,uBAAuB,cAAe,QAAQ,KAAG,kBAU7D,CAAC;AAKF,eAAO,MAAM,sBAAsB;cAKvB,QAAQ;gBACN,UAAU,GAAG,KAAK;;MAE5B,KAAK,GAAG,cAyBX,CAAC;AAMF,eAAO,MAAM,2BAA2B,aAC5B,QAAQ,cACN,UAAU,GAAG,KAAK,GAAG,YAAY,KAC5C,CAAC,UAAU,GAAG,KAAK,GAAG,aAAa,GAAG,aAAa,CAAC,EAkCtD,CAAC;AAEF,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,UASzC;AAED,eAAO,MAAM,0BAA0B,aAAc,QAAQ,KAAG,QAc/D,CAAC"}
@@ -1,3 +1,4 @@
1
+ import { EFirmwareType } from '@onekeyfe/hd-shared';
1
2
  import type { Features, IDeviceModel, IDeviceType, IVersionRange } from '../types';
2
3
  export declare const getDeviceType: (features?: Features) => IDeviceType;
3
4
  export declare const getDeviceTypeByBleName: (name?: string) => IDeviceType;
@@ -5,4 +6,5 @@ export declare const getDeviceBleName: (features?: Features) => string | null;
5
6
  export declare const getDeviceUUID: (features: Features) => string;
6
7
  export declare const getDeviceLabel: (features?: Features) => string | null;
7
8
  export declare const getMethodVersionRange: (features: Features | undefined, getVersionRange: (deviceModel: IDeviceType | IDeviceModel) => IVersionRange | undefined) => IVersionRange | undefined;
9
+ export declare const getFirmwareType: (features: Features | undefined) => EFirmwareType;
8
10
  //# sourceMappingURL=deviceInfoUtils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"deviceInfoUtils.d.ts","sourceRoot":"","sources":["../../src/utils/deviceInfoUtils.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAKnF,eAAO,MAAM,aAAa,cAAe,QAAQ,KAAG,WAiDnD,CAAC;AAMF,eAAO,MAAM,sBAAsB,UAAW,MAAM,KAAG,WAYtD,CAAC;AAMF,eAAO,MAAM,gBAAgB,cAAe,QAAQ,KAAG,MAAM,GAAG,IAG/D,CAAC;AAKF,eAAO,MAAM,aAAa,aAAc,QAAQ,WAG/C,CAAC;AAKF,eAAO,MAAM,cAAc,cAAe,QAAQ,kBAkBjD,CAAC;AAMF,eAAO,MAAM,qBAAqB,aACtB,QAAQ,GAAG,SAAS,iCACC,WAAW,GAAG,YAAY,KAAK,aAAa,GAAG,SAAS,KACtF,aAAa,GAAG,SAwBlB,CAAC"}
1
+ {"version":3,"file":"deviceInfoUtils.d.ts","sourceRoot":"","sources":["../../src/utils/deviceInfoUtils.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAIjE,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAMnF,eAAO,MAAM,aAAa,cAAe,QAAQ,KAAG,WAiDnD,CAAC;AAMF,eAAO,MAAM,sBAAsB,UAAW,MAAM,KAAG,WAYtD,CAAC;AAMF,eAAO,MAAM,gBAAgB,cAAe,QAAQ,KAAG,MAAM,GAAG,IAG/D,CAAC;AAKF,eAAO,MAAM,aAAa,aAAc,QAAQ,WAG/C,CAAC;AAKF,eAAO,MAAM,cAAc,cAAe,QAAQ,kBAkBjD,CAAC;AAMF,eAAO,MAAM,qBAAqB,aACtB,QAAQ,GAAG,SAAS,iCACC,WAAW,GAAG,YAAY,KAAK,aAAa,GAAG,SAAS,KACtF,aAAa,GAAG,SAwBlB,CAAC;AAEF,eAAO,MAAM,eAAe,aAAc,QAAQ,GAAG,SAAS,kBAY7D,CAAC"}
@@ -2,7 +2,7 @@ export { getLogger, enableLog, LoggerNames, getLog, setLoggerPostMessage } from
2
2
  export * from './assets';
3
3
  export * from './versionUtils';
4
4
  export * from './patch';
5
- export { getDeviceTypeByBleName, getDeviceType, getDeviceBleName, getDeviceUUID, getDeviceLabel, getMethodVersionRange, } from './deviceInfoUtils';
5
+ export { getDeviceTypeByBleName, getDeviceType, getDeviceBleName, getDeviceUUID, getDeviceLabel, getMethodVersionRange, getFirmwareType, } from './deviceInfoUtils';
6
6
  export { getDeviceBoardloaderVersion, getDeviceBootloaderVersion, getDeviceFirmwareVersion, getDeviceBLEFirmwareVersion, } from './deviceVersionUtils';
7
7
  export { getFirmwareUpdateField, supportInputPinOnSoftware, getFirmwareUpdateFieldArray, } from './deviceFeaturesUtils';
8
8
  export { checkNeedUpdateBootForTouch, checkNeedUpdateBootForClassicAndMini, } from '../api/firmware/updateBootloader';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAC3F,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AAExB,OAAO,EACL,sBAAsB,EACtB,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,qBAAqB,GACtB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,2BAA2B,EAC3B,0BAA0B,EAC1B,wBAAwB,EACxB,2BAA2B,GAC5B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,sBAAsB,EACtB,yBAAyB,EACzB,2BAA2B,GAC5B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,2BAA2B,EAC3B,oCAAoC,GACrC,MAAM,kCAAkC,CAAC;AAI1C,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAEzF,eAAO,MAAM,YAAY,QAAS,MAAM,YAAiD,CAAC;AAE1F,OAAO,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAE7F,eAAO,MAAM,IAAI,OAAQ,MAAM,qBAG3B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAC3F,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AAExB,OAAO,EACL,sBAAsB,EACtB,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,qBAAqB,EACrB,eAAe,GAChB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,2BAA2B,EAC3B,0BAA0B,EAC1B,wBAAwB,EACxB,2BAA2B,GAC5B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,sBAAsB,EACtB,yBAAyB,EACzB,2BAA2B,GAC5B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,2BAA2B,EAC3B,oCAAoC,GACrC,MAAM,kCAAkC,CAAC;AAI1C,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAEzF,eAAO,MAAM,YAAY,QAAS,MAAM,YAAiD,CAAC;AAE1F,OAAO,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAE7F,eAAO,MAAM,IAAI,OAAQ,MAAM,qBAG3B,CAAC"}
@@ -34,6 +34,7 @@ export declare enum LoggerNames {
34
34
  HdTransportHttp = "@onekey/hd-transport-http",
35
35
  HdTransportLowLevel = "@onekey/hd-transport-lowlevel",
36
36
  HdBleTransport = "@onekey/hd-ble-transport",
37
+ HdWebBleTransport = "@onekey/hd-web-ble-transport",
37
38
  Connect = "@onekey/connect",
38
39
  Iframe = "IFrame",
39
40
  SendMessage = "[SendMessage]",
@@ -50,6 +51,7 @@ export declare const LoggerMap: {
50
51
  "@onekey/hd-ble-sdk": Log;
51
52
  "@onekey/hd-transport-http": Log;
52
53
  "@onekey/hd-ble-transport": Log;
54
+ "@onekey/hd-web-ble-transport": Log;
53
55
  "@onekey/hd-transport-lowlevel": Log;
54
56
  "@onekey/connect": Log;
55
57
  IFrame: Log;
@@ -1 +1 @@
1
- {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAGxC,KAAK,UAAU,GAAG;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,GAAG,EAAE,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAMF,cAAM,GAAG;IACP,MAAM,EAAE,MAAM,CAAC;IAEf,OAAO,EAAE,OAAO,CAAC;IAEjB,QAAQ,EAAE,UAAU,EAAE,CAAC;gBAEX,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO;IAM5C,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE;IAYxD,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;IASlB,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;IASpB,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;IASnB,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;CAQrB;AAID,eAAO,MAAM,OAAO,WAAY,MAAM,YAAY,OAAO,QAIxD,CAAC;AAEF,eAAO,MAAM,SAAS,aAAc,OAAO,SAI1C,CAAC;AAEF,eAAO,MAAM,iBAAiB,WAAY,MAAM,WAAW,OAAO,SAIjE,CAAC;AAEF,eAAO,MAAM,MAAM,oBAOlB,CAAC;AAEF,eAAO,MAAM,oBAAoB,4BAA6B,WAAW,KAAK,IAAI,SAEjF,CAAC;AAuCF,oBAAY,WAAW;IACrB,IAAI,oBAAoB;IACxB,SAAS,cAAc;IACvB,MAAM,W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