@onekeyfe/hd-web-sdk 0.1.37 → 0.1.38
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/build/iframe.html +1 -1
- package/build/js/iframe.91e45942ed79c30c5e49.js +3 -0
- package/build/js/{iframe.5990e4a198ef913cb6c8.js.LICENSE.txt → iframe.91e45942ed79c30c5e49.js.LICENSE.txt} +0 -0
- package/build/js/iframe.91e45942ed79c30c5e49.js.map +1 -0
- package/build/onekey-js-sdk.js +537 -295
- package/build/onekey-js-sdk.js.map +1 -1
- package/build/onekey-js-sdk.min.js +1 -1
- package/build/onekey-js-sdk.min.js.map +1 -1
- package/package.json +6 -6
- package/build/js/iframe.5990e4a198ef913cb6c8.js +0 -3
- package/build/js/iframe.5990e4a198ef913cb6c8.js.map +0 -1
package/build/onekey-js-sdk.js
CHANGED
|
@@ -4145,6 +4145,10 @@ const inject = ({
|
|
|
4145
4145
|
connectId,
|
|
4146
4146
|
method: 'deviceWipe'
|
|
4147
4147
|
}),
|
|
4148
|
+
getPassphraseState: (connectId, params) => call(Object.assign(Object.assign({}, params), {
|
|
4149
|
+
connectId,
|
|
4150
|
+
method: 'getPassphraseState'
|
|
4151
|
+
})),
|
|
4148
4152
|
evmGetAddress: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), {
|
|
4149
4153
|
connectId,
|
|
4150
4154
|
deviceId,
|
|
@@ -4819,6 +4823,262 @@ function eventTargetAgnosticAddListener(emitter, name, listener, flags) {
|
|
|
4819
4823
|
}
|
|
4820
4824
|
}
|
|
4821
4825
|
|
|
4826
|
+
const HD_HARDENED = 0x80000000;
|
|
4827
|
+
|
|
4828
|
+
const toHardened = n => (n | HD_HARDENED) >>> 0;
|
|
4829
|
+
|
|
4830
|
+
const fromHardened = n => (n & ~HD_HARDENED) >>> 0;
|
|
4831
|
+
|
|
4832
|
+
const PATH_NOT_VALID = hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.CallMethodInvalidParameter, 'Not a valid path');
|
|
4833
|
+
const PATH_NEGATIVE_VALUES = hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.CallMethodInvalidParameter, 'Path cannot contain negative values');
|
|
4834
|
+
|
|
4835
|
+
const getHDPath = path => {
|
|
4836
|
+
const parts = path.toLowerCase().split('/');
|
|
4837
|
+
if (parts[0] !== 'm') throw PATH_NOT_VALID;
|
|
4838
|
+
return parts.filter(p => p !== 'm' && p !== '').map(p => {
|
|
4839
|
+
let hardened = false;
|
|
4840
|
+
|
|
4841
|
+
if (p.substr(p.length - 1) === "'") {
|
|
4842
|
+
hardened = true;
|
|
4843
|
+
p = p.substr(0, p.length - 1);
|
|
4844
|
+
}
|
|
4845
|
+
|
|
4846
|
+
let n = parseInt(p);
|
|
4847
|
+
|
|
4848
|
+
if (Number.isNaN(n)) {
|
|
4849
|
+
throw PATH_NOT_VALID;
|
|
4850
|
+
} else if (n < 0) {
|
|
4851
|
+
throw PATH_NEGATIVE_VALUES;
|
|
4852
|
+
}
|
|
4853
|
+
|
|
4854
|
+
if (hardened) {
|
|
4855
|
+
n = toHardened(n);
|
|
4856
|
+
}
|
|
4857
|
+
|
|
4858
|
+
return n;
|
|
4859
|
+
});
|
|
4860
|
+
};
|
|
4861
|
+
|
|
4862
|
+
const isMultisigPath = path => Array.isArray(path) && path[0] === toHardened(48);
|
|
4863
|
+
|
|
4864
|
+
const isSegwitPath = path => Array.isArray(path) && path[0] === toHardened(49);
|
|
4865
|
+
|
|
4866
|
+
const getScriptType = path => {
|
|
4867
|
+
if (!Array.isArray(path) || path.length < 1) return 'SPENDADDRESS';
|
|
4868
|
+
const p1 = fromHardened(path[0]);
|
|
4869
|
+
|
|
4870
|
+
switch (p1) {
|
|
4871
|
+
case 48:
|
|
4872
|
+
return 'SPENDMULTISIG';
|
|
4873
|
+
|
|
4874
|
+
case 49:
|
|
4875
|
+
return 'SPENDP2SHWITNESS';
|
|
4876
|
+
|
|
4877
|
+
case 84:
|
|
4878
|
+
return 'SPENDWITNESS';
|
|
4879
|
+
|
|
4880
|
+
default:
|
|
4881
|
+
return 'SPENDADDRESS';
|
|
4882
|
+
}
|
|
4883
|
+
};
|
|
4884
|
+
|
|
4885
|
+
const getOutputScriptType = path => {
|
|
4886
|
+
if (!Array.isArray(path) || path.length < 1) return 'PAYTOADDRESS';
|
|
4887
|
+
|
|
4888
|
+
if (path[0] === 49) {
|
|
4889
|
+
return 'PAYTOP2SHWITNESS';
|
|
4890
|
+
}
|
|
4891
|
+
|
|
4892
|
+
const p = fromHardened(path[0]);
|
|
4893
|
+
|
|
4894
|
+
switch (p) {
|
|
4895
|
+
case 48:
|
|
4896
|
+
return 'PAYTOMULTISIG';
|
|
4897
|
+
|
|
4898
|
+
case 49:
|
|
4899
|
+
return 'PAYTOP2SHWITNESS';
|
|
4900
|
+
|
|
4901
|
+
case 84:
|
|
4902
|
+
return 'PAYTOWITNESS';
|
|
4903
|
+
|
|
4904
|
+
default:
|
|
4905
|
+
return 'PAYTOADDRESS';
|
|
4906
|
+
}
|
|
4907
|
+
};
|
|
4908
|
+
|
|
4909
|
+
const serializedPath = path => {
|
|
4910
|
+
const pathStr = path.map(p => {
|
|
4911
|
+
if (p & HD_HARDENED) {
|
|
4912
|
+
return `${p & ~HD_HARDENED}'`;
|
|
4913
|
+
}
|
|
4914
|
+
|
|
4915
|
+
return p;
|
|
4916
|
+
}).join('/');
|
|
4917
|
+
return `m/${pathStr}`;
|
|
4918
|
+
};
|
|
4919
|
+
|
|
4920
|
+
const validatePath = (path, length = 0, base = false) => {
|
|
4921
|
+
let valid;
|
|
4922
|
+
|
|
4923
|
+
if (typeof path === 'string') {
|
|
4924
|
+
valid = getHDPath(path);
|
|
4925
|
+
} else if (Array.isArray(path)) {
|
|
4926
|
+
valid = path.map(p => {
|
|
4927
|
+
const n = parseInt(p);
|
|
4928
|
+
|
|
4929
|
+
if (Number.isNaN(n)) {
|
|
4930
|
+
throw PATH_NOT_VALID;
|
|
4931
|
+
} else if (n < 0) {
|
|
4932
|
+
throw PATH_NEGATIVE_VALUES;
|
|
4933
|
+
}
|
|
4934
|
+
|
|
4935
|
+
return n;
|
|
4936
|
+
});
|
|
4937
|
+
} else {
|
|
4938
|
+
valid = undefined;
|
|
4939
|
+
}
|
|
4940
|
+
|
|
4941
|
+
if (!valid) throw PATH_NOT_VALID;
|
|
4942
|
+
if (length > 0 && valid.length < length) throw PATH_NOT_VALID;
|
|
4943
|
+
return base ? valid.splice(0, 3) : valid;
|
|
4944
|
+
};
|
|
4945
|
+
|
|
4946
|
+
const getDeviceModel = features => {
|
|
4947
|
+
if (!features || typeof features !== 'object') {
|
|
4948
|
+
return 'model_mini';
|
|
4949
|
+
}
|
|
4950
|
+
|
|
4951
|
+
if (features.model === '1') {
|
|
4952
|
+
return 'model_mini';
|
|
4953
|
+
}
|
|
4954
|
+
|
|
4955
|
+
return 'model_touch';
|
|
4956
|
+
};
|
|
4957
|
+
|
|
4958
|
+
const getDeviceType = features => {
|
|
4959
|
+
if (!features || typeof features !== 'object' || !features.serial_no) {
|
|
4960
|
+
return 'classic';
|
|
4961
|
+
}
|
|
4962
|
+
|
|
4963
|
+
const serialNo = features.serial_no;
|
|
4964
|
+
const miniFlag = serialNo.slice(0, 2);
|
|
4965
|
+
if (miniFlag.toLowerCase() === 'mi') return 'mini';
|
|
4966
|
+
if (miniFlag.toLowerCase() === 'tc') return 'touch';
|
|
4967
|
+
return 'classic';
|
|
4968
|
+
};
|
|
4969
|
+
|
|
4970
|
+
const getDeviceTypeOnBootloader = features => getDeviceType(features);
|
|
4971
|
+
|
|
4972
|
+
const getDeviceTypeByBleName = name => {
|
|
4973
|
+
if (!name) return 'classic';
|
|
4974
|
+
if (name.startsWith('MI')) return 'mini';
|
|
4975
|
+
if (name.startsWith('T')) return 'touch';
|
|
4976
|
+
return 'classic';
|
|
4977
|
+
};
|
|
4978
|
+
|
|
4979
|
+
const getDeviceTypeByDeviceId = deviceId => {
|
|
4980
|
+
if (!deviceId) {
|
|
4981
|
+
return 'classic';
|
|
4982
|
+
}
|
|
4983
|
+
|
|
4984
|
+
const miniFlag = deviceId.slice(0, 2);
|
|
4985
|
+
if (miniFlag.toLowerCase() === 'mi') return 'mini';
|
|
4986
|
+
return 'classic';
|
|
4987
|
+
};
|
|
4988
|
+
|
|
4989
|
+
const getDeviceUUID = features => {
|
|
4990
|
+
const deviceType = getDeviceType(features);
|
|
4991
|
+
|
|
4992
|
+
if (deviceType === 'classic') {
|
|
4993
|
+
return features.onekey_serial;
|
|
4994
|
+
}
|
|
4995
|
+
|
|
4996
|
+
return features.serial_no;
|
|
4997
|
+
};
|
|
4998
|
+
|
|
4999
|
+
const getDeviceLabel = features => {
|
|
5000
|
+
const deviceType = getDeviceType(features);
|
|
5001
|
+
|
|
5002
|
+
if (typeof features.label === 'string') {
|
|
5003
|
+
return features.label;
|
|
5004
|
+
}
|
|
5005
|
+
|
|
5006
|
+
return `My OneKey ${deviceType.charAt(0).toUpperCase() + deviceType.slice(1)}`;
|
|
5007
|
+
};
|
|
5008
|
+
|
|
5009
|
+
const getDeviceFirmwareVersion = features => {
|
|
5010
|
+
if (!features) return [0, 0, 0];
|
|
5011
|
+
|
|
5012
|
+
if (features.onekey_version) {
|
|
5013
|
+
return features.onekey_version.split('.');
|
|
5014
|
+
}
|
|
5015
|
+
|
|
5016
|
+
return [features.major_version, features.minor_version, features.patch_version];
|
|
5017
|
+
};
|
|
5018
|
+
|
|
5019
|
+
const getDeviceBLEFirmwareVersion = features => {
|
|
5020
|
+
if (!features.ble_ver) {
|
|
5021
|
+
return null;
|
|
5022
|
+
}
|
|
5023
|
+
|
|
5024
|
+
if (!semver__default["default"].valid(features.ble_ver)) {
|
|
5025
|
+
return null;
|
|
5026
|
+
}
|
|
5027
|
+
|
|
5028
|
+
return features.ble_ver.split('.');
|
|
5029
|
+
};
|
|
5030
|
+
|
|
5031
|
+
const supportInputPinOnSoftware = features => {
|
|
5032
|
+
if (!features) return {
|
|
5033
|
+
support: false
|
|
5034
|
+
};
|
|
5035
|
+
const deviceType = getDeviceType(features);
|
|
5036
|
+
|
|
5037
|
+
if (deviceType === 'touch') {
|
|
5038
|
+
return {
|
|
5039
|
+
support: false
|
|
5040
|
+
};
|
|
5041
|
+
}
|
|
5042
|
+
|
|
5043
|
+
const currentVersion = getDeviceFirmwareVersion(features).join('.');
|
|
5044
|
+
return {
|
|
5045
|
+
support: semver__default["default"].gte(currentVersion, '2.3.0'),
|
|
5046
|
+
require: '2.3.0'
|
|
5047
|
+
};
|
|
5048
|
+
};
|
|
5049
|
+
|
|
5050
|
+
const supportNewPassphrase = features => {
|
|
5051
|
+
if (!features) return {
|
|
5052
|
+
support: false
|
|
5053
|
+
};
|
|
5054
|
+
const deviceType = getDeviceType(features);
|
|
5055
|
+
|
|
5056
|
+
if (deviceType === 'touch' || deviceType === 'pro') {
|
|
5057
|
+
return {
|
|
5058
|
+
support: true
|
|
5059
|
+
};
|
|
5060
|
+
}
|
|
5061
|
+
|
|
5062
|
+
const currentVersion = getDeviceFirmwareVersion(features).join('.');
|
|
5063
|
+
return {
|
|
5064
|
+
support: semver__default["default"].gte(currentVersion, '2.4.0'),
|
|
5065
|
+
require: '2.4.0'
|
|
5066
|
+
};
|
|
5067
|
+
};
|
|
5068
|
+
|
|
5069
|
+
const getPassphraseState = (features, commands) => __awaiter(void 0, void 0, void 0, function* () {
|
|
5070
|
+
if (!features) return false;
|
|
5071
|
+
const {
|
|
5072
|
+
message
|
|
5073
|
+
} = yield commands.typedCall('GetAddress', 'Address', {
|
|
5074
|
+
address_n: [toHardened(44), toHardened(1), toHardened(0), 0, 0],
|
|
5075
|
+
coin_name: 'Testnet',
|
|
5076
|
+
script_type: 'SPENDADDRESS',
|
|
5077
|
+
show_display: false
|
|
5078
|
+
});
|
|
5079
|
+
return message.address;
|
|
5080
|
+
});
|
|
5081
|
+
|
|
4822
5082
|
var nested = {
|
|
4823
5083
|
BinanceGetAddress: {
|
|
4824
5084
|
fields: {
|
|
@@ -13599,223 +13859,6 @@ function patchFeatures(response) {
|
|
|
13599
13859
|
return response;
|
|
13600
13860
|
}
|
|
13601
13861
|
|
|
13602
|
-
const getDeviceModel = features => {
|
|
13603
|
-
if (!features || typeof features !== 'object') {
|
|
13604
|
-
return 'model_mini';
|
|
13605
|
-
}
|
|
13606
|
-
|
|
13607
|
-
if (features.model === '1') {
|
|
13608
|
-
return 'model_mini';
|
|
13609
|
-
}
|
|
13610
|
-
|
|
13611
|
-
return 'model_touch';
|
|
13612
|
-
};
|
|
13613
|
-
|
|
13614
|
-
const getDeviceType = features => {
|
|
13615
|
-
if (!features || typeof features !== 'object' || !features.serial_no) {
|
|
13616
|
-
return 'classic';
|
|
13617
|
-
}
|
|
13618
|
-
|
|
13619
|
-
const serialNo = features.serial_no;
|
|
13620
|
-
const miniFlag = serialNo.slice(0, 2);
|
|
13621
|
-
if (miniFlag.toLowerCase() === 'mi') return 'mini';
|
|
13622
|
-
if (miniFlag.toLowerCase() === 'tc') return 'touch';
|
|
13623
|
-
return 'classic';
|
|
13624
|
-
};
|
|
13625
|
-
|
|
13626
|
-
const getDeviceTypeOnBootloader = features => getDeviceType(features);
|
|
13627
|
-
|
|
13628
|
-
const getDeviceTypeByBleName = name => {
|
|
13629
|
-
if (!name) return 'classic';
|
|
13630
|
-
if (name.startsWith('MI')) return 'mini';
|
|
13631
|
-
if (name.startsWith('T')) return 'touch';
|
|
13632
|
-
return 'classic';
|
|
13633
|
-
};
|
|
13634
|
-
|
|
13635
|
-
const getDeviceTypeByDeviceId = deviceId => {
|
|
13636
|
-
if (!deviceId) {
|
|
13637
|
-
return 'classic';
|
|
13638
|
-
}
|
|
13639
|
-
|
|
13640
|
-
const miniFlag = deviceId.slice(0, 2);
|
|
13641
|
-
if (miniFlag.toLowerCase() === 'mi') return 'mini';
|
|
13642
|
-
return 'classic';
|
|
13643
|
-
};
|
|
13644
|
-
|
|
13645
|
-
const getDeviceUUID = features => {
|
|
13646
|
-
const deviceType = getDeviceType(features);
|
|
13647
|
-
|
|
13648
|
-
if (deviceType === 'classic') {
|
|
13649
|
-
return features.onekey_serial;
|
|
13650
|
-
}
|
|
13651
|
-
|
|
13652
|
-
return features.serial_no;
|
|
13653
|
-
};
|
|
13654
|
-
|
|
13655
|
-
const getDeviceLabel = features => {
|
|
13656
|
-
const deviceType = getDeviceType(features);
|
|
13657
|
-
|
|
13658
|
-
if (typeof features.label === 'string') {
|
|
13659
|
-
return features.label;
|
|
13660
|
-
}
|
|
13661
|
-
|
|
13662
|
-
return `My OneKey ${deviceType.charAt(0).toUpperCase() + deviceType.slice(1)}`;
|
|
13663
|
-
};
|
|
13664
|
-
|
|
13665
|
-
const getDeviceFirmwareVersion = features => {
|
|
13666
|
-
if (!features) return [0, 0, 0];
|
|
13667
|
-
|
|
13668
|
-
if (features.onekey_version) {
|
|
13669
|
-
return features.onekey_version.split('.');
|
|
13670
|
-
}
|
|
13671
|
-
|
|
13672
|
-
return [features.major_version, features.minor_version, features.patch_version];
|
|
13673
|
-
};
|
|
13674
|
-
|
|
13675
|
-
const getDeviceBLEFirmwareVersion = features => {
|
|
13676
|
-
if (!features.ble_ver) {
|
|
13677
|
-
return null;
|
|
13678
|
-
}
|
|
13679
|
-
|
|
13680
|
-
if (!semver__default["default"].valid(features.ble_ver)) {
|
|
13681
|
-
return null;
|
|
13682
|
-
}
|
|
13683
|
-
|
|
13684
|
-
return features.ble_ver.split('.');
|
|
13685
|
-
};
|
|
13686
|
-
|
|
13687
|
-
const supportInputPinOnSoftware = features => {
|
|
13688
|
-
if (!features) return false;
|
|
13689
|
-
const deviceType = getDeviceType(features);
|
|
13690
|
-
|
|
13691
|
-
if (deviceType === 'touch') {
|
|
13692
|
-
return false;
|
|
13693
|
-
}
|
|
13694
|
-
|
|
13695
|
-
const currentVersion = getDeviceFirmwareVersion(features).join('.');
|
|
13696
|
-
return semver__default["default"].gte(currentVersion, '2.3.0');
|
|
13697
|
-
};
|
|
13698
|
-
|
|
13699
|
-
const HD_HARDENED = 0x80000000;
|
|
13700
|
-
|
|
13701
|
-
const toHardened = n => (n | HD_HARDENED) >>> 0;
|
|
13702
|
-
|
|
13703
|
-
const fromHardened = n => (n & ~HD_HARDENED) >>> 0;
|
|
13704
|
-
|
|
13705
|
-
const PATH_NOT_VALID = hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.CallMethodInvalidParameter, 'Not a valid path');
|
|
13706
|
-
const PATH_NEGATIVE_VALUES = hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.CallMethodInvalidParameter, 'Path cannot contain negative values');
|
|
13707
|
-
|
|
13708
|
-
const getHDPath = path => {
|
|
13709
|
-
const parts = path.toLowerCase().split('/');
|
|
13710
|
-
if (parts[0] !== 'm') throw PATH_NOT_VALID;
|
|
13711
|
-
return parts.filter(p => p !== 'm' && p !== '').map(p => {
|
|
13712
|
-
let hardened = false;
|
|
13713
|
-
|
|
13714
|
-
if (p.substr(p.length - 1) === "'") {
|
|
13715
|
-
hardened = true;
|
|
13716
|
-
p = p.substr(0, p.length - 1);
|
|
13717
|
-
}
|
|
13718
|
-
|
|
13719
|
-
let n = parseInt(p);
|
|
13720
|
-
|
|
13721
|
-
if (Number.isNaN(n)) {
|
|
13722
|
-
throw PATH_NOT_VALID;
|
|
13723
|
-
} else if (n < 0) {
|
|
13724
|
-
throw PATH_NEGATIVE_VALUES;
|
|
13725
|
-
}
|
|
13726
|
-
|
|
13727
|
-
if (hardened) {
|
|
13728
|
-
n = toHardened(n);
|
|
13729
|
-
}
|
|
13730
|
-
|
|
13731
|
-
return n;
|
|
13732
|
-
});
|
|
13733
|
-
};
|
|
13734
|
-
|
|
13735
|
-
const isMultisigPath = path => Array.isArray(path) && path[0] === toHardened(48);
|
|
13736
|
-
|
|
13737
|
-
const isSegwitPath = path => Array.isArray(path) && path[0] === toHardened(49);
|
|
13738
|
-
|
|
13739
|
-
const getScriptType = path => {
|
|
13740
|
-
if (!Array.isArray(path) || path.length < 1) return 'SPENDADDRESS';
|
|
13741
|
-
const p1 = fromHardened(path[0]);
|
|
13742
|
-
|
|
13743
|
-
switch (p1) {
|
|
13744
|
-
case 48:
|
|
13745
|
-
return 'SPENDMULTISIG';
|
|
13746
|
-
|
|
13747
|
-
case 49:
|
|
13748
|
-
return 'SPENDP2SHWITNESS';
|
|
13749
|
-
|
|
13750
|
-
case 84:
|
|
13751
|
-
return 'SPENDWITNESS';
|
|
13752
|
-
|
|
13753
|
-
default:
|
|
13754
|
-
return 'SPENDADDRESS';
|
|
13755
|
-
}
|
|
13756
|
-
};
|
|
13757
|
-
|
|
13758
|
-
const getOutputScriptType = path => {
|
|
13759
|
-
if (!Array.isArray(path) || path.length < 1) return 'PAYTOADDRESS';
|
|
13760
|
-
|
|
13761
|
-
if (path[0] === 49) {
|
|
13762
|
-
return 'PAYTOP2SHWITNESS';
|
|
13763
|
-
}
|
|
13764
|
-
|
|
13765
|
-
const p = fromHardened(path[0]);
|
|
13766
|
-
|
|
13767
|
-
switch (p) {
|
|
13768
|
-
case 48:
|
|
13769
|
-
return 'PAYTOMULTISIG';
|
|
13770
|
-
|
|
13771
|
-
case 49:
|
|
13772
|
-
return 'PAYTOP2SHWITNESS';
|
|
13773
|
-
|
|
13774
|
-
case 84:
|
|
13775
|
-
return 'PAYTOWITNESS';
|
|
13776
|
-
|
|
13777
|
-
default:
|
|
13778
|
-
return 'PAYTOADDRESS';
|
|
13779
|
-
}
|
|
13780
|
-
};
|
|
13781
|
-
|
|
13782
|
-
const serializedPath = path => {
|
|
13783
|
-
const pathStr = path.map(p => {
|
|
13784
|
-
if (p & HD_HARDENED) {
|
|
13785
|
-
return `${p & ~HD_HARDENED}'`;
|
|
13786
|
-
}
|
|
13787
|
-
|
|
13788
|
-
return p;
|
|
13789
|
-
}).join('/');
|
|
13790
|
-
return `m/${pathStr}`;
|
|
13791
|
-
};
|
|
13792
|
-
|
|
13793
|
-
const validatePath = (path, length = 0, base = false) => {
|
|
13794
|
-
let valid;
|
|
13795
|
-
|
|
13796
|
-
if (typeof path === 'string') {
|
|
13797
|
-
valid = getHDPath(path);
|
|
13798
|
-
} else if (Array.isArray(path)) {
|
|
13799
|
-
valid = path.map(p => {
|
|
13800
|
-
const n = parseInt(p);
|
|
13801
|
-
|
|
13802
|
-
if (Number.isNaN(n)) {
|
|
13803
|
-
throw PATH_NOT_VALID;
|
|
13804
|
-
} else if (n < 0) {
|
|
13805
|
-
throw PATH_NEGATIVE_VALUES;
|
|
13806
|
-
}
|
|
13807
|
-
|
|
13808
|
-
return n;
|
|
13809
|
-
});
|
|
13810
|
-
} else {
|
|
13811
|
-
valid = undefined;
|
|
13812
|
-
}
|
|
13813
|
-
|
|
13814
|
-
if (!valid) throw PATH_NOT_VALID;
|
|
13815
|
-
if (length > 0 && valid.length < length) throw PATH_NOT_VALID;
|
|
13816
|
-
return base ? valid.splice(0, 3) : valid;
|
|
13817
|
-
};
|
|
13818
|
-
|
|
13819
13862
|
const LOG_EVENT = 'LOG_EVENT';
|
|
13820
13863
|
const LOG = {
|
|
13821
13864
|
OUTPUT: 'log-output'
|
|
@@ -14225,6 +14268,7 @@ const UI_REQUEST$1 = {
|
|
|
14225
14268
|
REQUEST_PIN: 'ui-request_pin',
|
|
14226
14269
|
INVALID_PIN: 'ui-invalid_pin',
|
|
14227
14270
|
REQUEST_BUTTON: 'ui-button',
|
|
14271
|
+
REQUEST_PASSPHRASE_ON_DEVICE: 'ui-request_passphrase_on_device',
|
|
14228
14272
|
CLOSE_UI_WINDOW: 'ui-close_window',
|
|
14229
14273
|
BLUETOOTH_PERMISSION: 'ui-bluetooth_permission',
|
|
14230
14274
|
LOCATION_PERMISSION: 'ui-location_permission',
|
|
@@ -14358,13 +14402,13 @@ class DevicePool extends events.exports {
|
|
|
14358
14402
|
this.connector = connector;
|
|
14359
14403
|
}
|
|
14360
14404
|
|
|
14361
|
-
static getDevices(descriptorList, connectId) {
|
|
14405
|
+
static getDevices(descriptorList, connectId, initOptions) {
|
|
14362
14406
|
var descriptorList_1, descriptorList_1_1;
|
|
14363
14407
|
|
|
14364
14408
|
var e_1, _a;
|
|
14365
14409
|
|
|
14366
14410
|
return __awaiter(this, void 0, void 0, function* () {
|
|
14367
|
-
Log$6.debug('get device list');
|
|
14411
|
+
Log$6.debug('get device list: connectId: ', connectId);
|
|
14368
14412
|
const devices = {};
|
|
14369
14413
|
const deviceList = [];
|
|
14370
14414
|
|
|
@@ -14379,7 +14423,7 @@ class DevicePool extends events.exports {
|
|
|
14379
14423
|
device.updateDescriptor(exist, true);
|
|
14380
14424
|
devices[connectId] = device;
|
|
14381
14425
|
deviceList.push(device);
|
|
14382
|
-
yield this._checkDevicePool();
|
|
14426
|
+
yield this._checkDevicePool(initOptions);
|
|
14383
14427
|
return {
|
|
14384
14428
|
devices,
|
|
14385
14429
|
deviceList
|
|
@@ -14393,7 +14437,7 @@ class DevicePool extends events.exports {
|
|
|
14393
14437
|
try {
|
|
14394
14438
|
for (descriptorList_1 = __asyncValues(descriptorList); descriptorList_1_1 = yield descriptorList_1.next(), !descriptorList_1_1.done;) {
|
|
14395
14439
|
const descriptor = descriptorList_1_1.value;
|
|
14396
|
-
const device = yield this._createDevice(descriptor);
|
|
14440
|
+
const device = yield this._createDevice(descriptor, initOptions);
|
|
14397
14441
|
|
|
14398
14442
|
if (device.features) {
|
|
14399
14443
|
const uuid = getDeviceUUID(device.features);
|
|
@@ -14424,7 +14468,7 @@ class DevicePool extends events.exports {
|
|
|
14424
14468
|
Log$6.debug('get devices result : ', devices, deviceList);
|
|
14425
14469
|
console.log('device poll -> connected: ', this.connectedPool);
|
|
14426
14470
|
console.log('device poll -> disconnected: ', this.disconnectPool);
|
|
14427
|
-
yield this._checkDevicePool();
|
|
14471
|
+
yield this._checkDevicePool(initOptions);
|
|
14428
14472
|
return {
|
|
14429
14473
|
devices,
|
|
14430
14474
|
deviceList
|
|
@@ -14432,7 +14476,16 @@ class DevicePool extends events.exports {
|
|
|
14432
14476
|
});
|
|
14433
14477
|
}
|
|
14434
14478
|
|
|
14435
|
-
static
|
|
14479
|
+
static clearDeviceCache(connectId) {
|
|
14480
|
+
Log$6.debug('clear device pool cache: connectId', connectId);
|
|
14481
|
+
Log$6.debug('clear device pool cache: ', this.devicesCache);
|
|
14482
|
+
|
|
14483
|
+
if (connectId) {
|
|
14484
|
+
delete this.devicesCache[connectId];
|
|
14485
|
+
}
|
|
14486
|
+
}
|
|
14487
|
+
|
|
14488
|
+
static _createDevice(descriptor, initOptions) {
|
|
14436
14489
|
return __awaiter(this, void 0, void 0, function* () {
|
|
14437
14490
|
let device = this.getDeviceByPath(descriptor.path);
|
|
14438
14491
|
|
|
@@ -14440,7 +14493,7 @@ class DevicePool extends events.exports {
|
|
|
14440
14493
|
device = Device.fromDescriptor(descriptor);
|
|
14441
14494
|
device.deviceConnector = this.connector;
|
|
14442
14495
|
yield device.connect();
|
|
14443
|
-
yield device.initialize();
|
|
14496
|
+
yield device.initialize(initOptions);
|
|
14444
14497
|
yield device.release();
|
|
14445
14498
|
}
|
|
14446
14499
|
|
|
@@ -14448,19 +14501,19 @@ class DevicePool extends events.exports {
|
|
|
14448
14501
|
});
|
|
14449
14502
|
}
|
|
14450
14503
|
|
|
14451
|
-
static _checkDevicePool() {
|
|
14504
|
+
static _checkDevicePool(initOptions) {
|
|
14452
14505
|
return __awaiter(this, void 0, void 0, function* () {
|
|
14453
|
-
yield this._sendConnectMessage();
|
|
14506
|
+
yield this._sendConnectMessage(initOptions);
|
|
14454
14507
|
|
|
14455
14508
|
this._sendDisconnectMessage();
|
|
14456
14509
|
});
|
|
14457
14510
|
}
|
|
14458
14511
|
|
|
14459
|
-
static _sendConnectMessage() {
|
|
14512
|
+
static _sendConnectMessage(initOptions) {
|
|
14460
14513
|
return __awaiter(this, void 0, void 0, function* () {
|
|
14461
14514
|
for (let i = this.connectedPool.length - 1; i >= 0; i--) {
|
|
14462
14515
|
const descriptor = this.connectedPool[i];
|
|
14463
|
-
const device = yield this._createDevice(descriptor);
|
|
14516
|
+
const device = yield this._createDevice(descriptor, initOptions);
|
|
14464
14517
|
Log$6.debug('emit DEVICE.CONNECT: ', device);
|
|
14465
14518
|
this.emitter.emit(DEVICE.CONNECT, device);
|
|
14466
14519
|
this.connectedPool.splice(i, 1);
|
|
@@ -14749,8 +14802,6 @@ class DeviceCommands {
|
|
|
14749
14802
|
}
|
|
14750
14803
|
|
|
14751
14804
|
_filterCommonTypes(res) {
|
|
14752
|
-
var _a;
|
|
14753
|
-
|
|
14754
14805
|
Log$4.debug('_filterCommonTypes: ', res);
|
|
14755
14806
|
|
|
14756
14807
|
if (res.type === 'Failure') {
|
|
@@ -14818,12 +14869,10 @@ class DeviceCommands {
|
|
|
14818
14869
|
}, () => this._commonCall('Cancel', {}));
|
|
14819
14870
|
}
|
|
14820
14871
|
|
|
14821
|
-
if ((_a = this.device.features) === null || _a === void 0 ? void 0 : _a.passphrase_protection) {
|
|
14822
|
-
return Promise.reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceNotSupportPassphrase));
|
|
14823
|
-
}
|
|
14824
|
-
|
|
14825
14872
|
if (res.type === 'PassphraseRequest') {
|
|
14826
|
-
return Promise.reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceNotSupportPassphrase
|
|
14873
|
+
return Promise.reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceNotSupportPassphrase, 'Device not support passphrase', {
|
|
14874
|
+
require: '2.4.0'
|
|
14875
|
+
}));
|
|
14827
14876
|
}
|
|
14828
14877
|
|
|
14829
14878
|
if (res.type === 'Deprecated_PassphraseStateRequest') ;
|
|
@@ -14865,7 +14914,7 @@ const UI_REQUEST = {
|
|
|
14865
14914
|
FIRMWARE_NOT_INSTALLED: 'ui-device_firmware_not_installed',
|
|
14866
14915
|
NOT_USE_ONEKEY_DEVICE: 'ui-device_please_use_onekey_device'
|
|
14867
14916
|
};
|
|
14868
|
-
const DEFAULT_DOMAIN = `https://jssdk.onekey.so/${"0.1.
|
|
14917
|
+
const DEFAULT_DOMAIN = `https://jssdk.onekey.so/${"0.1.38"}/`;
|
|
14869
14918
|
const DEFAULT_PRIORITY = 2;
|
|
14870
14919
|
const initialSettings = {
|
|
14871
14920
|
configSrc: './data/config.json',
|
|
@@ -14967,6 +15016,7 @@ const parseRunOptions = options => {
|
|
|
14967
15016
|
};
|
|
14968
15017
|
|
|
14969
15018
|
const Log$3 = getLogger(exports.d0.Device);
|
|
15019
|
+
const deviceSessionCache = {};
|
|
14970
15020
|
|
|
14971
15021
|
class Device extends events.exports {
|
|
14972
15022
|
constructor(descriptor) {
|
|
@@ -14980,6 +15030,7 @@ class Device extends events.exports {
|
|
|
14980
15030
|
this.internalState = [];
|
|
14981
15031
|
this.needReloadDevice = false;
|
|
14982
15032
|
this.keepSession = false;
|
|
15033
|
+
this.passphraseState = undefined;
|
|
14983
15034
|
this.originalDescriptor = descriptor;
|
|
14984
15035
|
}
|
|
14985
15036
|
|
|
@@ -15116,44 +15167,75 @@ class Device extends events.exports {
|
|
|
15116
15167
|
return this.commands;
|
|
15117
15168
|
}
|
|
15118
15169
|
|
|
15119
|
-
getInternalState() {
|
|
15120
|
-
|
|
15170
|
+
getInternalState(_deviceId) {
|
|
15171
|
+
var _a, _b, _c;
|
|
15172
|
+
|
|
15173
|
+
Log$3.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}`);
|
|
15174
|
+
Log$3.debug('getInternalState session cache: ', deviceSessionCache);
|
|
15175
|
+
const deviceId = _deviceId || ((_b = this.features) === null || _b === void 0 ? void 0 : _b.device_id);
|
|
15176
|
+
if (!deviceId) return undefined;
|
|
15177
|
+
const key = `${deviceId}`;
|
|
15178
|
+
const usePassKey = `${deviceId}@${this.passphraseState}`;
|
|
15179
|
+
const session = (_c = deviceSessionCache[key]) !== null && _c !== void 0 ? _c : deviceSessionCache[usePassKey];
|
|
15180
|
+
return this.passphraseState ? session : undefined;
|
|
15181
|
+
}
|
|
15182
|
+
|
|
15183
|
+
setInternalState(state, initSession) {
|
|
15184
|
+
var _a;
|
|
15185
|
+
|
|
15186
|
+
Log$3.debug('setInternalState session param: ', `state: ${state}`, `initSession: ${initSession}`, `device_id: ${(_a = this.features) === null || _a === void 0 ? void 0 : _a.device_id}`, `passphraseState: ${this.passphraseState}`);
|
|
15187
|
+
if (!this.features) return;
|
|
15188
|
+
if (!this.passphraseState && !initSession) return;
|
|
15189
|
+
let key = `${this.features.device_id}`;
|
|
15190
|
+
|
|
15191
|
+
if (this.passphraseState) {
|
|
15192
|
+
key += `@${this.passphraseState}`;
|
|
15193
|
+
}
|
|
15194
|
+
|
|
15195
|
+
if (state) {
|
|
15196
|
+
deviceSessionCache[key] = state;
|
|
15197
|
+
}
|
|
15198
|
+
|
|
15199
|
+
Log$3.debug('setInternalState done session cache: ', deviceSessionCache);
|
|
15121
15200
|
}
|
|
15122
15201
|
|
|
15123
|
-
|
|
15202
|
+
clearInternalState(_deviceId) {
|
|
15203
|
+
var _a;
|
|
15204
|
+
|
|
15205
|
+
Log$3.debug('clearInternalState param: ', _deviceId);
|
|
15206
|
+
const deviceId = _deviceId || ((_a = this.features) === null || _a === void 0 ? void 0 : _a.device_id);
|
|
15207
|
+
if (!deviceId) return;
|
|
15208
|
+
const key = `${deviceId}`;
|
|
15209
|
+
delete deviceSessionCache[key];
|
|
15210
|
+
|
|
15211
|
+
if (this.passphraseState) {
|
|
15212
|
+
const usePassKey = `${deviceId}@${this.passphraseState}`;
|
|
15213
|
+
delete deviceSessionCache[usePassKey];
|
|
15214
|
+
}
|
|
15215
|
+
}
|
|
15216
|
+
|
|
15217
|
+
initialize(options) {
|
|
15124
15218
|
return __awaiter(this, void 0, void 0, function* () {
|
|
15125
|
-
|
|
15219
|
+
Log$3.debug('initialize param:', options);
|
|
15220
|
+
this.passphraseState = options === null || options === void 0 ? void 0 : options.passphraseState;
|
|
15221
|
+
|
|
15222
|
+
if (options === null || options === void 0 ? void 0 : options.initSession) {
|
|
15223
|
+
this.clearInternalState(options === null || options === void 0 ? void 0 : options.deviceId);
|
|
15224
|
+
}
|
|
15126
15225
|
|
|
15127
|
-
|
|
15128
|
-
|
|
15129
|
-
payload = {};
|
|
15226
|
+
const internalState = this.getInternalState(options === null || options === void 0 ? void 0 : options.deviceId);
|
|
15227
|
+
const payload = {};
|
|
15130
15228
|
|
|
15131
|
-
|
|
15132
|
-
|
|
15133
|
-
}
|
|
15229
|
+
if (internalState) {
|
|
15230
|
+
payload.session_id = internalState;
|
|
15134
15231
|
}
|
|
15135
15232
|
|
|
15233
|
+
Log$3.debug('initialize payload:', payload);
|
|
15136
15234
|
const {
|
|
15137
15235
|
message
|
|
15138
15236
|
} = yield this.commands.typedCall('Initialize', 'Features', payload);
|
|
15139
15237
|
|
|
15140
|
-
this._updateFeatures(message);
|
|
15141
|
-
|
|
15142
|
-
if (message.passphrase_protection) {
|
|
15143
|
-
if (this.listenerCount(DEVICE.PIN) > 0) {
|
|
15144
|
-
Log$3.debug('try to close passpharse');
|
|
15145
|
-
|
|
15146
|
-
try {
|
|
15147
|
-
yield this.commands.typedCall('ApplySettings', 'Success', {
|
|
15148
|
-
use_passphrase: false
|
|
15149
|
-
});
|
|
15150
|
-
} catch (e) {
|
|
15151
|
-
yield this.release();
|
|
15152
|
-
this.runPromise = null;
|
|
15153
|
-
throw e;
|
|
15154
|
-
}
|
|
15155
|
-
}
|
|
15156
|
-
}
|
|
15238
|
+
this._updateFeatures(message, options === null || options === void 0 ? void 0 : options.initSession);
|
|
15157
15239
|
});
|
|
15158
15240
|
}
|
|
15159
15241
|
|
|
@@ -15167,11 +15249,15 @@ class Device extends events.exports {
|
|
|
15167
15249
|
});
|
|
15168
15250
|
}
|
|
15169
15251
|
|
|
15170
|
-
_updateFeatures(feat) {
|
|
15252
|
+
_updateFeatures(feat, initSession) {
|
|
15171
15253
|
if (this.features && this.features.session_id && !feat.session_id) {
|
|
15172
15254
|
feat.session_id = this.features.session_id;
|
|
15173
15255
|
}
|
|
15174
15256
|
|
|
15257
|
+
if (this.features && this.features.device_id && feat.session_id) {
|
|
15258
|
+
this.setInternalState(feat.session_id, initSession);
|
|
15259
|
+
}
|
|
15260
|
+
|
|
15175
15261
|
feat.unlocked = feat.unlocked || true;
|
|
15176
15262
|
this.features = feat;
|
|
15177
15263
|
this.featuresNeedsReload = false;
|
|
@@ -15221,8 +15307,6 @@ class Device extends events.exports {
|
|
|
15221
15307
|
}
|
|
15222
15308
|
|
|
15223
15309
|
_runInner(fn, options) {
|
|
15224
|
-
var _a;
|
|
15225
|
-
|
|
15226
15310
|
return __awaiter(this, void 0, void 0, function* () {
|
|
15227
15311
|
if (!this.isUsedHere() || this.commands.disposed) {
|
|
15228
15312
|
const env = DataManager.getSettings('env');
|
|
@@ -15232,7 +15316,7 @@ class Device extends events.exports {
|
|
|
15232
15316
|
|
|
15233
15317
|
try {
|
|
15234
15318
|
if (fn) {
|
|
15235
|
-
yield this.initialize();
|
|
15319
|
+
yield this.initialize(options);
|
|
15236
15320
|
}
|
|
15237
15321
|
} catch (error) {
|
|
15238
15322
|
this.runPromise = null;
|
|
@@ -15243,21 +15327,6 @@ class Device extends events.exports {
|
|
|
15243
15327
|
|
|
15244
15328
|
return Promise.reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceInitializeFailed, `Initialize failed: ${error.message}, code: ${error.code}`));
|
|
15245
15329
|
}
|
|
15246
|
-
} else if (env === 'react-native') {
|
|
15247
|
-
if ((_a = this.features) === null || _a === void 0 ? void 0 : _a.passphrase_protection) {
|
|
15248
|
-
if (this.listenerCount(DEVICE.PIN) > 0) {
|
|
15249
|
-
Log$3.debug('try to close passpharse for mobile');
|
|
15250
|
-
|
|
15251
|
-
try {
|
|
15252
|
-
yield this.commands.typedCall('ApplySettings', 'Success', {
|
|
15253
|
-
use_passphrase: false
|
|
15254
|
-
});
|
|
15255
|
-
} catch (e) {
|
|
15256
|
-
this.runPromise = null;
|
|
15257
|
-
return Promise.reject(e);
|
|
15258
|
-
}
|
|
15259
|
-
}
|
|
15260
|
-
}
|
|
15261
15330
|
}
|
|
15262
15331
|
}
|
|
15263
15332
|
|
|
@@ -15391,6 +15460,14 @@ class Device extends events.exports {
|
|
|
15391
15460
|
return null;
|
|
15392
15461
|
}
|
|
15393
15462
|
|
|
15463
|
+
hasUsePassphrase() {
|
|
15464
|
+
var _a;
|
|
15465
|
+
|
|
15466
|
+
const isModeT = getDeviceType(this.features) === 'touch' || getDeviceType(this.features) === 'pro';
|
|
15467
|
+
const preCheckTouch = isModeT && ((_a = this.features) === null || _a === void 0 ? void 0 : _a.unlocked) === true;
|
|
15468
|
+
return this.features && (!!this.features.passphrase_protection || preCheckTouch);
|
|
15469
|
+
}
|
|
15470
|
+
|
|
15394
15471
|
checkDeviceId(deviceId) {
|
|
15395
15472
|
if (this.features) {
|
|
15396
15473
|
return this.features.device_id === deviceId;
|
|
@@ -15399,6 +15476,26 @@ class Device extends events.exports {
|
|
|
15399
15476
|
return false;
|
|
15400
15477
|
}
|
|
15401
15478
|
|
|
15479
|
+
checkPassphraseState() {
|
|
15480
|
+
var _a;
|
|
15481
|
+
|
|
15482
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
15483
|
+
if (!this.features) return false;
|
|
15484
|
+
const locked = ((_a = this.features) === null || _a === void 0 ? void 0 : _a.unlocked) === true;
|
|
15485
|
+
const isModeT = getDeviceType(this.features) === 'touch' || getDeviceType(this.features) === 'pro';
|
|
15486
|
+
const newState = yield getPassphraseState(this.features, this.commands);
|
|
15487
|
+
|
|
15488
|
+
if (isModeT && locked) {
|
|
15489
|
+
yield this.getFeatures();
|
|
15490
|
+
}
|
|
15491
|
+
|
|
15492
|
+
if (this.passphraseState && this.passphraseState !== newState) {
|
|
15493
|
+
this.clearInternalState();
|
|
15494
|
+
return newState;
|
|
15495
|
+
}
|
|
15496
|
+
});
|
|
15497
|
+
}
|
|
15498
|
+
|
|
15402
15499
|
}
|
|
15403
15500
|
|
|
15404
15501
|
class DeviceList extends events.exports {
|
|
@@ -15407,7 +15504,7 @@ class DeviceList extends events.exports {
|
|
|
15407
15504
|
this.devices = {};
|
|
15408
15505
|
}
|
|
15409
15506
|
|
|
15410
|
-
getDeviceLists(connectId) {
|
|
15507
|
+
getDeviceLists(connectId, initOptions) {
|
|
15411
15508
|
var _a, _b;
|
|
15412
15509
|
|
|
15413
15510
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -15417,7 +15514,7 @@ class DeviceList extends events.exports {
|
|
|
15417
15514
|
const {
|
|
15418
15515
|
deviceList,
|
|
15419
15516
|
devices
|
|
15420
|
-
} = yield DevicePool.getDevices(descriptorList, connectId);
|
|
15517
|
+
} = yield DevicePool.getDevices(descriptorList, connectId, initOptions);
|
|
15421
15518
|
this.devices = devices;
|
|
15422
15519
|
return deviceList;
|
|
15423
15520
|
});
|
|
@@ -15459,6 +15556,7 @@ class BaseMethod {
|
|
|
15459
15556
|
constructor(message) {
|
|
15460
15557
|
this.shouldEnsureConnected = true;
|
|
15461
15558
|
this.checkDeviceId = false;
|
|
15559
|
+
this.useDevicePassphraseState = true;
|
|
15462
15560
|
const {
|
|
15463
15561
|
payload
|
|
15464
15562
|
} = message;
|
|
@@ -15509,6 +15607,7 @@ class BaseMethod {
|
|
|
15509
15607
|
class SearchDevices extends BaseMethod {
|
|
15510
15608
|
init() {
|
|
15511
15609
|
this.useDevice = false;
|
|
15610
|
+
this.useDevicePassphraseState = false;
|
|
15512
15611
|
}
|
|
15513
15612
|
|
|
15514
15613
|
run() {
|
|
@@ -15543,6 +15642,7 @@ class SearchDevices extends BaseMethod {
|
|
|
15543
15642
|
class GetFeatures extends BaseMethod {
|
|
15544
15643
|
init() {
|
|
15545
15644
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.INITIALIZE, UI_REQUEST.BOOTLOADER];
|
|
15645
|
+
this.useDevicePassphraseState = false;
|
|
15546
15646
|
}
|
|
15547
15647
|
|
|
15548
15648
|
run() {
|
|
@@ -16810,7 +16910,9 @@ class BTCVerifyMessage extends BaseMethod {
|
|
|
16810
16910
|
}
|
|
16811
16911
|
|
|
16812
16912
|
class CheckFirmwareRelease extends BaseMethod {
|
|
16813
|
-
init() {
|
|
16913
|
+
init() {
|
|
16914
|
+
this.useDevicePassphraseState = false;
|
|
16915
|
+
}
|
|
16814
16916
|
|
|
16815
16917
|
run() {
|
|
16816
16918
|
if (this.device.features) {
|
|
@@ -16827,6 +16929,7 @@ class CheckBLEFirmwareRelease extends BaseMethod {
|
|
|
16827
16929
|
init() {
|
|
16828
16930
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.BOOTLOADER];
|
|
16829
16931
|
this.checkDeviceId = true;
|
|
16932
|
+
this.useDevicePassphraseState = false;
|
|
16830
16933
|
}
|
|
16831
16934
|
|
|
16832
16935
|
run() {
|
|
@@ -16843,6 +16946,7 @@ class CheckBLEFirmwareRelease extends BaseMethod {
|
|
|
16843
16946
|
class CheckTransportRelease extends BaseMethod {
|
|
16844
16947
|
init() {
|
|
16845
16948
|
this.useDevice = false;
|
|
16949
|
+
this.useDevicePassphraseState = false;
|
|
16846
16950
|
}
|
|
16847
16951
|
|
|
16848
16952
|
run() {
|
|
@@ -16859,6 +16963,7 @@ class CheckTransportRelease extends BaseMethod {
|
|
|
16859
16963
|
class CheckBridgeStatus$1 extends BaseMethod {
|
|
16860
16964
|
init() {
|
|
16861
16965
|
this.useDevice = false;
|
|
16966
|
+
this.useDevicePassphraseState = false;
|
|
16862
16967
|
}
|
|
16863
16968
|
|
|
16864
16969
|
run() {
|
|
@@ -16883,7 +16988,9 @@ class CheckBridgeStatus$1 extends BaseMethod {
|
|
|
16883
16988
|
}
|
|
16884
16989
|
|
|
16885
16990
|
class DeviceBackup extends BaseMethod {
|
|
16886
|
-
init() {
|
|
16991
|
+
init() {
|
|
16992
|
+
this.useDevicePassphraseState = false;
|
|
16993
|
+
}
|
|
16887
16994
|
|
|
16888
16995
|
run() {
|
|
16889
16996
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -16896,6 +17003,7 @@ class DeviceBackup extends BaseMethod {
|
|
|
16896
17003
|
|
|
16897
17004
|
class DeviceChangePin extends BaseMethod {
|
|
16898
17005
|
init() {
|
|
17006
|
+
this.useDevicePassphraseState = false;
|
|
16899
17007
|
validateParams(this.payload, [{
|
|
16900
17008
|
name: 'remove',
|
|
16901
17009
|
type: 'boolean'
|
|
@@ -16916,6 +17024,7 @@ class DeviceChangePin extends BaseMethod {
|
|
|
16916
17024
|
|
|
16917
17025
|
class DeviceFlags extends BaseMethod {
|
|
16918
17026
|
init() {
|
|
17027
|
+
this.useDevicePassphraseState = false;
|
|
16919
17028
|
validateParams(this.payload, [{
|
|
16920
17029
|
name: 'flags',
|
|
16921
17030
|
type: 'number'
|
|
@@ -16935,7 +17044,9 @@ class DeviceFlags extends BaseMethod {
|
|
|
16935
17044
|
}
|
|
16936
17045
|
|
|
16937
17046
|
class DeviceRebootToBootloader extends BaseMethod {
|
|
16938
|
-
init() {
|
|
17047
|
+
init() {
|
|
17048
|
+
this.useDevicePassphraseState = false;
|
|
17049
|
+
}
|
|
16939
17050
|
|
|
16940
17051
|
getVersionRange() {
|
|
16941
17052
|
return {
|
|
@@ -16959,6 +17070,7 @@ class DeviceRebootToBootloader extends BaseMethod {
|
|
|
16959
17070
|
|
|
16960
17071
|
class DeviceRecovery extends BaseMethod {
|
|
16961
17072
|
init() {
|
|
17073
|
+
this.useDevicePassphraseState = false;
|
|
16962
17074
|
validateParams(this.payload, [{
|
|
16963
17075
|
name: 'wordCount',
|
|
16964
17076
|
type: 'number'
|
|
@@ -17011,6 +17123,7 @@ class DeviceRecovery extends BaseMethod {
|
|
|
17011
17123
|
|
|
17012
17124
|
class DeviceReset extends BaseMethod {
|
|
17013
17125
|
init() {
|
|
17126
|
+
this.useDevicePassphraseState = false;
|
|
17014
17127
|
validateParams(this.payload, [{
|
|
17015
17128
|
name: 'displayRandom',
|
|
17016
17129
|
type: 'boolean'
|
|
@@ -17066,6 +17179,7 @@ class DeviceReset extends BaseMethod {
|
|
|
17066
17179
|
|
|
17067
17180
|
class DeviceSettings extends BaseMethod {
|
|
17068
17181
|
init() {
|
|
17182
|
+
this.useDevicePassphraseState = false;
|
|
17069
17183
|
validateParams(this.payload, [{
|
|
17070
17184
|
name: 'language',
|
|
17071
17185
|
type: 'string'
|
|
@@ -17097,7 +17211,6 @@ class DeviceSettings extends BaseMethod {
|
|
|
17097
17211
|
name: 'experimentalFeatures',
|
|
17098
17212
|
type: 'boolean'
|
|
17099
17213
|
}]);
|
|
17100
|
-
console.log('DeviceSettings payload', this.payload);
|
|
17101
17214
|
this.params = {
|
|
17102
17215
|
language: this.payload.language,
|
|
17103
17216
|
label: this.payload.label,
|
|
@@ -17112,6 +17225,18 @@ class DeviceSettings extends BaseMethod {
|
|
|
17112
17225
|
};
|
|
17113
17226
|
}
|
|
17114
17227
|
|
|
17228
|
+
getVersionRange() {
|
|
17229
|
+
if (this.payload.usePassphrase) {
|
|
17230
|
+
return {
|
|
17231
|
+
model_mini: {
|
|
17232
|
+
min: '2.4.0'
|
|
17233
|
+
}
|
|
17234
|
+
};
|
|
17235
|
+
}
|
|
17236
|
+
|
|
17237
|
+
return {};
|
|
17238
|
+
}
|
|
17239
|
+
|
|
17115
17240
|
run() {
|
|
17116
17241
|
return __awaiter(this, void 0, void 0, function* () {
|
|
17117
17242
|
const res = yield this.device.commands.typedCall('ApplySettings', 'Success', Object.assign({}, this.params));
|
|
@@ -17122,7 +17247,9 @@ class DeviceSettings extends BaseMethod {
|
|
|
17122
17247
|
}
|
|
17123
17248
|
|
|
17124
17249
|
class DeviceUpdateReboot extends BaseMethod {
|
|
17125
|
-
init() {
|
|
17250
|
+
init() {
|
|
17251
|
+
this.useDevicePassphraseState = false;
|
|
17252
|
+
}
|
|
17126
17253
|
|
|
17127
17254
|
run() {
|
|
17128
17255
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -17134,7 +17261,9 @@ class DeviceUpdateReboot extends BaseMethod {
|
|
|
17134
17261
|
}
|
|
17135
17262
|
|
|
17136
17263
|
class DeviceSupportFeatures extends BaseMethod {
|
|
17137
|
-
init() {
|
|
17264
|
+
init() {
|
|
17265
|
+
this.useDevicePassphraseState = false;
|
|
17266
|
+
}
|
|
17138
17267
|
|
|
17139
17268
|
run() {
|
|
17140
17269
|
if (!this.device.features) return Promise.reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, 'Device not initialized'));
|
|
@@ -17149,6 +17278,7 @@ class DeviceSupportFeatures extends BaseMethod {
|
|
|
17149
17278
|
|
|
17150
17279
|
class DeviceVerify extends BaseMethod {
|
|
17151
17280
|
init() {
|
|
17281
|
+
this.useDevicePassphraseState = false;
|
|
17152
17282
|
validateParams(this.payload, [{
|
|
17153
17283
|
name: 'dataHex',
|
|
17154
17284
|
type: 'hexString'
|
|
@@ -17187,7 +17317,9 @@ class DeviceVerify extends BaseMethod {
|
|
|
17187
17317
|
}
|
|
17188
17318
|
|
|
17189
17319
|
class DeviceWipe extends BaseMethod {
|
|
17190
|
-
init() {
|
|
17320
|
+
init() {
|
|
17321
|
+
this.useDevicePassphraseState = false;
|
|
17322
|
+
}
|
|
17191
17323
|
|
|
17192
17324
|
run() {
|
|
17193
17325
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -19075,6 +19207,7 @@ class FirmwareUpdate extends BaseMethod {
|
|
|
19075
19207
|
init() {
|
|
19076
19208
|
this.allowDeviceMode = [UI_REQUEST.BOOTLOADER, UI_REQUEST.INITIALIZE];
|
|
19077
19209
|
this.requireDeviceMode = [UI_REQUEST.BOOTLOADER];
|
|
19210
|
+
this.useDevicePassphraseState = false;
|
|
19078
19211
|
const {
|
|
19079
19212
|
payload
|
|
19080
19213
|
} = this;
|
|
@@ -19149,6 +19282,7 @@ const Log$2 = getLogger(exports.d0.Method);
|
|
|
19149
19282
|
class RequestWebUsbDevice extends BaseMethod {
|
|
19150
19283
|
init() {
|
|
19151
19284
|
this.useDevice = false;
|
|
19285
|
+
this.useDevicePassphraseState = false;
|
|
19152
19286
|
}
|
|
19153
19287
|
|
|
19154
19288
|
run() {
|
|
@@ -19185,9 +19319,45 @@ class RequestWebUsbDevice extends BaseMethod {
|
|
|
19185
19319
|
|
|
19186
19320
|
}
|
|
19187
19321
|
|
|
19322
|
+
class GetPassphraseState extends BaseMethod {
|
|
19323
|
+
init() {
|
|
19324
|
+
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.INITIALIZE];
|
|
19325
|
+
this.useDevicePassphraseState = false;
|
|
19326
|
+
}
|
|
19327
|
+
|
|
19328
|
+
run() {
|
|
19329
|
+
var _a, _b;
|
|
19330
|
+
|
|
19331
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
19332
|
+
if (!this.device.features) return Promise.reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceInitializeFailed));
|
|
19333
|
+
let {
|
|
19334
|
+
features
|
|
19335
|
+
} = this.device;
|
|
19336
|
+
const locked = ((_b = (_a = this.device) === null || _a === void 0 ? void 0 : _a.features) === null || _b === void 0 ? void 0 : _b.unlocked) === true;
|
|
19337
|
+
const passphraseState = yield getPassphraseState(this.device.features, this.device.commands);
|
|
19338
|
+
const isModeT = getDeviceType(features) === 'touch' || getDeviceType(features) === 'pro';
|
|
19339
|
+
|
|
19340
|
+
if (isModeT && locked) {
|
|
19341
|
+
const {
|
|
19342
|
+
message
|
|
19343
|
+
} = yield this.device.commands.typedCall('GetFeatures', 'Features', {});
|
|
19344
|
+
features = message;
|
|
19345
|
+
}
|
|
19346
|
+
|
|
19347
|
+
if (features && features.passphrase_protection === true) {
|
|
19348
|
+
return Promise.resolve(passphraseState);
|
|
19349
|
+
}
|
|
19350
|
+
|
|
19351
|
+
return Promise.resolve(undefined);
|
|
19352
|
+
});
|
|
19353
|
+
}
|
|
19354
|
+
|
|
19355
|
+
}
|
|
19356
|
+
|
|
19188
19357
|
class CheckBridgeStatus extends BaseMethod {
|
|
19189
19358
|
init() {
|
|
19190
19359
|
this.useDevice = false;
|
|
19360
|
+
this.useDevicePassphraseState = false;
|
|
19191
19361
|
}
|
|
19192
19362
|
|
|
19193
19363
|
run() {
|
|
@@ -19244,6 +19414,7 @@ var ApiMethods = /*#__PURE__*/Object.freeze({
|
|
|
19244
19414
|
stellarSignTransaction: StellarSignTransaction,
|
|
19245
19415
|
firmwareUpdate: FirmwareUpdate,
|
|
19246
19416
|
requestWebUsbDevice: RequestWebUsbDevice,
|
|
19417
|
+
getPassphraseState: GetPassphraseState,
|
|
19247
19418
|
getLogs: CheckBridgeStatus
|
|
19248
19419
|
});
|
|
19249
19420
|
|
|
@@ -19393,6 +19564,12 @@ class DeviceConnector {
|
|
|
19393
19564
|
|
|
19394
19565
|
const Log = getLogger(exports.d0.Core);
|
|
19395
19566
|
|
|
19567
|
+
const parseInitOptions = method => ({
|
|
19568
|
+
initSession: method === null || method === void 0 ? void 0 : method.payload.initSession,
|
|
19569
|
+
passphraseState: method === null || method === void 0 ? void 0 : method.payload.passphraseState,
|
|
19570
|
+
deviceId: method === null || method === void 0 ? void 0 : method.payload.deviceId
|
|
19571
|
+
});
|
|
19572
|
+
|
|
19396
19573
|
let _core;
|
|
19397
19574
|
|
|
19398
19575
|
let _deviceList;
|
|
@@ -19407,6 +19584,9 @@ const callApiQueue = [];
|
|
|
19407
19584
|
const deviceCacheMap = new Map();
|
|
19408
19585
|
let pollingId = 1;
|
|
19409
19586
|
const pollingState = {};
|
|
19587
|
+
let preConnectCache = {
|
|
19588
|
+
passphraseState: undefined
|
|
19589
|
+
};
|
|
19410
19590
|
|
|
19411
19591
|
const callAPI = message => __awaiter(void 0, void 0, void 0, function* () {
|
|
19412
19592
|
var _a;
|
|
@@ -19446,6 +19626,16 @@ const callAPI = message => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
19446
19626
|
Log.debug('should cancel the previous method execution: ', callApiQueue.map(m => m.name));
|
|
19447
19627
|
}
|
|
19448
19628
|
|
|
19629
|
+
const connectStateChange = preConnectCache.passphraseState !== method.payload.passphraseState;
|
|
19630
|
+
preConnectCache = {
|
|
19631
|
+
passphraseState: method.payload.passphraseState
|
|
19632
|
+
};
|
|
19633
|
+
|
|
19634
|
+
if (connectStateChange || method.payload.initSession) {
|
|
19635
|
+
Log.debug('passphrase state change, clear device cache');
|
|
19636
|
+
DevicePool.clearDeviceCache(method.payload.connectId);
|
|
19637
|
+
}
|
|
19638
|
+
|
|
19449
19639
|
if (pollingState[pollingId]) {
|
|
19450
19640
|
pollingState[pollingId] = false;
|
|
19451
19641
|
}
|
|
@@ -19465,6 +19655,7 @@ const callAPI = message => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
19465
19655
|
(_a = method.setDevice) === null || _a === void 0 ? void 0 : _a.call(method, device);
|
|
19466
19656
|
device.on(DEVICE.PIN, onDevicePinHandler);
|
|
19467
19657
|
device.on(DEVICE.BUTTON, onDeviceButtonHandler);
|
|
19658
|
+
device.on(DEVICE.PASSPHRASE_ON_DEVICE, onDevicePassphraseHandler);
|
|
19468
19659
|
device.on(DEVICE.FEATURES, onDeviceFeaturesHandler);
|
|
19469
19660
|
|
|
19470
19661
|
try {
|
|
@@ -19518,6 +19709,26 @@ const callAPI = message => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
19518
19709
|
yield TransportManager.reconfigure(device.getFirmwareVersion());
|
|
19519
19710
|
}
|
|
19520
19711
|
|
|
19712
|
+
checkPassphraseSafety(method, device.features);
|
|
19713
|
+
|
|
19714
|
+
if (device.hasUsePassphrase() && method.useDevicePassphraseState) {
|
|
19715
|
+
const support = supportNewPassphrase(device.features);
|
|
19716
|
+
|
|
19717
|
+
if (!support.support) {
|
|
19718
|
+
return Promise.reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceNotSupportPassphrase, `Device not support passphrase, please update to ${support.require}`, {
|
|
19719
|
+
require: support.require
|
|
19720
|
+
}));
|
|
19721
|
+
}
|
|
19722
|
+
|
|
19723
|
+
const passphraseState = yield device.checkPassphraseState();
|
|
19724
|
+
checkPassphraseSafety(method, device.features);
|
|
19725
|
+
|
|
19726
|
+
if (passphraseState) {
|
|
19727
|
+
DevicePool.clearDeviceCache(method.payload.connectId);
|
|
19728
|
+
return Promise.reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceCheckPassphraseStateError));
|
|
19729
|
+
}
|
|
19730
|
+
}
|
|
19731
|
+
|
|
19521
19732
|
try {
|
|
19522
19733
|
const response = yield method.run();
|
|
19523
19734
|
Log.debug('Call API - Inner Method Run: ');
|
|
@@ -19533,8 +19744,11 @@ const callAPI = message => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
19533
19744
|
});
|
|
19534
19745
|
|
|
19535
19746
|
Log.debug('Call API - Device Run: ', device.mainId);
|
|
19747
|
+
const runOptions = Object.assign({
|
|
19748
|
+
keepSession: method.payload.keepSession
|
|
19749
|
+
}, parseInitOptions(method));
|
|
19536
19750
|
|
|
19537
|
-
const deviceRun = () => device.run(inner);
|
|
19751
|
+
const deviceRun = () => device.run(inner, runOptions);
|
|
19538
19752
|
|
|
19539
19753
|
_callPromise = hdShared.createDeferred(deviceRun);
|
|
19540
19754
|
|
|
@@ -19589,7 +19803,7 @@ function initDeviceList(method) {
|
|
|
19589
19803
|
_deviceList.connector = _connector;
|
|
19590
19804
|
}
|
|
19591
19805
|
|
|
19592
|
-
yield _deviceList.getDeviceLists(method.connectId);
|
|
19806
|
+
yield _deviceList.getDeviceLists(method.connectId, parseInitOptions(method));
|
|
19593
19807
|
});
|
|
19594
19808
|
}
|
|
19595
19809
|
|
|
@@ -19701,7 +19915,7 @@ const ensureConnected = (method, pollingId) => __awaiter(void 0, void 0, void 0,
|
|
|
19701
19915
|
|
|
19702
19916
|
if (env === 'react-native') {
|
|
19703
19917
|
yield device.acquire();
|
|
19704
|
-
yield device.initialize();
|
|
19918
|
+
yield device.initialize(parseInitOptions(method));
|
|
19705
19919
|
}
|
|
19706
19920
|
|
|
19707
19921
|
resolve(device);
|
|
@@ -19761,6 +19975,20 @@ const cancel = connectId => {
|
|
|
19761
19975
|
closePopup();
|
|
19762
19976
|
};
|
|
19763
19977
|
|
|
19978
|
+
const checkPassphraseSafety = (method, features) => {
|
|
19979
|
+
if (!method.useDevicePassphraseState) return;
|
|
19980
|
+
|
|
19981
|
+
if ((features === null || features === void 0 ? void 0 : features.passphrase_protection) === true && !method.payload.passphraseState) {
|
|
19982
|
+
DevicePool.clearDeviceCache(method.payload.connectId);
|
|
19983
|
+
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceOpenedPassphrase);
|
|
19984
|
+
}
|
|
19985
|
+
|
|
19986
|
+
if ((features === null || features === void 0 ? void 0 : features.passphrase_protection) === false && method.payload.passphraseState) {
|
|
19987
|
+
DevicePool.clearDeviceCache(method.payload.connectId);
|
|
19988
|
+
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceNotOpenedPassphrase);
|
|
19989
|
+
}
|
|
19990
|
+
};
|
|
19991
|
+
|
|
19764
19992
|
const cleanup = () => {
|
|
19765
19993
|
_uiPromises = [];
|
|
19766
19994
|
Log.debug('Cleanup...');
|
|
@@ -19769,6 +19997,7 @@ const cleanup = () => {
|
|
|
19769
19997
|
const removeDeviceListener = device => {
|
|
19770
19998
|
device.removeListener(DEVICE.PIN, onDevicePinHandler);
|
|
19771
19999
|
device.removeListener(DEVICE.BUTTON, onDeviceButtonHandler);
|
|
20000
|
+
device.removeListener(DEVICE.PASSPHRASE_ON_DEVICE, onDevicePassphraseHandler);
|
|
19772
20001
|
device.removeListener(DEVICE.FEATURES, onDeviceFeaturesHandler);
|
|
19773
20002
|
DevicePool.emitter.removeListener(DEVICE.CONNECT, onDeviceConnectHandler);
|
|
19774
20003
|
};
|
|
@@ -19825,6 +20054,13 @@ const onDeviceFeaturesHandler = (...[_, features]) => {
|
|
|
19825
20054
|
postMessage(createDeviceMessage(DEVICE.FEATURES, Object.assign({}, features)));
|
|
19826
20055
|
};
|
|
19827
20056
|
|
|
20057
|
+
const onDevicePassphraseHandler = (...[device]) => {
|
|
20058
|
+
postMessage(createUiMessage(UI_REQUEST$1.REQUEST_PASSPHRASE_ON_DEVICE, {
|
|
20059
|
+
device: device.toMessageObject(),
|
|
20060
|
+
passphraseState: device.passphraseState
|
|
20061
|
+
}));
|
|
20062
|
+
};
|
|
20063
|
+
|
|
19828
20064
|
const postMessage = message => {
|
|
19829
20065
|
_core.emit(CORE_EVENT, message);
|
|
19830
20066
|
};
|
|
@@ -21196,6 +21432,9 @@ const HardwareErrorCode = {
|
|
|
21196
21432
|
DeviceInterruptedFromUser: 109,
|
|
21197
21433
|
DeviceCheckDeviceIdError: 110,
|
|
21198
21434
|
DeviceNotSupportPassphrase: 111,
|
|
21435
|
+
DeviceCheckPassphraseStateError: 112,
|
|
21436
|
+
DeviceNotOpenedPassphrase: 113,
|
|
21437
|
+
DeviceOpenedPassphrase: 114,
|
|
21199
21438
|
NotInitialized: 200,
|
|
21200
21439
|
IFrameNotInitialized: 300,
|
|
21201
21440
|
IFrameAleradyInitialized: 301,
|
|
@@ -21250,6 +21489,9 @@ const HardwareErrorCodeMessage = {
|
|
|
21250
21489
|
[HardwareErrorCode.DeviceUnexpectedBootloaderMode]: 'Device should be in bootloader mode',
|
|
21251
21490
|
[HardwareErrorCode.DeviceCheckDeviceIdError]: 'Device Id in the features is not same.',
|
|
21252
21491
|
[HardwareErrorCode.DeviceNotSupportPassphrase]: 'Device not support passphrase',
|
|
21492
|
+
[HardwareErrorCode.DeviceCheckPassphraseStateError]: 'Device passphrase state error',
|
|
21493
|
+
[HardwareErrorCode.DeviceNotOpenedPassphrase]: 'Device not opened passphrase',
|
|
21494
|
+
[HardwareErrorCode.DeviceOpenedPassphrase]: 'Device opened passphrase',
|
|
21253
21495
|
[HardwareErrorCode.NotInitialized]: 'Not initialized',
|
|
21254
21496
|
[HardwareErrorCode.IFrameNotInitialized]: 'IFrame not initialized',
|
|
21255
21497
|
[HardwareErrorCode.IFrameAleradyInitialized]: 'IFrame alerady initialized',
|
|
@@ -46540,7 +46782,7 @@ const src_init = async settings => {
|
|
|
46540
46782
|
|
|
46541
46783
|
try {
|
|
46542
46784
|
await init({ ..._settings,
|
|
46543
|
-
version: "0.1.
|
|
46785
|
+
version: "0.1.38"
|
|
46544
46786
|
});
|
|
46545
46787
|
return true;
|
|
46546
46788
|
} catch (e) {
|