@onekeyfe/hd-core 0.3.34 → 0.3.36
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.
- package/dist/api/CheckBootloaderRelease.d.ts.map +1 -1
- package/dist/api/CheckBridgeRelease.d.ts.map +1 -1
- package/dist/api/FirmwareUpdateV2.d.ts.map +1 -1
- package/dist/api/device/DeviceVerify.d.ts.map +1 -1
- package/dist/api/evm/EVMSignTypedData.d.ts +1 -1
- package/dist/api/evm/EVMSignTypedData.d.ts.map +1 -1
- package/dist/api/firmware/updateBootloader.d.ts.map +1 -1
- package/dist/data-manager/DataManager.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +20 -19
- package/dist/types/device.d.ts +1 -1
- package/dist/types/device.d.ts.map +1 -1
- package/dist/utils/deviceFeaturesUtils.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/api/CheckBootloaderRelease.ts +3 -1
- package/src/api/CheckBridgeRelease.ts +3 -1
- package/src/api/FirmwareUpdateV2.ts +4 -2
- package/src/api/device/DeviceVerify.ts +2 -1
- package/src/api/evm/EVMSignTypedData.ts +7 -3
- package/src/api/firmware/updateBootloader.ts +2 -2
- package/src/api/nostr/NostrDecryptMessage.ts +1 -1
- package/src/api/nostr/NostrEncryptMessage.ts +1 -1
- package/src/api/nostr/NostrGetPublicKey.ts +1 -1
- package/src/api/nostr/NostrSignEvent.ts +1 -1
- package/src/api/nostr/NostrSignSchnorr.ts +1 -1
- package/src/data-manager/DataManager.ts +4 -3
- package/src/types/device.ts +9 -5
- package/src/utils/deviceFeaturesUtils.ts +4 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckBootloaderRelease.d.ts","sourceRoot":"","sources":["../../src/api/CheckBootloaderRelease.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"CheckBootloaderRelease.d.ts","sourceRoot":"","sources":["../../src/api/CheckBootloaderRelease.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAW1C,MAAM,CAAC,OAAO,OAAO,sBAAuB,SAAQ,UAAU;IAC5D,IAAI;IAME,GAAG;;;;;CAuBV"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckBridgeRelease.d.ts","sourceRoot":"","sources":["../../src/api/CheckBridgeRelease.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"CheckBridgeRelease.d.ts","sourceRoot":"","sources":["../../src/api/CheckBridgeRelease.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAU1C,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,UAAU;IACxD,IAAI;IAME,GAAG;;;;;CAwDV"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FirmwareUpdateV2.d.ts","sourceRoot":"","sources":["../../src/api/FirmwareUpdateV2.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,EAIT,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"FirmwareUpdateV2.d.ts","sourceRoot":"","sources":["../../src/api/FirmwareUpdateV2.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,EAIT,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAW1C,OAAO,KAAK,EAAe,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEtD,KAAK,MAAM,GAAG;IACZ,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,UAAU,EAAE,UAAU,GAAG,KAAK,CAAC;IAC/B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B,CAAC;AAIF,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,UAAU,CAAC,MAAM,CAAC;IAC9D,YAAY,EAAE,QAAQ,CAAC,GAAG,CAAC,GAAG,IAAI,CAAQ;IAE1C,IAAI;IA2CJ,cAAc,YAAa,MAAM,UAS/B;IAEF,uBAAuB,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS;IAsDrD,qBAAqB,CAAC,QAAQ,EAAE,QAAQ;IAUxC,uBAAuB,CAAC,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM;IAc9D,gCAAgC,CAAC,QAAQ,CAAC,EAAE,QAAQ;IAwB9C,GAAG;CAyGV"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeviceVerify.d.ts","sourceRoot":"","sources":["../../../src/api/device/DeviceVerify.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAIlE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"DeviceVerify.d.ts","sourceRoot":"","sources":["../../../src/api/device/DeviceVerify.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAIlE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAI3C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAEzD,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,UAAU,CAAC,wBAAwB,CAAC;IAC5E,IAAI;IAYE,GAAG;CAoCV"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MessageKey, MessageResponse, TypedCall } from '@onekeyfe/hd-transport';
|
|
2
2
|
import { BaseMethod } from '../BaseMethod';
|
|
3
|
-
import type
|
|
3
|
+
import { type EthereumSignTypedDataMessage, type EthereumSignTypedDataTypes } from '../../types';
|
|
4
4
|
export type EVMSignTypedDataParams = {
|
|
5
5
|
addressN: number[];
|
|
6
6
|
metamaskV4Compat: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EVMSignTypedData.d.ts","sourceRoot":"","sources":["../../../src/api/evm/EVMSignTypedData.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,UAAU,EACV,eAAe,EACf,SAAS,EACV,MAAM,wBAAwB,CAAC;AAIhC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAI3C,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"EVMSignTypedData.d.ts","sourceRoot":"","sources":["../../../src/api/evm/EVMSignTypedData.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,UAAU,EACV,eAAe,EACf,SAAS,EACV,MAAM,wBAAwB,CAAC;AAIhC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAI3C,OAAO,EAEL,KAAK,4BAA4B,EACjC,KAAK,0BAA0B,EAChC,MAAM,aAAa,CAAC;AAQrB,MAAM,MAAM,sBAAsB,GAAG;IACnC,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,IAAI,EAAE,4BAA4B,CAAC,0BAA0B,CAAC,CAAC;IAC/D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,UAAU,CAAC,sBAAsB,CAAC;IAC9E,IAAI;IAqCE,mBAAmB,CAAC,EACxB,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,aAAa,GACd,EAAE;QACD,SAAS,EAAE,SAAS,CAAC;QACrB,QAAQ,EAAE,4BAA4B,CAAC,0BAA0B,CAAC,CAAC;QACnE,QAAQ,EAAE,eAAe,CAAC,UAAU,CAAC,CAAC;QACtC,aAAa,EAAE,OAAO,CAAC;KACxB;;;;IAuIK,aAAa;;;;IAsCnB,aAAa,CAAC,EACZ,SAAS,EACT,QAAQ,EACR,OAAO,EACP,UAAU,EACV,WAAW,GACZ,EAAE;QACD,SAAS,EAAE,SAAS,CAAC;QACrB,QAAQ,EAAE,MAAM,EAAE,CAAC;QACnB,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;QAC5B,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;QAC/B,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;KACjC;IA2BD,eAAe;;;;;IAQf,aAAa,CAAC,IAAI,EAAE,4BAA4B,CAAC,0BAA0B,CAAC;IAiB5E,eAAe,CAAC,IAAI,EAAE,GAAG,GAAG,OAAO;IA8BnC,gBAAgB;IAcV,GAAG;CAqEV"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateBootloader.d.ts","sourceRoot":"","sources":["../../../src/api/firmware/updateBootloader.ts"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"updateBootloader.d.ts","sourceRoot":"","sources":["../../../src/api/firmware/updateBootloader.ts"],"names":[],"mappings":"AAEA,OAAO,EAAsB,QAAQ,EAAE,MAAM,aAAa,CAAC;AAS3D,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,QAAQ,WAgB7D;AAED,wBAAgB,oCAAoC,CAClD,QAAQ,EAAE,QAAQ,EAClB,kBAAkB,EAAE,MAAM,WAuB3B;AAGD,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,WAAW,WAiBtD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataManager.d.ts","sourceRoot":"","sources":["../../src/data-manager/DataManager.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EACV,SAAS,EACT,eAAe,EACf,aAAa,EACb,QAAQ,EACR,wBAAwB,EACxB,qBAAqB,EACrB,gBAAgB,EAChB,aAAa,EAE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;;;QAWlD;IAEF,MAAM,CAAC,2BAA2B,aAAc,QAAQ,4DAItD;IAEF,MAAM,CAAC,kBAAkB,iBAAkB,MAAM,KAAG,gBAAgB,CAKlE;WAEW,IAAI,CAAC,QAAQ,EAAE,eAAe;WAgC9B,kBAAkB;IAQ/B,MAAM,CAAC,mBAAmB,CAAC,cAAc,GAAE,cAAyB,GAAG,IAAI;IAI3E,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,SAAS,GAAG,eAAe;IAEpD,MAAM,CAAC,WAAW,CAAC,CAAC,SAAS,MAAM,eAAe,EAAE,GAAG,EAAE,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC;IAU/E,MAAM,CAAC,YAAY,QAAS,eAAe,CAAC,KAAK,CAAC,aACH;CAChD"}
|
package/dist/index.d.ts
CHANGED
|
@@ -83,7 +83,7 @@ type SearchDevice = {
|
|
|
83
83
|
type Device$1 = KnownDevice;
|
|
84
84
|
type Features = Messages.Features;
|
|
85
85
|
type IDeviceType = 'classic' | 'classic1s' | 'mini' | 'touch' | 'pro';
|
|
86
|
-
type IDeviceModel = 'model_mini' | 'model_touch';
|
|
86
|
+
type IDeviceModel = 'model_classic' | 'model_mini' | 'model_touch';
|
|
87
87
|
declare const DeviceModelToTypes: {
|
|
88
88
|
[deviceModel in IDeviceModel]: IDeviceType[];
|
|
89
89
|
};
|
package/dist/index.js
CHANGED
|
@@ -820,10 +820,11 @@ const validatePath = (path, length = 0, base = false) => {
|
|
|
820
820
|
const DeviceModelToTypes = {
|
|
821
821
|
model_mini: ['classic', 'classic1s', 'mini'],
|
|
822
822
|
model_touch: ['touch', 'pro'],
|
|
823
|
+
model_classic: ['classic', 'classic1s'],
|
|
823
824
|
};
|
|
824
825
|
const DeviceTypeToModels = {
|
|
825
|
-
classic: ['model_mini'],
|
|
826
|
-
classic1s: ['model_mini'],
|
|
826
|
+
classic: ['model_classic', 'model_mini'],
|
|
827
|
+
classic1s: ['model_classic', 'model_mini'],
|
|
827
828
|
mini: ['model_mini'],
|
|
828
829
|
touch: ['model_touch'],
|
|
829
830
|
pro: ['model_touch'],
|
|
@@ -22601,7 +22602,7 @@ function checkNeedUpdateBootForTouch(features) {
|
|
|
22601
22602
|
}
|
|
22602
22603
|
function checkNeedUpdateBootForClassicAndMini(features, willUpdateFirmware) {
|
|
22603
22604
|
const deviceType = getDeviceType(features);
|
|
22604
|
-
if (deviceType
|
|
22605
|
+
if (!DeviceModelToTypes.model_mini.includes(deviceType))
|
|
22605
22606
|
return false;
|
|
22606
22607
|
if (!willUpdateFirmware)
|
|
22607
22608
|
return false;
|
|
@@ -23148,7 +23149,7 @@ DataManager.getFirmwareStatus = (features) => {
|
|
|
23148
23149
|
if (features.firmware_present === false) {
|
|
23149
23150
|
return 'none';
|
|
23150
23151
|
}
|
|
23151
|
-
if (deviceType
|
|
23152
|
+
if (DeviceModelToTypes.model_classic.includes(deviceType) && features.bootloader_mode) {
|
|
23152
23153
|
return 'unknown';
|
|
23153
23154
|
}
|
|
23154
23155
|
const firmwareUpdateField = getFirmwareUpdateField({ features, updateType: 'firmware' });
|
|
@@ -23213,7 +23214,7 @@ DataManager.getBootloaderTargetVersion = (features) => {
|
|
|
23213
23214
|
DataManager.getBootloaderRelatedFirmwareVersion = (features) => {
|
|
23214
23215
|
var _b, _c, _d, _e;
|
|
23215
23216
|
const deviceType = getDeviceType(features);
|
|
23216
|
-
if (!(deviceType
|
|
23217
|
+
if (!DeviceModelToTypes.model_mini.includes(deviceType))
|
|
23217
23218
|
return undefined;
|
|
23218
23219
|
const firmwareUpdateField = getFirmwareUpdateField({
|
|
23219
23220
|
features,
|
|
@@ -23228,7 +23229,7 @@ DataManager.getFirmwareChangelog = (features) => {
|
|
|
23228
23229
|
const deviceType = getDeviceType(features);
|
|
23229
23230
|
const deviceFirmwareVersion = getDeviceFirmwareVersion(features);
|
|
23230
23231
|
if (features.firmware_present === false ||
|
|
23231
|
-
(deviceType
|
|
23232
|
+
(DeviceModelToTypes.model_classic.includes(deviceType) && features.bootloader_mode)) {
|
|
23232
23233
|
return [];
|
|
23233
23234
|
}
|
|
23234
23235
|
const firmwareUpdateField = getFirmwareUpdateField({
|
|
@@ -23498,7 +23499,7 @@ const supportModifyHomescreen = (features) => {
|
|
|
23498
23499
|
return { support: false };
|
|
23499
23500
|
const currentVersion = getDeviceFirmwareVersion(features).join('.');
|
|
23500
23501
|
const deviceType = getDeviceType(features);
|
|
23501
|
-
if (deviceType
|
|
23502
|
+
if (DeviceModelToTypes.model_mini.includes(deviceType)) {
|
|
23502
23503
|
return { support: true };
|
|
23503
23504
|
}
|
|
23504
23505
|
return { support: semver__default["default"].gte(currentVersion, '3.4.0') };
|
|
@@ -23509,7 +23510,7 @@ const getFirmwareUpdateField = ({ features, updateType, targetVersion, }) => {
|
|
|
23509
23510
|
if (updateType === 'ble') {
|
|
23510
23511
|
return 'ble';
|
|
23511
23512
|
}
|
|
23512
|
-
if (deviceType
|
|
23513
|
+
if (DeviceModelToTypes.model_mini.includes(deviceType)) {
|
|
23513
23514
|
return 'firmware-v4';
|
|
23514
23515
|
}
|
|
23515
23516
|
if (deviceType === 'touch') {
|
|
@@ -24920,7 +24921,7 @@ class CheckBridgeRelease extends BaseMethod {
|
|
|
24920
24921
|
shouldUpdate = true;
|
|
24921
24922
|
}
|
|
24922
24923
|
}
|
|
24923
|
-
if (deviceType
|
|
24924
|
+
if (DeviceModelToTypes.model_mini.includes(deviceType)) {
|
|
24924
24925
|
if (semver__default["default"].gte(willUpdateFirmwareVersion, ClassicAndMiniNeedUpdateVersion) &&
|
|
24925
24926
|
isOldVersionBridge) {
|
|
24926
24927
|
shouldUpdate = true;
|
|
@@ -24960,7 +24961,7 @@ class CheckBootloaderRelease extends BaseMethod {
|
|
|
24960
24961
|
const { features } = this.device;
|
|
24961
24962
|
const deviceType = getDeviceType(features);
|
|
24962
24963
|
let shouldUpdate = false;
|
|
24963
|
-
if (deviceType
|
|
24964
|
+
if (DeviceModelToTypes.model_mini.includes(deviceType)) {
|
|
24964
24965
|
shouldUpdate = !!checkNeedUpdateBootForClassicAndMini(features, this.payload.willUpdateFirmwareVersion);
|
|
24965
24966
|
}
|
|
24966
24967
|
else if (deviceType === 'touch') {
|
|
@@ -25454,7 +25455,7 @@ class DeviceVerify extends BaseMethod {
|
|
|
25454
25455
|
return __awaiter(this, void 0, void 0, function* () {
|
|
25455
25456
|
const deviceType = getDeviceType(this.device.features);
|
|
25456
25457
|
let response;
|
|
25457
|
-
if (deviceType
|
|
25458
|
+
if (DeviceModelToTypes.model_classic.includes(deviceType)) {
|
|
25458
25459
|
const res = yield this.device.commands.typedCall('BixinVerifyDeviceRequest', 'BixinVerifyDeviceAck', Object.assign(Object.assign({}, this.params), { data: utils.bytesToHex(sha256.sha256(this.params.data)) }));
|
|
25459
25460
|
response = res.message;
|
|
25460
25461
|
}
|
|
@@ -26073,7 +26074,7 @@ class FirmwareUpdateV2 extends BaseMethod {
|
|
|
26073
26074
|
}
|
|
26074
26075
|
this.postTipMessage('GoToBootloaderSuccess');
|
|
26075
26076
|
this.checkDeviceToBootloader(this.payload.connectId);
|
|
26076
|
-
if (deviceType
|
|
26077
|
+
if (DeviceModelToTypes.model_classic.includes(deviceType)) {
|
|
26077
26078
|
DevicePool.clearDeviceCache(uuid);
|
|
26078
26079
|
}
|
|
26079
26080
|
delete DevicePool.devicesCache[''];
|
|
@@ -28036,7 +28037,7 @@ class EVMSignTypedData extends BaseMethod {
|
|
|
28036
28037
|
}
|
|
28037
28038
|
supportSignTyped() {
|
|
28038
28039
|
const deviceType = getDeviceType(this.device.features);
|
|
28039
|
-
if (deviceType
|
|
28040
|
+
if (DeviceModelToTypes.model_mini.includes(deviceType)) {
|
|
28040
28041
|
const currentVersion = getDeviceFirmwareVersion(this.device.features).join('.');
|
|
28041
28042
|
const supportSignTypedVersion = '2.2.0';
|
|
28042
28043
|
if (semver__default["default"].lt(currentVersion, supportSignTypedVersion)) {
|
|
@@ -28052,7 +28053,7 @@ class EVMSignTypedData extends BaseMethod {
|
|
|
28052
28053
|
}
|
|
28053
28054
|
const { addressN, chainId } = this.params;
|
|
28054
28055
|
const deviceType = getDeviceType(this.device.features);
|
|
28055
|
-
if (deviceType
|
|
28056
|
+
if (DeviceModelToTypes.model_mini.includes(deviceType)) {
|
|
28056
28057
|
validateParams(this.params, [
|
|
28057
28058
|
{ name: 'domainHash', type: 'hexString', required: true },
|
|
28058
28059
|
{ name: 'messageHash', type: 'hexString', required: true },
|
|
@@ -31706,7 +31707,7 @@ class NostrGetPublicKey extends BaseMethod {
|
|
|
31706
31707
|
min: '3.6.0',
|
|
31707
31708
|
},
|
|
31708
31709
|
model_touch: {
|
|
31709
|
-
min: '4.
|
|
31710
|
+
min: '4.7.0',
|
|
31710
31711
|
},
|
|
31711
31712
|
};
|
|
31712
31713
|
}
|
|
@@ -31772,7 +31773,7 @@ class NostrSignEvent extends BaseMethod {
|
|
|
31772
31773
|
min: '3.6.0',
|
|
31773
31774
|
},
|
|
31774
31775
|
model_touch: {
|
|
31775
|
-
min: '4.
|
|
31776
|
+
min: '4.7.0',
|
|
31776
31777
|
},
|
|
31777
31778
|
};
|
|
31778
31779
|
}
|
|
@@ -31825,7 +31826,7 @@ class NostrEncryptMessage extends BaseMethod {
|
|
|
31825
31826
|
min: '3.6.0',
|
|
31826
31827
|
},
|
|
31827
31828
|
model_touch: {
|
|
31828
|
-
min: '4.
|
|
31829
|
+
min: '4.7.0',
|
|
31829
31830
|
},
|
|
31830
31831
|
};
|
|
31831
31832
|
}
|
|
@@ -31872,7 +31873,7 @@ class NostrDecryptMessage extends BaseMethod {
|
|
|
31872
31873
|
min: '3.6.0',
|
|
31873
31874
|
},
|
|
31874
31875
|
model_touch: {
|
|
31875
|
-
min: '4.
|
|
31876
|
+
min: '4.7.0',
|
|
31876
31877
|
},
|
|
31877
31878
|
};
|
|
31878
31879
|
}
|
|
@@ -31914,7 +31915,7 @@ class NostrSignSchnorr extends BaseMethod {
|
|
|
31914
31915
|
min: '3.6.0',
|
|
31915
31916
|
},
|
|
31916
31917
|
model_touch: {
|
|
31917
|
-
min: '4.
|
|
31918
|
+
min: '4.7.0',
|
|
31918
31919
|
},
|
|
31919
31920
|
};
|
|
31920
31921
|
}
|
package/dist/types/device.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ export type SearchDevice = {
|
|
|
31
31
|
export type Device = KnownDevice;
|
|
32
32
|
export type Features = PROTO.Features;
|
|
33
33
|
export type IDeviceType = 'classic' | 'classic1s' | 'mini' | 'touch' | 'pro';
|
|
34
|
-
export type IDeviceModel = 'model_mini' | 'model_touch';
|
|
34
|
+
export type IDeviceModel = 'model_classic' | 'model_mini' | 'model_touch';
|
|
35
35
|
export declare const DeviceModelToTypes: {
|
|
36
36
|
[deviceModel in IDeviceModel]: IDeviceType[];
|
|
37
37
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"device.d.ts","sourceRoot":"","sources":["../../src/types/device.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,MAAM,MAAM,YAAY,GAAG,WAAW,GAAG,UAAU,GAAG,MAAM,CAAC;AAE7D,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,YAAY,GAAG,YAAY,GAAG,UAAU,CAAC;AAE7E,MAAM,MAAM,qBAAqB,GAC7B,eAAe,GACf,YAAY,GACZ,iBAAiB,GACjB,yBAAyB,CAAC;AAE9B,MAAM,MAAM,uBAAuB,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,qBAAqB,CAAA;CAAE,CAAC;AAE/E,MAAM,MAAM,WAAW,GAAG;IACxB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,UAAU,EAAE,WAAW,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC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AAC;IACf,QAAQ,EAAE,IAAI,CAAC;IACf,eAAe,EAAE,IAAI,CAAC;IACtB,gBAAgB,EAAE,IAAI,CAAC;CACxB,CAAC;AAEN,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,iBAAiB,CAAC;AAE1D,MAAM,MAAM,kBAAkB,GAAG;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAExE,MAAM,MAAM,eAAe,GAAG;IAC5B,kBAAkB,EAAE,kBAAkB,CAAC;IACvC,gBAAgB,EAAE,kBAAkB,CAAC;CACtC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deviceFeaturesUtils.d.ts","sourceRoot":"","sources":["../../src/utils/deviceFeaturesUtils.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,EACV,QAAQ,EACR,YAAY,EACZ,WAAW,EACX,aAAa,EACb,kBAAkB,EACnB,MAAM,UAAU,CAAC;AAElB,OAAoB,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAEzF,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C,eAAO,MAAM,cAAc,cAAe,QAAQ,KAAG,YAcpD,CAAC;AAEF,eAAO,MAAM,aAAa,cAAe,QAAQ,KAAG,WA0BnD,CAAC;AAEF,eAAO,MAAM,yBAAyB,cAAe,QAAQ,KAAG,WACvC,CAAC;AAE1B,eAAO,MAAM,sBAAsB,UAAW,MAAM,KAAG,WAAW,GAAG,IAKpE,CAAC;
|
|
1
|
+
{"version":3,"file":"deviceFeaturesUtils.d.ts","sourceRoot":"","sources":["../../src/utils/deviceFeaturesUtils.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,EACV,QAAQ,EACR,YAAY,EACZ,WA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uB,cAAe,QAAQ,KAAG,kBAU7D,CAAC;AAKF,eAAO,MAAM,sBAAsB;cAKvB,QAAQ;gBACN,UAAU,GAAG,KAAK;;MAE5B,KAAK,GAAG,aAsBX,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/hd-core",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.36",
|
|
4
4
|
"description": "> TODO: description",
|
|
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": "^0.3.
|
|
29
|
-
"@onekeyfe/hd-transport": "^0.3.
|
|
28
|
+
"@onekeyfe/hd-shared": "^0.3.36",
|
|
29
|
+
"@onekeyfe/hd-transport": "^0.3.36",
|
|
30
30
|
"axios": "^0.27.2",
|
|
31
31
|
"bignumber.js": "^9.0.2",
|
|
32
32
|
"bytebuffer": "^5.0.1",
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"@types/semver": "^7.3.9",
|
|
45
45
|
"ripple-keypairs": "^1.1.4"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "9b1787a6683ea265cd3ef6adb3913b71b977d7b9"
|
|
48
48
|
}
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
} from './firmware/updateBootloader';
|
|
8
8
|
import { DataManager } from '../data-manager';
|
|
9
9
|
import { getDeviceType } from '../utils';
|
|
10
|
+
import { DeviceModelToTypes } from '../types';
|
|
10
11
|
|
|
11
12
|
export default class CheckBootloaderRelease extends BaseMethod {
|
|
12
13
|
init() {
|
|
@@ -22,7 +23,8 @@ export default class CheckBootloaderRelease extends BaseMethod {
|
|
|
22
23
|
const { features } = this.device;
|
|
23
24
|
const deviceType = getDeviceType(features);
|
|
24
25
|
let shouldUpdate = false;
|
|
25
|
-
|
|
26
|
+
// classic mini classic1s
|
|
27
|
+
if (DeviceModelToTypes.model_mini.includes(deviceType)) {
|
|
26
28
|
shouldUpdate = !!checkNeedUpdateBootForClassicAndMini(
|
|
27
29
|
features,
|
|
28
30
|
this.payload.willUpdateFirmwareVersion
|
|
@@ -5,6 +5,7 @@ import { BaseMethod } from './BaseMethod';
|
|
|
5
5
|
import { UI_REQUEST } from '../constants/ui-request';
|
|
6
6
|
import { getDeviceType } from '../utils';
|
|
7
7
|
import { getDeviceFirmwareVersion } from '../utils/deviceFeaturesUtils';
|
|
8
|
+
import { DeviceModelToTypes } from '../types';
|
|
8
9
|
|
|
9
10
|
const BridgeVersion = '2.2.0';
|
|
10
11
|
const TouchNeedUpdateVersion = '4.3.0';
|
|
@@ -45,7 +46,8 @@ export default class CheckBridgeRelease extends BaseMethod {
|
|
|
45
46
|
shouldUpdate = true;
|
|
46
47
|
}
|
|
47
48
|
}
|
|
48
|
-
|
|
49
|
+
// classic mini classic1s
|
|
50
|
+
if (DeviceModelToTypes.model_mini.includes(deviceType)) {
|
|
49
51
|
if (
|
|
50
52
|
semver.gte(willUpdateFirmwareVersion, ClassicAndMiniNeedUpdateVersion) &&
|
|
51
53
|
isOldVersionBridge
|
|
@@ -14,10 +14,12 @@ import { getBinary, getInfo, getSysResourceBinary } from './firmware/getBinary';
|
|
|
14
14
|
import { updateResources, uploadFirmware } from './firmware/uploadFirmware';
|
|
15
15
|
import { getDeviceType, getDeviceUUID, wait, getLogger, LoggerNames } from '../utils';
|
|
16
16
|
import { createUiMessage } from '../events/ui-request';
|
|
17
|
-
import
|
|
17
|
+
import { DeviceModelToTypes } from '../types';
|
|
18
18
|
import { DataManager } from '../data-manager';
|
|
19
19
|
import { getDeviceFirmwareVersion } from '../utils/deviceFeaturesUtils';
|
|
20
20
|
|
|
21
|
+
import type { KnownDevice, Features } from '../types';
|
|
22
|
+
|
|
21
23
|
type Params = {
|
|
22
24
|
binary?: ArrayBuffer;
|
|
23
25
|
version?: number[];
|
|
@@ -235,7 +237,7 @@ export default class FirmwareUpdateV2 extends BaseMethod<Params> {
|
|
|
235
237
|
this.checkDeviceToBootloader(this.payload.connectId);
|
|
236
238
|
|
|
237
239
|
// force clean classic device cache so that the device can initialize again
|
|
238
|
-
if (deviceType
|
|
240
|
+
if (DeviceModelToTypes.model_classic.includes(deviceType)) {
|
|
239
241
|
DevicePool.clearDeviceCache(uuid);
|
|
240
242
|
}
|
|
241
243
|
delete DevicePool.devicesCache[''];
|
|
@@ -6,6 +6,7 @@ import { formatAnyHex } from '../helpers/hexUtils';
|
|
|
6
6
|
import { BaseMethod } from '../BaseMethod';
|
|
7
7
|
import { validateParams } from '../helpers/paramsValidator';
|
|
8
8
|
import { getDeviceType } from '../../utils';
|
|
9
|
+
import { DeviceModelToTypes } from '../../types';
|
|
9
10
|
import type { DeviceVerifySignature } from '../../types';
|
|
10
11
|
|
|
11
12
|
export default class DeviceVerify extends BaseMethod<BixinVerifyDeviceRequest> {
|
|
@@ -26,7 +27,7 @@ export default class DeviceVerify extends BaseMethod<BixinVerifyDeviceRequest> {
|
|
|
26
27
|
const deviceType = getDeviceType(this.device.features);
|
|
27
28
|
let response: DeviceVerifySignature | undefined;
|
|
28
29
|
|
|
29
|
-
if (deviceType
|
|
30
|
+
if (DeviceModelToTypes.model_classic.includes(deviceType)) {
|
|
30
31
|
const res = await this.device.commands.typedCall(
|
|
31
32
|
'BixinVerifyDeviceRequest',
|
|
32
33
|
'BixinVerifyDeviceAck',
|
|
@@ -14,7 +14,11 @@ import { BaseMethod } from '../BaseMethod';
|
|
|
14
14
|
import { validateParams } from '../helpers/paramsValidator';
|
|
15
15
|
import { formatAnyHex } from '../helpers/hexUtils';
|
|
16
16
|
import { getDeviceFirmwareVersion, getDeviceType } from '../../utils/deviceFeaturesUtils';
|
|
17
|
-
import
|
|
17
|
+
import {
|
|
18
|
+
DeviceModelToTypes,
|
|
19
|
+
type EthereumSignTypedDataMessage,
|
|
20
|
+
type EthereumSignTypedDataTypes,
|
|
21
|
+
} from '../../types';
|
|
18
22
|
import TransportManager from '../../data-manager/TransportManager';
|
|
19
23
|
import { signTypedHash as signTypedHashLegacyV1 } from './legacyV1/signTypedHash';
|
|
20
24
|
import { signTypedHash } from './latest/signTypedHash';
|
|
@@ -348,7 +352,7 @@ export default class EVMSignTypedData extends BaseMethod<EVMSignTypedDataParams>
|
|
|
348
352
|
|
|
349
353
|
supportSignTyped() {
|
|
350
354
|
const deviceType = getDeviceType(this.device.features);
|
|
351
|
-
if (deviceType
|
|
355
|
+
if (DeviceModelToTypes.model_mini.includes(deviceType)) {
|
|
352
356
|
const currentVersion = getDeviceFirmwareVersion(this.device.features).join('.');
|
|
353
357
|
const supportSignTypedVersion = '2.2.0';
|
|
354
358
|
|
|
@@ -372,7 +376,7 @@ export default class EVMSignTypedData extends BaseMethod<EVMSignTypedDataParams>
|
|
|
372
376
|
|
|
373
377
|
// For Classic、Mini device we use EthereumSignTypedData
|
|
374
378
|
const deviceType = getDeviceType(this.device.features);
|
|
375
|
-
if (deviceType
|
|
379
|
+
if (DeviceModelToTypes.model_mini.includes(deviceType)) {
|
|
376
380
|
validateParams(this.params, [
|
|
377
381
|
{ name: 'domainHash', type: 'hexString', required: true },
|
|
378
382
|
{ name: 'messageHash', type: 'hexString', required: true },
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import ByteBuffer from 'bytebuffer';
|
|
2
2
|
import semver from 'semver';
|
|
3
|
-
import { Features } from '../../types';
|
|
3
|
+
import { DeviceModelToTypes, Features } from '../../types';
|
|
4
4
|
import { getDeviceType } from '../../utils';
|
|
5
5
|
import {
|
|
6
6
|
getDeviceBootloaderVersion,
|
|
@@ -32,7 +32,7 @@ export function checkNeedUpdateBootForClassicAndMini(
|
|
|
32
32
|
willUpdateFirmware: string
|
|
33
33
|
) {
|
|
34
34
|
const deviceType = getDeviceType(features);
|
|
35
|
-
if (deviceType
|
|
35
|
+
if (!DeviceModelToTypes.model_mini.includes(deviceType)) return false;
|
|
36
36
|
if (!willUpdateFirmware) return false;
|
|
37
37
|
const currentVersion = getDeviceFirmwareVersion(features).join('.');
|
|
38
38
|
const bootloaderVersion = getDeviceBootloaderVersion(features).join('.');
|
|
@@ -21,6 +21,7 @@ import type {
|
|
|
21
21
|
IVersionArray,
|
|
22
22
|
RemoteConfigResponse,
|
|
23
23
|
} from '../types';
|
|
24
|
+
import { DeviceModelToTypes } from '../types';
|
|
24
25
|
import { findLatestRelease, getReleaseChangelog, getReleaseStatus } from '../utils/release';
|
|
25
26
|
|
|
26
27
|
export type FirmwareField = 'firmware' | 'firmware-v2' | 'firmware-v4';
|
|
@@ -69,7 +70,7 @@ export default class DataManager {
|
|
|
69
70
|
return 'none';
|
|
70
71
|
}
|
|
71
72
|
|
|
72
|
-
if (deviceType
|
|
73
|
+
if (DeviceModelToTypes.model_classic.includes(deviceType) && features.bootloader_mode) {
|
|
73
74
|
return 'unknown';
|
|
74
75
|
}
|
|
75
76
|
|
|
@@ -153,7 +154,7 @@ export default class DataManager {
|
|
|
153
154
|
static getBootloaderRelatedFirmwareVersion = (features: Features): IVersionArray | undefined => {
|
|
154
155
|
const deviceType = getDeviceType(features);
|
|
155
156
|
|
|
156
|
-
if (!(deviceType
|
|
157
|
+
if (!DeviceModelToTypes.model_mini.includes(deviceType)) return undefined;
|
|
157
158
|
const firmwareUpdateField = getFirmwareUpdateField({
|
|
158
159
|
features,
|
|
159
160
|
updateType: 'firmware',
|
|
@@ -172,7 +173,7 @@ export default class DataManager {
|
|
|
172
173
|
|
|
173
174
|
if (
|
|
174
175
|
features.firmware_present === false ||
|
|
175
|
-
(deviceType
|
|
176
|
+
(DeviceModelToTypes.model_classic.includes(deviceType) && features.bootloader_mode)
|
|
176
177
|
) {
|
|
177
178
|
return [];
|
|
178
179
|
}
|
package/src/types/device.ts
CHANGED
|
@@ -73,18 +73,22 @@ export type Features = PROTO.Features;
|
|
|
73
73
|
|
|
74
74
|
export type IDeviceType = 'classic' | 'classic1s' | 'mini' | 'touch' | 'pro';
|
|
75
75
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
76
|
+
/**
|
|
77
|
+
* model_classic: 'classic' | 'classic1s'
|
|
78
|
+
* model_mini: 'classic' | 'mini'
|
|
79
|
+
* model_touch: 'touch' | 'pro'
|
|
80
|
+
*/
|
|
81
|
+
export type IDeviceModel = 'model_classic' | 'model_mini' | 'model_touch';
|
|
79
82
|
|
|
80
83
|
export const DeviceModelToTypes: { [deviceModel in IDeviceModel]: IDeviceType[] } = {
|
|
81
84
|
model_mini: ['classic', 'classic1s', 'mini'],
|
|
82
85
|
model_touch: ['touch', 'pro'],
|
|
86
|
+
model_classic: ['classic', 'classic1s'],
|
|
83
87
|
};
|
|
84
88
|
|
|
85
89
|
export const DeviceTypeToModels: { [deviceType in IDeviceType]: IDeviceModel[] } = {
|
|
86
|
-
classic: ['model_mini'],
|
|
87
|
-
classic1s: ['model_mini'],
|
|
90
|
+
classic: ['model_classic', 'model_mini'],
|
|
91
|
+
classic1s: ['model_classic', 'model_mini'],
|
|
88
92
|
mini: ['model_mini'],
|
|
89
93
|
touch: ['model_touch'],
|
|
90
94
|
pro: ['model_touch'],
|
|
@@ -9,7 +9,7 @@ import type {
|
|
|
9
9
|
IVersionArray,
|
|
10
10
|
SupportFeatureType,
|
|
11
11
|
} from '../types';
|
|
12
|
-
import { DeviceTypeToModels } from '../types';
|
|
12
|
+
import { DeviceModelToTypes, DeviceTypeToModels } from '../types';
|
|
13
13
|
import DataManager, { FirmwareField, MessageVersion } from '../data-manager/DataManager';
|
|
14
14
|
import { PROTOBUF_MESSAGE_CONFIG } from '../data-manager/MessagesConfig';
|
|
15
15
|
import { Device } from '../device/Device';
|
|
@@ -68,6 +68,7 @@ export const getDeviceTypeByBleName = (name?: string): IDeviceType | null => {
|
|
|
68
68
|
return 'classic';
|
|
69
69
|
};
|
|
70
70
|
|
|
71
|
+
// @deprecated
|
|
71
72
|
export const getDeviceTypeByDeviceId = (deviceId?: string): IDeviceType => {
|
|
72
73
|
if (!deviceId) {
|
|
73
74
|
return 'classic';
|
|
@@ -253,7 +254,7 @@ export const supportModifyHomescreen = (features?: Features): SupportFeatureType
|
|
|
253
254
|
const currentVersion = getDeviceFirmwareVersion(features).join('.');
|
|
254
255
|
|
|
255
256
|
const deviceType = getDeviceType(features);
|
|
256
|
-
if (deviceType
|
|
257
|
+
if (DeviceModelToTypes.model_mini.includes(deviceType)) {
|
|
257
258
|
return { support: true };
|
|
258
259
|
}
|
|
259
260
|
|
|
@@ -278,7 +279,7 @@ export const getFirmwareUpdateField = ({
|
|
|
278
279
|
return 'ble';
|
|
279
280
|
}
|
|
280
281
|
|
|
281
|
-
if (deviceType
|
|
282
|
+
if (DeviceModelToTypes.model_mini.includes(deviceType)) {
|
|
282
283
|
return 'firmware-v4';
|
|
283
284
|
}
|
|
284
285
|
|