@onekeyfe/hd-core 1.2.8-alpha.7 → 1.2.8-alpha.9

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,5 +1,6 @@
1
1
  import { EDeviceType } from '@onekeyfe/hd-shared';
2
2
 
3
+ import DeviceReboot from '../src/api/protocol-v2/DeviceReboot';
3
4
  import { Device } from '../src/device/Device';
4
5
  import { UI_REQUEST } from '../src/events/ui-request';
5
6
 
@@ -25,6 +26,17 @@ const createBootloaderDevice = (protocolType: 'V1' | 'V2') => {
25
26
  };
26
27
 
27
28
  describe('Pro2 bootloader mode', () => {
29
+ test('allows deviceReboot to return a Protocol V2 bootloader to normal mode', () => {
30
+ const device = createBootloaderDevice('V2');
31
+ const method = new DeviceReboot({
32
+ id: 1,
33
+ payload: { method: 'deviceReboot', rebootType: 'normal' },
34
+ });
35
+ method.init();
36
+
37
+ expect(device.hasUnexpectedMode(method.allowDeviceMode, method.requireDeviceMode)).toBeNull();
38
+ });
39
+
28
40
  test('blocks Protocol V2 methods that are not allowed in bootloader mode', () => {
29
41
  const device = createBootloaderDevice('V2');
30
42
 
@@ -1 +1 @@
1
- {"version":3,"file":"DeviceReboot.d.ts","sourceRoot":"","sources":["../../../src/api/protocol-v2/DeviceReboot.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAEpD,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,UAAU,CAAC,kBAAkB,CAAC;IACtE,qBAAqB;IAIrB,IAAI;IAYE,GAAG;CAQV"}
1
+ {"version":3,"file":"DeviceReboot.d.ts","sourceRoot":"","sources":["../../../src/api/protocol-v2/DeviceReboot.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAEpD,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,UAAU,CAAC,kBAAkB,CAAC;IACtE,qBAAqB;IAIrB,IAAI;IAaE,GAAG;CAQV"}
package/dist/index.js CHANGED
@@ -54852,6 +54852,7 @@ class DeviceReboot extends BaseMethod {
54852
54852
  return ['V2'];
54853
54853
  }
54854
54854
  init() {
54855
+ this.allowDeviceMode.push(UI_REQUEST.BOOTLOADER);
54855
54856
  this.skipForceUpdateCheck = true;
54856
54857
  this.useDevicePassphraseState = false;
54857
54858
  this.unlockPolicy = 'unlock-before-run';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/hd-core",
3
- "version": "1.2.8-alpha.7",
3
+ "version": "1.2.8-alpha.9",
4
4
  "description": "Core processes and APIs for communicating with OneKey hardware devices.",
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": "1.2.8-alpha.7",
29
- "@onekeyfe/hd-transport": "1.2.8-alpha.7",
28
+ "@onekeyfe/hd-shared": "1.2.8-alpha.9",
29
+ "@onekeyfe/hd-transport": "1.2.8-alpha.9",
30
30
  "axios": "1.15.2",
31
31
  "bignumber.js": "^9.0.2",
32
32
  "buffer": "^6.0.3",
@@ -46,5 +46,5 @@
46
46
  "@types/w3c-web-usb": "^1.0.10",
47
47
  "@types/web-bluetooth": "^0.0.21"
48
48
  },
49
- "gitHead": "1d94e4a83f9a145af366094a63308370465f9a73"
49
+ "gitHead": "37659eef6ee06b7aa07faeb8f791f884b1b3e890"
50
50
  }
@@ -1,5 +1,6 @@
1
1
  import { DeviceSessionPinType } from '@onekeyfe/hd-transport';
2
2
 
3
+ import { UI_REQUEST } from '../../constants/ui-request';
3
4
  import { BaseMethod } from '../BaseMethod';
4
5
  import { normalizeRebootType } from './helpers';
5
6
 
@@ -11,6 +12,7 @@ export default class DeviceReboot extends BaseMethod<DeviceRebootParams> {
11
12
  }
12
13
 
13
14
  init() {
15
+ this.allowDeviceMode.push(UI_REQUEST.BOOTLOADER);
14
16
  this.skipForceUpdateCheck = true;
15
17
  this.useDevicePassphraseState = false;
16
18
  this.unlockPolicy = 'unlock-before-run';