@onekeyfe/hd-core 0.2.33 → 0.2.35
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/firmware/getBinary.d.ts +1 -0
- package/dist/api/firmware/getBinary.d.ts.map +1 -1
- package/dist/api/firmware/updateBootloader.d.ts.map +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/data-manager/DataManager.d.ts +2 -1
- package/dist/data-manager/DataManager.d.ts.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +111 -96
- package/dist/types/params.d.ts +1 -0
- package/dist/types/params.d.ts.map +1 -1
- package/dist/types/settings.d.ts +1 -0
- package/dist/types/settings.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/api/firmware/updateBootloader.ts +5 -1
- package/src/core/index.ts +16 -7
- package/src/data-manager/DataManager.ts +12 -0
- package/src/types/params.ts +4 -0
- package/src/types/settings.ts +1 -0
|
@@ -14,6 +14,7 @@ export declare const getBinary: ({ features, updateType, version }: GetBinaryPro
|
|
|
14
14
|
fullResource?: string | undefined;
|
|
15
15
|
fullResourceRange?: string[] | undefined;
|
|
16
16
|
bootloaderResource?: string | undefined;
|
|
17
|
+
bootloaderVersion?: import("../../types").IVersionArray | undefined;
|
|
17
18
|
fingerprint: string;
|
|
18
19
|
version: import("../../types").IVersionArray;
|
|
19
20
|
changelog: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getBinary.d.ts","sourceRoot":"","sources":["../../../src/api/firmware/getBinary.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAMvC,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,QAAQ,CAAC;IACnB,UAAU,EAAE,UAAU,GAAG,KAAK,CAAC;CAChC;AAED,UAAU,cAAe,SAAQ,YAAY;IAC3C,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,eAAO,MAAM,SAAS,sCAA6C,cAAc
|
|
1
|
+
{"version":3,"file":"getBinary.d.ts","sourceRoot":"","sources":["../../../src/api/firmware/getBinary.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAMvC,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,QAAQ,CAAC;IACnB,UAAU,EAAE,UAAU,GAAG,KAAK,CAAC;CAChC;AAED,UAAU,cAAe,SAAQ,YAAY;IAC3C,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,eAAO,MAAM,SAAS,sCAA6C,cAAc;;;;;;;;;;;;;;;EA2BhF,CAAC;AAEF,eAAO,MAAM,oBAAoB,QAAe,MAAM;;EAWrD,CAAC;AAEF,eAAO,MAAM,OAAO,6BAA8B,YAAY,2DAO7D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateBootloader.d.ts","sourceRoot":"","sources":["../../../src/api/firmware/updateBootloader.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"updateBootloader.d.ts","sourceRoot":"","sources":["../../../src/api/firmware/updateBootloader.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAQvC,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,WAgBrD"}
|
package/dist/core/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":";AACA,OAAO,YAAY,MAAM,QAAQ,CAAC;AAqBlC,OAAO,EACL,WAAW,EAYZ,MAAM,WAAW,CAAC;AAEnB,OAAO,KAAK,EAAE,eAAe,EAAe,MAAM,UAAU,CAAC;AAE7D,OAAO,eAAe,MAAM,2BAA2B,CAAC;AA4BxD,eAAO,MAAM,OAAO,YAAmB,WAAW,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":";AACA,OAAO,YAAY,MAAM,QAAQ,CAAC;AAqBlC,OAAO,EACL,WAAW,EAYZ,MAAM,WAAW,CAAC;AAEnB,OAAO,KAAK,EAAE,eAAe,EAAe,MAAM,UAAU,CAAC;AAE7D,OAAO,eAAe,MAAM,2BAA2B,CAAC;AA4BxD,eAAO,MAAM,OAAO,YAAmB,WAAW,iBAkQjD,CAAC;AAqMF,eAAO,MAAM,MAAM,0CAkBlB,CAAC;AAoJF,MAAM,CAAC,OAAO,OAAO,IAAK,SAAQ,YAAY;IACtC,aAAa,CAAC,OAAO,EAAE,WAAW;IA8CxC,OAAO;CAGR;AAED,eAAO,MAAM,QAAQ,YAGpB,CAAC;AAEF,eAAO,MAAM,aAAa,uBAIzB,CAAC;AAMF,eAAO,MAAM,IAAI,aAAoB,eAAe,aAAa,GAAG,8BAmBnE,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ConnectSettings, DeviceTypeMap, AssetsMap, Features, IDeviceFirmwareStatus, IDeviceBLEFirmwareStatus, ITransportStatus } from '../types';
|
|
1
|
+
import type { ConnectSettings, DeviceTypeMap, AssetsMap, Features, IDeviceFirmwareStatus, IDeviceBLEFirmwareStatus, ITransportStatus, IVersionArray } from '../types';
|
|
2
2
|
export default class DataManager {
|
|
3
3
|
static deviceMap: DeviceTypeMap;
|
|
4
4
|
static assets: AssetsMap | null;
|
|
@@ -10,6 +10,7 @@ export default class DataManager {
|
|
|
10
10
|
static getSysResourcesLatestRelease: (features: Features, forcedUpdateRes?: boolean | undefined) => string | undefined;
|
|
11
11
|
static getSysFullResource: (features: Features) => string | undefined;
|
|
12
12
|
static getBootloaderResource: (features: Features) => string | undefined;
|
|
13
|
+
static getBootloaderTargetVersion: (features: Features) => IVersionArray | undefined;
|
|
13
14
|
static getFirmwareChangelog: (features: Features) => {
|
|
14
15
|
"zh-CN": string;
|
|
15
16
|
"en-US": string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataManager.d.ts","sourceRoot":"","sources":["../../src/data-manager/DataManager.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EACV,eAAe,EACf,aAAa,EACb,SAAS,EAET,QAAQ,EACR,qBAAqB,EACrB,wBAAwB,EACxB,gBAAgB,
|
|
1
|
+
{"version":3,"file":"DataManager.d.ts","sourceRoot":"","sources":["../../src/data-manager/DataManager.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EACV,eAAe,EACf,aAAa,EACb,SAAS,EAET,QAAQ,EACR,qBAAqB,EACrB,wBAAwB,EACxB,gBAAgB,EAChB,aAAa,EACd,MAAM,UAAU,CAAC;AAKlB,MAAM,CAAC,OAAO,OAAO,WAAW;IAC9B,MAAM,CAAC,SAAS,EAAE,aAAa,CAiB7B;IAEF,MAAM,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAAQ;IAEvC,MAAM,CAAC,QAAQ,EAAE,eAAe,CAAC;IAEjC,MAAM,CAAC,QAAQ,EAAE;QAAE,OAAO,EAAE,IAAI,CAAA;KAAE,CAEhC;IAEF,MAAM,CAAC,iBAAiB,aAAc,QAAQ,KAAG,qBAAqB,CAepE;IAMF,MAAM,CAAC,4BAA4B,aAAc,QAAQ,+DAgBvD;IAMF,MAAM,CAAC,kBAAkB,aAAc,QAAQ,wBAU7C;IAEF,MAAM,CAAC,qBAAqB,aAAc,QAAQ,wBAShD;IAEF,MAAM,CAAC,0BAA0B,aAAc,QAAQ,KAAG,aAAa,GAAG,SAAS,CASjF;IAEF,MAAM,CAAC,oBAAoB,aAAc,QAAQ;;;QAe/C;IAEF,MAAM,CAAC,wBAAwB,aAAc,QAAQ,yDAgBnD;IAEF,MAAM,CAAC,oBAAoB,aAAc,QAAQ,KAAG,wBAAwB,CAY1E;IAEF,MAAM,CAAC,uBAAuB,aAAc,QAAQ;;;QAWlD;IAEF,MAAM,CAAC,2BAA2B,aAAc,QAAQ,4DAItD;IAEF,MAAM,CAAC,kBAAkB,iBAAkB,MAAM,KAAG,gBAAgB,CAKlE;WAEW,IAAI,CAAC,QAAQ,EAAE,eAAe;IAwB3C,MAAM,CAAC,mBAAmB;IAI1B,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;CAShF"}
|
package/dist/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ interface CommonParams {
|
|
|
10
10
|
pollIntervalTime?: number;
|
|
11
11
|
timeout?: number;
|
|
12
12
|
passphraseState?: string;
|
|
13
|
+
useEmptyPassphrase?: boolean;
|
|
13
14
|
initSession?: boolean;
|
|
14
15
|
}
|
|
15
16
|
declare type Params<T> = CommonParams & T & {
|
|
@@ -149,6 +150,7 @@ declare type IFirmwareReleaseInfo = {
|
|
|
149
150
|
fullResource?: string;
|
|
150
151
|
fullResourceRange?: string[];
|
|
151
152
|
bootloaderResource?: string;
|
|
153
|
+
bootloaderVersion?: IVersionArray;
|
|
152
154
|
fingerprint: string;
|
|
153
155
|
version: IVersionArray;
|
|
154
156
|
changelog: {
|
|
@@ -2140,6 +2142,7 @@ declare class DataManager {
|
|
|
2140
2142
|
static getSysResourcesLatestRelease: (features: Features, forcedUpdateRes?: boolean | undefined) => string | undefined;
|
|
2141
2143
|
static getSysFullResource: (features: Features) => string | undefined;
|
|
2142
2144
|
static getBootloaderResource: (features: Features) => string | undefined;
|
|
2145
|
+
static getBootloaderTargetVersion: (features: Features) => IVersionArray | undefined;
|
|
2143
2146
|
static getFirmwareChangelog: (features: Features) => {
|
|
2144
2147
|
"zh-CN": string;
|
|
2145
2148
|
"en-US": string;
|
package/dist/index.js
CHANGED
|
@@ -10741,15 +10741,106 @@ function patchFeatures(response) {
|
|
|
10741
10741
|
return response;
|
|
10742
10742
|
}
|
|
10743
10743
|
|
|
10744
|
+
const pkg = require('../package.json');
|
|
10745
|
+
const getSDKVersion = () => pkg.version;
|
|
10746
|
+
const DEFAULT_DOMAIN = `https://jssdk.onekey.so/${getSDKVersion()}/`;
|
|
10747
|
+
|
|
10748
|
+
const DEFAULT_PRIORITY = 2;
|
|
10749
|
+
const initialSettings = {
|
|
10750
|
+
configSrc: './data/config.json',
|
|
10751
|
+
version: '',
|
|
10752
|
+
debug: false,
|
|
10753
|
+
priority: DEFAULT_PRIORITY,
|
|
10754
|
+
trustedHost: false,
|
|
10755
|
+
connectSrc: DEFAULT_DOMAIN,
|
|
10756
|
+
iframeSrc: `${DEFAULT_DOMAIN}iframe.html`,
|
|
10757
|
+
parentOrigin: typeof window !== 'undefined' && window.location ? window.location.origin : '',
|
|
10758
|
+
supportedBrowser: typeof navigator !== 'undefined' ? !/Trident|MSIE|Edge/.test(navigator.userAgent) : true,
|
|
10759
|
+
env: 'web',
|
|
10760
|
+
lazyLoad: false,
|
|
10761
|
+
timestamp: new Date().getTime(),
|
|
10762
|
+
};
|
|
10763
|
+
const getEnv = () => {
|
|
10764
|
+
if (typeof chrome !== 'undefined' &&
|
|
10765
|
+
chrome.runtime &&
|
|
10766
|
+
typeof chrome.runtime.onConnect !== 'undefined') {
|
|
10767
|
+
return 'webextension';
|
|
10768
|
+
}
|
|
10769
|
+
if (typeof navigator !== 'undefined') {
|
|
10770
|
+
if (typeof navigator.product === 'string' &&
|
|
10771
|
+
navigator.product.toLowerCase() === 'reactnative') {
|
|
10772
|
+
return 'react-native';
|
|
10773
|
+
}
|
|
10774
|
+
const userAgent = navigator.userAgent.toLowerCase();
|
|
10775
|
+
if (userAgent.indexOf(' electron/') > -1) {
|
|
10776
|
+
return 'electron';
|
|
10777
|
+
}
|
|
10778
|
+
}
|
|
10779
|
+
return 'web';
|
|
10780
|
+
};
|
|
10781
|
+
const corsValidator = (url) => {
|
|
10782
|
+
if (typeof url !== 'string')
|
|
10783
|
+
return;
|
|
10784
|
+
if (url.match(/^https:\/\/([A-Za-z0-9\-_]+\.)*onekey\.so\//))
|
|
10785
|
+
return url;
|
|
10786
|
+
if (url.match(/^https?:\/\/localhost:[58][0-9]{3}\//))
|
|
10787
|
+
return url;
|
|
10788
|
+
return url;
|
|
10789
|
+
};
|
|
10790
|
+
const parseConnectSettings = (input = {}) => {
|
|
10791
|
+
const settings = Object.assign({}, initialSettings);
|
|
10792
|
+
if (Object.prototype.hasOwnProperty.call(input, 'debug')) {
|
|
10793
|
+
settings.debug = input.debug;
|
|
10794
|
+
}
|
|
10795
|
+
if (input.isFrame) {
|
|
10796
|
+
settings.parentOrigin = input.parentOrigin;
|
|
10797
|
+
}
|
|
10798
|
+
if (typeof input.connectSrc === 'string') {
|
|
10799
|
+
settings.connectSrc = input.connectSrc;
|
|
10800
|
+
}
|
|
10801
|
+
let globalSrc;
|
|
10802
|
+
if (typeof window !== 'undefined') {
|
|
10803
|
+
globalSrc = window.ONEKEY_CONNECT_SRC;
|
|
10804
|
+
}
|
|
10805
|
+
else if (typeof global !== 'undefined') {
|
|
10806
|
+
globalSrc = global.ONEKEY_CONNECT_SRC;
|
|
10807
|
+
}
|
|
10808
|
+
if (typeof globalSrc === 'string') {
|
|
10809
|
+
settings.connectSrc = corsValidator(globalSrc);
|
|
10810
|
+
settings.debug = true;
|
|
10811
|
+
}
|
|
10812
|
+
const src = settings.connectSrc || DEFAULT_DOMAIN;
|
|
10813
|
+
settings.iframeSrc = `${src}iframe.html`;
|
|
10814
|
+
if (input.transportReconnect) {
|
|
10815
|
+
settings.transportReconnect = input.transportReconnect;
|
|
10816
|
+
}
|
|
10817
|
+
if (input.lazyLoad) {
|
|
10818
|
+
settings.lazyLoad = input.lazyLoad;
|
|
10819
|
+
}
|
|
10820
|
+
if (typeof input.env === 'string') {
|
|
10821
|
+
settings.env = input.env;
|
|
10822
|
+
}
|
|
10823
|
+
else {
|
|
10824
|
+
settings.env = getEnv();
|
|
10825
|
+
}
|
|
10826
|
+
if (input.timestamp) {
|
|
10827
|
+
settings.timestamp = input.timestamp;
|
|
10828
|
+
}
|
|
10829
|
+
return settings;
|
|
10830
|
+
};
|
|
10831
|
+
|
|
10744
10832
|
function checkNeedUpdateBoot(features) {
|
|
10745
10833
|
const deviceType = getDeviceType(features);
|
|
10746
10834
|
if (deviceType !== 'touch')
|
|
10747
10835
|
return false;
|
|
10748
10836
|
const currentVersion = getDeviceFirmwareVersion(features).join('.');
|
|
10749
10837
|
const bootloaderVersion = getDeviceBootloaderVersion(features).join('.');
|
|
10838
|
+
const targetBootloaderVersion = DataManager.getBootloaderTargetVersion(features);
|
|
10839
|
+
if (!targetBootloaderVersion)
|
|
10840
|
+
return false;
|
|
10750
10841
|
return (semver__default["default"].gte(currentVersion, '3.2.0') &&
|
|
10751
10842
|
semver__default["default"].gte(currentVersion, '4.1.0') &&
|
|
10752
|
-
semver__default["default"].lte(bootloaderVersion, '
|
|
10843
|
+
semver__default["default"].lte(bootloaderVersion, targetBootloaderVersion.join('.')));
|
|
10753
10844
|
}
|
|
10754
10845
|
|
|
10755
10846
|
const LOG_EVENT = 'LOG_EVENT';
|
|
@@ -11275,6 +11366,16 @@ DataManager.getBootloaderResource = (features) => {
|
|
|
11275
11366
|
const targetDeviceConfig = targetDeviceConfigList.filter(item => !!item.bootloaderResource);
|
|
11276
11367
|
return (_d = findLatestRelease(targetDeviceConfig)) === null || _d === void 0 ? void 0 : _d.bootloaderResource;
|
|
11277
11368
|
};
|
|
11369
|
+
DataManager.getBootloaderTargetVersion = (features) => {
|
|
11370
|
+
var _b, _c, _d, _e;
|
|
11371
|
+
const deviceType = getDeviceType(features);
|
|
11372
|
+
if (deviceType !== 'pro' && deviceType !== 'touch')
|
|
11373
|
+
return undefined;
|
|
11374
|
+
const firmwareUpdateField = getFirmwareUpdateField(features, 'firmware');
|
|
11375
|
+
const targetDeviceConfigList = (_c = (_b = _a.deviceMap[deviceType]) === null || _b === void 0 ? void 0 : _b[firmwareUpdateField]) !== null && _c !== void 0 ? _c : [];
|
|
11376
|
+
const targetDeviceConfig = targetDeviceConfigList.filter(item => !!item.bootloaderResource);
|
|
11377
|
+
return (_e = (_d = targetDeviceConfig === null || targetDeviceConfig === void 0 ? void 0 : targetDeviceConfig[0]) === null || _d === void 0 ? void 0 : _d.bootloaderVersion) !== null && _e !== void 0 ? _e : undefined;
|
|
11378
|
+
};
|
|
11278
11379
|
DataManager.getFirmwareChangelog = (features) => {
|
|
11279
11380
|
var _b, _c;
|
|
11280
11381
|
const deviceType = getDeviceType(features);
|
|
@@ -11946,94 +12047,6 @@ const UI_REQUEST = {
|
|
|
11946
12047
|
FIRMWARE_TIP: 'ui-firmware-tip',
|
|
11947
12048
|
};
|
|
11948
12049
|
|
|
11949
|
-
const pkg = require('../package.json');
|
|
11950
|
-
const getSDKVersion = () => pkg.version;
|
|
11951
|
-
const DEFAULT_DOMAIN = `https://jssdk.onekey.so/${getSDKVersion()}/`;
|
|
11952
|
-
|
|
11953
|
-
const DEFAULT_PRIORITY = 2;
|
|
11954
|
-
const initialSettings = {
|
|
11955
|
-
configSrc: './data/config.json',
|
|
11956
|
-
version: '',
|
|
11957
|
-
debug: false,
|
|
11958
|
-
priority: DEFAULT_PRIORITY,
|
|
11959
|
-
trustedHost: false,
|
|
11960
|
-
connectSrc: DEFAULT_DOMAIN,
|
|
11961
|
-
iframeSrc: `${DEFAULT_DOMAIN}iframe.html`,
|
|
11962
|
-
parentOrigin: typeof window !== 'undefined' && window.location ? window.location.origin : '',
|
|
11963
|
-
supportedBrowser: typeof navigator !== 'undefined' ? !/Trident|MSIE|Edge/.test(navigator.userAgent) : true,
|
|
11964
|
-
env: 'web',
|
|
11965
|
-
lazyLoad: false,
|
|
11966
|
-
timestamp: new Date().getTime(),
|
|
11967
|
-
};
|
|
11968
|
-
const getEnv = () => {
|
|
11969
|
-
if (typeof chrome !== 'undefined' &&
|
|
11970
|
-
chrome.runtime &&
|
|
11971
|
-
typeof chrome.runtime.onConnect !== 'undefined') {
|
|
11972
|
-
return 'webextension';
|
|
11973
|
-
}
|
|
11974
|
-
if (typeof navigator !== 'undefined') {
|
|
11975
|
-
if (typeof navigator.product === 'string' &&
|
|
11976
|
-
navigator.product.toLowerCase() === 'reactnative') {
|
|
11977
|
-
return 'react-native';
|
|
11978
|
-
}
|
|
11979
|
-
const userAgent = navigator.userAgent.toLowerCase();
|
|
11980
|
-
if (userAgent.indexOf(' electron/') > -1) {
|
|
11981
|
-
return 'electron';
|
|
11982
|
-
}
|
|
11983
|
-
}
|
|
11984
|
-
return 'web';
|
|
11985
|
-
};
|
|
11986
|
-
const corsValidator = (url) => {
|
|
11987
|
-
if (typeof url !== 'string')
|
|
11988
|
-
return;
|
|
11989
|
-
if (url.match(/^https:\/\/([A-Za-z0-9\-_]+\.)*onekey\.so\//))
|
|
11990
|
-
return url;
|
|
11991
|
-
if (url.match(/^https?:\/\/localhost:[58][0-9]{3}\//))
|
|
11992
|
-
return url;
|
|
11993
|
-
return url;
|
|
11994
|
-
};
|
|
11995
|
-
const parseConnectSettings = (input = {}) => {
|
|
11996
|
-
const settings = Object.assign({}, initialSettings);
|
|
11997
|
-
if (Object.prototype.hasOwnProperty.call(input, 'debug')) {
|
|
11998
|
-
settings.debug = input.debug;
|
|
11999
|
-
}
|
|
12000
|
-
if (input.isFrame) {
|
|
12001
|
-
settings.parentOrigin = input.parentOrigin;
|
|
12002
|
-
}
|
|
12003
|
-
if (typeof input.connectSrc === 'string') {
|
|
12004
|
-
settings.connectSrc = input.connectSrc;
|
|
12005
|
-
}
|
|
12006
|
-
let globalSrc;
|
|
12007
|
-
if (typeof window !== 'undefined') {
|
|
12008
|
-
globalSrc = window.ONEKEY_CONNECT_SRC;
|
|
12009
|
-
}
|
|
12010
|
-
else if (typeof global !== 'undefined') {
|
|
12011
|
-
globalSrc = global.ONEKEY_CONNECT_SRC;
|
|
12012
|
-
}
|
|
12013
|
-
if (typeof globalSrc === 'string') {
|
|
12014
|
-
settings.connectSrc = corsValidator(globalSrc);
|
|
12015
|
-
settings.debug = true;
|
|
12016
|
-
}
|
|
12017
|
-
const src = settings.connectSrc || DEFAULT_DOMAIN;
|
|
12018
|
-
settings.iframeSrc = `${src}iframe.html`;
|
|
12019
|
-
if (input.transportReconnect) {
|
|
12020
|
-
settings.transportReconnect = input.transportReconnect;
|
|
12021
|
-
}
|
|
12022
|
-
if (input.lazyLoad) {
|
|
12023
|
-
settings.lazyLoad = input.lazyLoad;
|
|
12024
|
-
}
|
|
12025
|
-
if (typeof input.env === 'string') {
|
|
12026
|
-
settings.env = input.env;
|
|
12027
|
-
}
|
|
12028
|
-
else {
|
|
12029
|
-
settings.env = getEnv();
|
|
12030
|
-
}
|
|
12031
|
-
if (input.timestamp) {
|
|
12032
|
-
settings.timestamp = input.timestamp;
|
|
12033
|
-
}
|
|
12034
|
-
return settings;
|
|
12035
|
-
};
|
|
12036
|
-
|
|
12037
12050
|
const parseRunOptions = (options) => {
|
|
12038
12051
|
if (!options)
|
|
12039
12052
|
options = {};
|
|
@@ -18413,7 +18426,7 @@ const callAPI = (message) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
18413
18426
|
(_a = method.setDevice) === null || _a === void 0 ? void 0 : _a.call(method, device);
|
|
18414
18427
|
device.on(DEVICE.PIN, onDevicePinHandler);
|
|
18415
18428
|
device.on(DEVICE.BUTTON, onDeviceButtonHandler);
|
|
18416
|
-
device.on(DEVICE.PASSPHRASE, onDevicePassphraseHandler);
|
|
18429
|
+
device.on(DEVICE.PASSPHRASE, message.payload.useEmptyPassphrase ? onEmptyPassphraseHandler : onDevicePassphraseHandler);
|
|
18417
18430
|
device.on(DEVICE.PASSPHRASE_ON_DEVICE, onEnterPassphraseOnDeviceHandler);
|
|
18418
18431
|
device.on(DEVICE.FEATURES, onDeviceFeaturesHandler);
|
|
18419
18432
|
try {
|
|
@@ -18717,7 +18730,9 @@ const cancel = (connectId) => {
|
|
|
18717
18730
|
const checkPassphraseSafety = (method, features) => {
|
|
18718
18731
|
if (!method.useDevicePassphraseState)
|
|
18719
18732
|
return;
|
|
18720
|
-
if ((features === null || features === void 0 ? void 0 : features.passphrase_protection) === true &&
|
|
18733
|
+
if ((features === null || features === void 0 ? void 0 : features.passphrase_protection) === true &&
|
|
18734
|
+
(method.payload.passphraseState == null || method.payload.passphraseState === '') &&
|
|
18735
|
+
!method.payload.useEmptyPassphrase) {
|
|
18721
18736
|
DevicePool.clearDeviceCache(method.payload.connectId);
|
|
18722
18737
|
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceOpenedPassphrase);
|
|
18723
18738
|
}
|
|
@@ -18731,11 +18746,7 @@ const cleanup = () => {
|
|
|
18731
18746
|
Log.debug('Cleanup...');
|
|
18732
18747
|
};
|
|
18733
18748
|
const removeDeviceListener = (device) => {
|
|
18734
|
-
device.
|
|
18735
|
-
device.removeListener(DEVICE.BUTTON, onDeviceButtonHandler);
|
|
18736
|
-
device.removeListener(DEVICE.PASSPHRASE, onDevicePassphraseHandler);
|
|
18737
|
-
device.removeListener(DEVICE.PASSPHRASE_ON_DEVICE, onEnterPassphraseOnDeviceHandler);
|
|
18738
|
-
device.removeListener(DEVICE.FEATURES, onDeviceFeaturesHandler);
|
|
18749
|
+
device.removeAllListeners();
|
|
18739
18750
|
DevicePool.emitter.removeListener(DEVICE.CONNECT, onDeviceConnectHandler);
|
|
18740
18751
|
};
|
|
18741
18752
|
const closePopup = () => {
|
|
@@ -18791,6 +18802,10 @@ const onDevicePassphraseHandler = (...[device, callback]) => __awaiter(void 0, v
|
|
|
18791
18802
|
cache: save,
|
|
18792
18803
|
});
|
|
18793
18804
|
});
|
|
18805
|
+
const onEmptyPassphraseHandler = (...[_, callback]) => {
|
|
18806
|
+
Log.debug('onEmptyPassphraseHandler');
|
|
18807
|
+
callback({ passphrase: '' });
|
|
18808
|
+
};
|
|
18794
18809
|
const onEnterPassphraseOnDeviceHandler = (...[device]) => {
|
|
18795
18810
|
postMessage(createUiMessage(UI_REQUEST$1.REQUEST_PASSPHRASE_ON_DEVICE, {
|
|
18796
18811
|
device: device.toMessageObject(),
|
package/dist/types/params.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"params.d.ts","sourceRoot":"","sources":["../../src/types/params.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,WAAW,CAAC,EAAE,OAAO,CAAC;IAItB,UAAU,CAAC,EAAE,MAAM,CAAC;IAIpB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAI1B,OAAO,CAAC,EAAE,MAAM,CAAC;IAIjB,eAAe,CAAC,EAAE,MAAM,CAAC;IAIzB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,oBAAY,MAAM,CAAC,CAAC,IAAI,YAAY,GAAG,CAAC,GAAG;IAAE,MAAM,CAAC,EAAE,SAAS,CAAA;CAAE,CAAC;AAElE,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,KAAK,CAAC;IACf,OAAO,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;CACpD;AAED,MAAM,WAAW,OAAO,CAAC,CAAC;IACxB,OAAO,EAAE,IAAI,CAAC;IACd,OAAO,EAAE,CAAC,CAAC;CACZ;AAED,oBAAY,QAAQ,CAAC,CAAC,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"params.d.ts","sourceRoot":"","sources":["../../src/types/params.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,WAAW,CAAC,EAAE,OAAO,CAAC;IAItB,UAAU,CAAC,EAAE,MAAM,CAAC;IAIpB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAI1B,OAAO,CAAC,EAAE,MAAM,CAAC;IAIjB,eAAe,CAAC,EAAE,MAAM,CAAC;IAIzB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAI7B,WAAW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GAAG;IACjC,MAAM,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC;CAC7B,GAAG,aAAa,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/hd-core",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.35",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"author": "OneKey",
|
|
6
6
|
"homepage": "https://github.com/OneKeyHQ/hardware-js-sdk#readme",
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"url": "https://github.com/OneKeyHQ/hardware-js-sdk/issues"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@onekeyfe/hd-shared": "^0.2.
|
|
28
|
-
"@onekeyfe/hd-transport": "^0.2.
|
|
27
|
+
"@onekeyfe/hd-shared": "^0.2.35",
|
|
28
|
+
"@onekeyfe/hd-transport": "^0.2.35",
|
|
29
29
|
"axios": "^0.27.2",
|
|
30
30
|
"bignumber.js": "^9.0.2",
|
|
31
31
|
"jszip": "^3.10.1",
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"@types/semver": "^7.3.9",
|
|
43
43
|
"ripple-keypairs": "^1.1.4"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "3dc0a64c3a036bf1ffbb1959bfc7957091aab1e6"
|
|
46
46
|
}
|
|
@@ -5,18 +5,22 @@ import {
|
|
|
5
5
|
getDeviceBootloaderVersion,
|
|
6
6
|
getDeviceFirmwareVersion,
|
|
7
7
|
} from '../../utils/deviceFeaturesUtils';
|
|
8
|
+
import { DataManager } from '../../data-manager';
|
|
8
9
|
|
|
9
10
|
export function checkNeedUpdateBoot(features: Features) {
|
|
10
11
|
const deviceType = getDeviceType(features);
|
|
11
12
|
if (deviceType !== 'touch') return false;
|
|
12
13
|
const currentVersion = getDeviceFirmwareVersion(features).join('.');
|
|
13
14
|
const bootloaderVersion = getDeviceBootloaderVersion(features).join('.');
|
|
15
|
+
const targetBootloaderVersion = DataManager.getBootloaderTargetVersion(features);
|
|
16
|
+
if (!targetBootloaderVersion) return false;
|
|
17
|
+
|
|
14
18
|
return (
|
|
15
19
|
// support ResourceUpdate version 3.2.0
|
|
16
20
|
semver.gte(currentVersion, '3.2.0') &&
|
|
17
21
|
// support update bootloader version 4.1.0
|
|
18
22
|
semver.gte(currentVersion, '4.1.0') &&
|
|
19
23
|
// target bootloader version
|
|
20
|
-
semver.lte(bootloaderVersion, '
|
|
24
|
+
semver.lte(bootloaderVersion, targetBootloaderVersion.join('.'))
|
|
21
25
|
);
|
|
22
26
|
}
|
package/src/core/index.ts
CHANGED
|
@@ -133,7 +133,10 @@ export const callAPI = async (message: CoreMessage) => {
|
|
|
133
133
|
|
|
134
134
|
device.on(DEVICE.PIN, onDevicePinHandler);
|
|
135
135
|
device.on(DEVICE.BUTTON, onDeviceButtonHandler);
|
|
136
|
-
device.on(
|
|
136
|
+
device.on(
|
|
137
|
+
DEVICE.PASSPHRASE,
|
|
138
|
+
message.payload.useEmptyPassphrase ? onEmptyPassphraseHandler : onDevicePassphraseHandler
|
|
139
|
+
);
|
|
137
140
|
device.on(DEVICE.PASSPHRASE_ON_DEVICE, onEnterPassphraseOnDeviceHandler);
|
|
138
141
|
device.on(DEVICE.FEATURES, onDeviceFeaturesHandler);
|
|
139
142
|
|
|
@@ -540,7 +543,11 @@ export const cancel = (connectId?: string) => {
|
|
|
540
543
|
const checkPassphraseSafety = (method: BaseMethod, features?: Features) => {
|
|
541
544
|
if (!method.useDevicePassphraseState) return;
|
|
542
545
|
|
|
543
|
-
if (
|
|
546
|
+
if (
|
|
547
|
+
features?.passphrase_protection === true &&
|
|
548
|
+
(method.payload.passphraseState == null || method.payload.passphraseState === '') &&
|
|
549
|
+
!method.payload.useEmptyPassphrase
|
|
550
|
+
) {
|
|
544
551
|
DevicePool.clearDeviceCache(method.payload.connectId);
|
|
545
552
|
throw ERRORS.TypedError(HardwareErrorCode.DeviceOpenedPassphrase);
|
|
546
553
|
}
|
|
@@ -557,11 +564,7 @@ const cleanup = () => {
|
|
|
557
564
|
};
|
|
558
565
|
|
|
559
566
|
const removeDeviceListener = (device: Device) => {
|
|
560
|
-
device.
|
|
561
|
-
device.removeListener(DEVICE.BUTTON, onDeviceButtonHandler);
|
|
562
|
-
device.removeListener(DEVICE.PASSPHRASE, onDevicePassphraseHandler);
|
|
563
|
-
device.removeListener(DEVICE.PASSPHRASE_ON_DEVICE, onEnterPassphraseOnDeviceHandler);
|
|
564
|
-
device.removeListener(DEVICE.FEATURES, onDeviceFeaturesHandler);
|
|
567
|
+
device.removeAllListeners();
|
|
565
568
|
DevicePool.emitter.removeListener(DEVICE.CONNECT, onDeviceConnectHandler);
|
|
566
569
|
// DevicePool.emitter.removeListener(DEVICE.DISCONNECT, onDeviceDisconnectHandler);
|
|
567
570
|
};
|
|
@@ -641,6 +644,12 @@ const onDevicePassphraseHandler = async (...[device, callback]: DeviceEvents['pa
|
|
|
641
644
|
});
|
|
642
645
|
};
|
|
643
646
|
|
|
647
|
+
const onEmptyPassphraseHandler = (...[_, callback]: DeviceEvents['passphrase']) => {
|
|
648
|
+
Log.debug('onEmptyPassphraseHandler');
|
|
649
|
+
// send as PassphrasePromptResponse
|
|
650
|
+
callback({ passphrase: '' });
|
|
651
|
+
};
|
|
652
|
+
|
|
644
653
|
const onEnterPassphraseOnDeviceHandler = (
|
|
645
654
|
...[device]: [...DeviceEvents['passphrase_on_device']]
|
|
646
655
|
) => {
|
|
@@ -18,6 +18,7 @@ import type {
|
|
|
18
18
|
IDeviceFirmwareStatus,
|
|
19
19
|
IDeviceBLEFirmwareStatus,
|
|
20
20
|
ITransportStatus,
|
|
21
|
+
IVersionArray,
|
|
21
22
|
} from '../types';
|
|
22
23
|
import { getReleaseChangelog, getReleaseStatus, findLatestRelease } from '../utils/release';
|
|
23
24
|
|
|
@@ -117,6 +118,17 @@ export default class DataManager {
|
|
|
117
118
|
return findLatestRelease(targetDeviceConfig)?.bootloaderResource;
|
|
118
119
|
};
|
|
119
120
|
|
|
121
|
+
static getBootloaderTargetVersion = (features: Features): IVersionArray | undefined => {
|
|
122
|
+
const deviceType = getDeviceType(features);
|
|
123
|
+
|
|
124
|
+
if (deviceType !== 'pro' && deviceType !== 'touch') return undefined;
|
|
125
|
+
const firmwareUpdateField = getFirmwareUpdateField(features, 'firmware') as FirmwareField;
|
|
126
|
+
const targetDeviceConfigList = this.deviceMap[deviceType]?.[firmwareUpdateField] ?? [];
|
|
127
|
+
const targetDeviceConfig = targetDeviceConfigList.filter(item => !!item.bootloaderResource);
|
|
128
|
+
|
|
129
|
+
return targetDeviceConfig?.[0]?.bootloaderVersion ?? undefined;
|
|
130
|
+
};
|
|
131
|
+
|
|
120
132
|
static getFirmwareChangelog = (features: Features) => {
|
|
121
133
|
const deviceType = getDeviceType(features);
|
|
122
134
|
const deviceFirmwareVersion = getDeviceFirmwareVersion(features);
|
package/src/types/params.ts
CHANGED
package/src/types/settings.ts
CHANGED