@onekeyfe/hd-core 1.2.8-alpha.4 → 1.2.8-alpha.6
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,11 +1,12 @@
|
|
|
1
|
-
import { EFirmwareType, HardwareErrorCode } from '@onekeyfe/hd-shared';
|
|
1
|
+
import { EDeviceType, EFirmwareType, HardwareErrorCode } from '@onekeyfe/hd-shared';
|
|
2
2
|
|
|
3
3
|
import BTCDeriveContextHash from '../src/api/btc/BTCDeriveContextHash';
|
|
4
4
|
import { findMethod } from '../src/api/utils';
|
|
5
5
|
import { getLogBlockLabel, getSafeLogPayload } from '../src/events/logBlockEvent';
|
|
6
6
|
import { createCoreApi } from '../src/inject';
|
|
7
|
+
import { Device } from '../src/device/Device';
|
|
7
8
|
|
|
8
|
-
import type {
|
|
9
|
+
import type { DeviceFirmwareRange } from '../src/types';
|
|
9
10
|
|
|
10
11
|
jest.mock('../src/data/config', () => ({
|
|
11
12
|
getSDKVersion: jest.fn(() => '1.0.0'),
|
|
@@ -133,12 +134,36 @@ describe('btcDeriveContextHash', () => {
|
|
|
133
134
|
method.init();
|
|
134
135
|
expect(method).toBeInstanceOf(BTCDeriveContextHash);
|
|
135
136
|
expect(method.strictCheckDeviceSupport).toBe(true);
|
|
136
|
-
expect(method.getVersionRange()).toEqual({ classic1s: { min: '3.21.0' } });
|
|
137
137
|
expect(() => method.assertProtocolSupported('V2', EFirmwareType.Universal)).toThrow(
|
|
138
138
|
expect.objectContaining({ errorCode: HardwareErrorCode.DeviceNotSupportMethod })
|
|
139
139
|
);
|
|
140
140
|
});
|
|
141
141
|
|
|
142
|
+
test.each([EDeviceType.Classic1s, EDeviceType.ClassicPure])(
|
|
143
|
+
'resolves the firmware requirement for %s through the device support check',
|
|
144
|
+
deviceType => {
|
|
145
|
+
const method = createMethod();
|
|
146
|
+
const device = Object.create(Device.prototype) as Device;
|
|
147
|
+
device.getCurrentDeviceType = jest.fn(() => deviceType);
|
|
148
|
+
const range: DeviceFirmwareRange = method.getVersionRange();
|
|
149
|
+
|
|
150
|
+
expect(device.getCurrentMethodVersionRange(type => range[type])).toEqual({ min: '3.21.0' });
|
|
151
|
+
expect(() => method.assertProtocolSupported('V1', EFirmwareType.Universal)).not.toThrow();
|
|
152
|
+
}
|
|
153
|
+
);
|
|
154
|
+
|
|
155
|
+
test.each([EDeviceType.Classic, EDeviceType.Mini, EDeviceType.Touch, EDeviceType.Pro])(
|
|
156
|
+
'keeps %s outside the supported firmware range',
|
|
157
|
+
deviceType => {
|
|
158
|
+
const method = createMethod();
|
|
159
|
+
const device = Object.create(Device.prototype) as Device;
|
|
160
|
+
device.getCurrentDeviceType = jest.fn(() => deviceType);
|
|
161
|
+
const range: DeviceFirmwareRange = method.getVersionRange();
|
|
162
|
+
|
|
163
|
+
expect(device.getCurrentMethodVersionRange(type => range[type])).toBeUndefined();
|
|
164
|
+
}
|
|
165
|
+
);
|
|
166
|
+
|
|
142
167
|
test('propagates device rejection without returning a secret', async () => {
|
|
143
168
|
const method = createMethod();
|
|
144
169
|
method.init();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BTCDeriveContextHash.d.ts","sourceRoot":"","sources":["../../../src/api/btc/BTCDeriveContextHash.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAI3C,OAAO,KAAK,EAAE,wBAAwB,EAA2B,MAAM,wBAAwB,CAAC;AAUhG,MAAM,CAAC,OAAO,OAAO,oBAAqB,SAAQ,UAAU,CAAC,wBAAwB,CAAC;IACpF,wBAAwB,UAAQ;IAEhC,IAAI;IAgDJ,eAAe
|
|
1
|
+
{"version":3,"file":"BTCDeriveContextHash.d.ts","sourceRoot":"","sources":["../../../src/api/btc/BTCDeriveContextHash.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAI3C,OAAO,KAAK,EAAE,wBAAwB,EAA2B,MAAM,wBAAwB,CAAC;AAUhG,MAAM,CAAC,OAAO,OAAO,oBAAqB,SAAQ,UAAU,CAAC,wBAAwB,CAAC;IACpF,wBAAwB,UAAQ;IAEhC,IAAI;IAgDJ,eAAe;;;;;;;;IAOT,GAAG;CAcV"}
|
package/dist/index.js
CHANGED
|
@@ -57239,7 +57239,10 @@ class BTCDeriveContextHash extends BaseMethod {
|
|
|
57239
57239
|
};
|
|
57240
57240
|
}
|
|
57241
57241
|
getVersionRange() {
|
|
57242
|
-
return {
|
|
57242
|
+
return {
|
|
57243
|
+
classic1s: { min: '3.21.0' },
|
|
57244
|
+
classicpure: { min: '3.21.0' },
|
|
57245
|
+
};
|
|
57243
57246
|
}
|
|
57244
57247
|
run() {
|
|
57245
57248
|
return __awaiter(this, void 0, void 0, function* () {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/hd-core",
|
|
3
|
-
"version": "1.2.8-alpha.
|
|
3
|
+
"version": "1.2.8-alpha.6",
|
|
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.
|
|
29
|
-
"@onekeyfe/hd-transport": "1.2.8-alpha.
|
|
28
|
+
"@onekeyfe/hd-shared": "1.2.8-alpha.6",
|
|
29
|
+
"@onekeyfe/hd-transport": "1.2.8-alpha.6",
|
|
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": "
|
|
49
|
+
"gitHead": "eba2e870aaf79093ba41c67eb616f7239527a84b"
|
|
50
50
|
}
|
|
@@ -67,7 +67,10 @@ export default class BTCDeriveContextHash extends BaseMethod<BabylonDeriveContex
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
getVersionRange() {
|
|
70
|
-
return {
|
|
70
|
+
return {
|
|
71
|
+
classic1s: { min: '3.21.0' },
|
|
72
|
+
classicpure: { min: '3.21.0' },
|
|
73
|
+
};
|
|
71
74
|
}
|
|
72
75
|
|
|
73
76
|
async run() {
|