@onekeyfe/hd-web-sdk 0.1.58 → 0.2.0

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.
@@ -5359,10 +5359,35 @@ const inject = ({
5359
5359
  deviceId,
5360
5360
  method: 'aptosGetPublicKey'
5361
5361
  })),
5362
+ aptosSignMessage: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), {
5363
+ connectId,
5364
+ deviceId,
5365
+ method: 'aptosSignMessage'
5366
+ })),
5362
5367
  aptosSignTransaction: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), {
5363
5368
  connectId,
5364
5369
  deviceId,
5365
5370
  method: 'aptosSignTransaction'
5371
+ })),
5372
+ algoGetAddress: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), {
5373
+ connectId,
5374
+ deviceId,
5375
+ method: 'algoGetAddress'
5376
+ })),
5377
+ algoSignTransaction: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), {
5378
+ connectId,
5379
+ deviceId,
5380
+ method: 'algoSignTransaction'
5381
+ })),
5382
+ cosmosGetAddress: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), {
5383
+ connectId,
5384
+ deviceId,
5385
+ method: 'cosmosGetAddress'
5386
+ })),
5387
+ cosmosSignTransaction: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), {
5388
+ connectId,
5389
+ deviceId,
5390
+ method: 'cosmosSignTransaction'
5366
5391
  }))
5367
5392
  };
5368
5393
  return api;
@@ -6187,6 +6212,56 @@ const supportBatchPublicKey = features => {
6187
6212
  };
6188
6213
 
6189
6214
  var nested = {
6215
+ AlgorandGetAddress: {
6216
+ fields: {
6217
+ address_n: {
6218
+ rule: "repeated",
6219
+ type: "uint32",
6220
+ id: 1,
6221
+ options: {
6222
+ packed: false
6223
+ }
6224
+ },
6225
+ show_display: {
6226
+ type: "bool",
6227
+ id: 3
6228
+ }
6229
+ }
6230
+ },
6231
+ AlgorandAddress: {
6232
+ fields: {
6233
+ address: {
6234
+ type: "string",
6235
+ id: 1
6236
+ }
6237
+ }
6238
+ },
6239
+ AlgorandSignTx: {
6240
+ fields: {
6241
+ address_n: {
6242
+ rule: "repeated",
6243
+ type: "uint32",
6244
+ id: 1,
6245
+ options: {
6246
+ packed: false
6247
+ }
6248
+ },
6249
+ raw_tx: {
6250
+ rule: "required",
6251
+ type: "bytes",
6252
+ id: 2
6253
+ }
6254
+ }
6255
+ },
6256
+ AlgorandSignedTx: {
6257
+ fields: {
6258
+ signature: {
6259
+ rule: "required",
6260
+ type: "bytes",
6261
+ id: 1
6262
+ }
6263
+ }
6264
+ },
6190
6265
  AptosGetAddress: {
6191
6266
  fields: {
6192
6267
  address_n: {
@@ -6242,6 +6317,65 @@ var nested = {
6242
6317
  }
6243
6318
  }
6244
6319
  },
6320
+ AptosSignMessage: {
6321
+ fields: {
6322
+ address_n: {
6323
+ rule: "repeated",
6324
+ type: "uint32",
6325
+ id: 1,
6326
+ options: {
6327
+ packed: false
6328
+ }
6329
+ },
6330
+ payload: {
6331
+ rule: "required",
6332
+ type: "AptosMessagePayload",
6333
+ id: 2
6334
+ }
6335
+ },
6336
+ nested: {
6337
+ AptosMessagePayload: {
6338
+ fields: {
6339
+ address: {
6340
+ type: "string",
6341
+ id: 2
6342
+ },
6343
+ chain_id: {
6344
+ type: "string",
6345
+ id: 3
6346
+ },
6347
+ application: {
6348
+ type: "string",
6349
+ id: 4
6350
+ },
6351
+ nonce: {
6352
+ rule: "required",
6353
+ type: "string",
6354
+ id: 5
6355
+ },
6356
+ message: {
6357
+ rule: "required",
6358
+ type: "string",
6359
+ id: 6
6360
+ }
6361
+ }
6362
+ }
6363
+ }
6364
+ },
6365
+ AptosMessageSignature: {
6366
+ fields: {
6367
+ signature: {
6368
+ rule: "required",
6369
+ type: "bytes",
6370
+ id: 1
6371
+ },
6372
+ address: {
6373
+ rule: "required",
6374
+ type: "string",
6375
+ id: 2
6376
+ }
6377
+ }
6378
+ },
6245
6379
  BinanceGetAddress: {
6246
6380
  fields: {
6247
6381
  address_n: {
@@ -9014,6 +9148,60 @@ var nested = {
9014
9148
  }
9015
9149
  }
9016
9150
  },
9151
+ CosmosGetAddress: {
9152
+ fields: {
9153
+ address_n: {
9154
+ rule: "repeated",
9155
+ type: "uint32",
9156
+ id: 1,
9157
+ options: {
9158
+ packed: false
9159
+ }
9160
+ },
9161
+ hrp: {
9162
+ type: "string",
9163
+ id: 2
9164
+ },
9165
+ show_display: {
9166
+ type: "bool",
9167
+ id: 3
9168
+ }
9169
+ }
9170
+ },
9171
+ CosmosAddress: {
9172
+ fields: {
9173
+ address: {
9174
+ type: "string",
9175
+ id: 1
9176
+ }
9177
+ }
9178
+ },
9179
+ CosmosSignTx: {
9180
+ fields: {
9181
+ address_n: {
9182
+ rule: "repeated",
9183
+ type: "uint32",
9184
+ id: 1,
9185
+ options: {
9186
+ packed: false
9187
+ }
9188
+ },
9189
+ raw_tx: {
9190
+ rule: "required",
9191
+ type: "bytes",
9192
+ id: 2
9193
+ }
9194
+ }
9195
+ },
9196
+ CosmosSignedTx: {
9197
+ fields: {
9198
+ signature: {
9199
+ rule: "required",
9200
+ type: "bytes",
9201
+ id: 1
9202
+ }
9203
+ }
9204
+ },
9017
9205
  CipherKeyValue: {
9018
9206
  fields: {
9019
9207
  address_n: {
@@ -14695,6 +14883,8 @@ var nested = {
14695
14883
  MessageType_AptosAddress: 10601,
14696
14884
  MessageType_AptosSignTx: 10602,
14697
14885
  MessageType_AptosSignedTx: 10603,
14886
+ MessageType_AptosSignMessage: 10604,
14887
+ MessageType_AptosMessageSignature: 10605,
14698
14888
  MessageType_WebAuthnListResidentCredentials: 800,
14699
14889
  MessageType_WebAuthnCredentials: 801,
14700
14890
  MessageType_WebAuthnAddResidentCredential: 802,
@@ -14735,6 +14925,14 @@ var nested = {
14735
14925
  MessageType_NearAddress: 10702,
14736
14926
  MessageType_NearSignTx: 10703,
14737
14927
  MessageType_NearSignedTx: 10704,
14928
+ MessageType_CosmosGetAddress: 10800,
14929
+ MessageType_CosmosAddress: 10801,
14930
+ MessageType_CosmosSignTx: 10802,
14931
+ MessageType_CosmosSignedTx: 10803,
14932
+ MessageType_AlgorandGetAddress: 10900,
14933
+ MessageType_AlgorandAddress: 10901,
14934
+ MessageType_AlgorandSignTx: 10902,
14935
+ MessageType_AlgorandSignedTx: 10903,
14738
14936
  MessageType_DeviceBackToBoot: 903,
14739
14937
  MessageType_DeviceInfoSettings: 10001,
14740
14938
  MessageType_GetDeviceInfo: 10002,
@@ -15869,7 +16067,7 @@ DataManager.getFirmwareStatus = features => {
15869
16067
  return getReleaseStatus(targetDeviceConfigList, currentVersion);
15870
16068
  };
15871
16069
 
15872
- DataManager.getSysResourcesLatestRelease = features => {
16070
+ DataManager.getSysResourcesLatestRelease = (features, forcedUpdateRes) => {
15873
16071
  var _b, _c, _d;
15874
16072
 
15875
16073
  const deviceType = getDeviceType(features);
@@ -15877,7 +16075,7 @@ DataManager.getSysResourcesLatestRelease = features => {
15877
16075
  if (deviceType !== 'pro' && deviceType !== 'touch') return undefined;
15878
16076
  const targetDeviceConfigList = (_c = (_b = _a.deviceMap[deviceType]) === null || _b === void 0 ? void 0 : _b.firmware) !== null && _c !== void 0 ? _c : [];
15879
16077
  const currentVersion = deviceFirmwareVersion.join('.');
15880
- const targetDeviceConfig = targetDeviceConfigList.filter(item => semver__default["default"].gt(item.version.join('.'), currentVersion) && !!item.resource);
16078
+ const targetDeviceConfig = targetDeviceConfigList.filter(item => forcedUpdateRes ? !!item.resource : semver__default["default"].gt(item.version.join('.'), currentVersion) && !!item.resource);
15881
16079
  return (_d = findLatestRelease(targetDeviceConfig)) === null || _d === void 0 ? void 0 : _d.resource;
15882
16080
  };
15883
16081
 
@@ -18522,6 +18720,9 @@ class FirmwareUpdate extends BaseMethod {
18522
18720
  }, {
18523
18721
  name: 'binary',
18524
18722
  type: 'buffer'
18723
+ }, {
18724
+ name: 'forcedUpdateRes',
18725
+ type: 'boolean'
18525
18726
  }]);
18526
18727
 
18527
18728
  if (!payload.updateType) {
@@ -18529,7 +18730,8 @@ class FirmwareUpdate extends BaseMethod {
18529
18730
  }
18530
18731
 
18531
18732
  this.params = {
18532
- updateType: payload.updateType
18733
+ updateType: payload.updateType,
18734
+ forcedUpdateRes: payload.forcedUpdateRes
18533
18735
  };
18534
18736
 
18535
18737
  if ('version' in payload) {
@@ -18622,7 +18824,7 @@ class FirmwareUpdate extends BaseMethod {
18622
18824
 
18623
18825
  if (features && this.isSupportResourceUpdate(features, params.updateType)) {
18624
18826
  this.postTipMessage('CheckLatestUiResource');
18625
- const resourceUrl = DataManager.getSysResourcesLatestRelease(features);
18827
+ const resourceUrl = DataManager.getSysResourcesLatestRelease(features, params.forcedUpdateRes);
18626
18828
 
18627
18829
  if (resourceUrl) {
18628
18830
  this.postTipMessage('DownloadLatestUiResource');
@@ -22455,6 +22657,335 @@ class AptosSignTransaction extends BaseMethod {
22455
22657
 
22456
22658
  }
22457
22659
 
22660
+ class AptosSignMessage extends BaseMethod {
22661
+ init() {
22662
+ this.checkDeviceId = true;
22663
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.INITIALIZE];
22664
+ validateParams(this.payload, [{
22665
+ name: 'path',
22666
+ required: true
22667
+ }, {
22668
+ name: 'payload',
22669
+ type: 'object',
22670
+ required: true
22671
+ }]);
22672
+ const {
22673
+ path,
22674
+ payload
22675
+ } = this.payload;
22676
+ const addressN = validatePath(path, 3);
22677
+ validateParams(payload, [{
22678
+ name: 'address',
22679
+ type: 'string'
22680
+ }, {
22681
+ name: 'chainId',
22682
+ type: 'string'
22683
+ }, {
22684
+ name: 'application',
22685
+ type: 'string'
22686
+ }, {
22687
+ name: 'nonce',
22688
+ type: 'string',
22689
+ required: true
22690
+ }, {
22691
+ name: 'message',
22692
+ type: 'string',
22693
+ required: true
22694
+ }]);
22695
+ this.params = {
22696
+ address_n: addressN,
22697
+ payload: {
22698
+ address: payload.address,
22699
+ chain_id: payload.chainId,
22700
+ application: payload.application,
22701
+ nonce: payload.nonce,
22702
+ message: payload.message
22703
+ }
22704
+ };
22705
+ }
22706
+
22707
+ getVersionRange() {
22708
+ return {
22709
+ model_mini: {
22710
+ min: '2.6.0'
22711
+ }
22712
+ };
22713
+ }
22714
+
22715
+ run() {
22716
+ return __awaiter(this, void 0, void 0, function* () {
22717
+ let fullMessage = 'APTOS\n';
22718
+
22719
+ if (this.params.payload.address) {
22720
+ fullMessage += `address: ${this.params.payload.address}\n`;
22721
+ }
22722
+
22723
+ if (this.params.payload.application) {
22724
+ fullMessage += `application: ${this.params.payload.application}\n`;
22725
+ }
22726
+
22727
+ if (this.params.payload.chain_id) {
22728
+ fullMessage += `chainId: ${this.params.payload.chain_id}\n`;
22729
+ }
22730
+
22731
+ fullMessage += `message: ${this.params.payload.message}\n`;
22732
+ fullMessage += `nonce: ${this.params.payload.nonce}`;
22733
+ const res = yield this.device.commands.typedCall('AptosSignMessage', 'AptosMessageSignature', Object.assign({}, this.params));
22734
+ const {
22735
+ address,
22736
+ signature
22737
+ } = res.message;
22738
+ return Promise.resolve({
22739
+ path: serializedPath(this.params.address_n),
22740
+ address,
22741
+ signature,
22742
+ fullMessage
22743
+ });
22744
+ });
22745
+ }
22746
+
22747
+ }
22748
+
22749
+ class AlgoGetAddress extends BaseMethod {
22750
+ constructor() {
22751
+ super(...arguments);
22752
+ this.hasBundle = false;
22753
+ }
22754
+
22755
+ init() {
22756
+ var _a;
22757
+
22758
+ this.checkDeviceId = true;
22759
+ this.allowDeviceMode = [...this.allowDeviceMode];
22760
+ this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
22761
+ const payload = this.hasBundle ? this.payload : {
22762
+ bundle: [this.payload]
22763
+ };
22764
+ validateParams(payload, [{
22765
+ name: 'bundle',
22766
+ type: 'array'
22767
+ }]);
22768
+ this.params = [];
22769
+ payload.bundle.forEach(batch => {
22770
+ var _a;
22771
+
22772
+ const addressN = validatePath(batch.path, 3);
22773
+ validateParams(batch, [{
22774
+ name: 'path',
22775
+ required: true
22776
+ }, {
22777
+ name: 'showOnOneKey',
22778
+ type: 'boolean'
22779
+ }]);
22780
+ const showOnOneKey = (_a = batch.showOnOneKey) !== null && _a !== void 0 ? _a : true;
22781
+ this.params.push({
22782
+ address_n: addressN,
22783
+ show_display: showOnOneKey
22784
+ });
22785
+ });
22786
+ }
22787
+
22788
+ getVersionRange() {
22789
+ return {
22790
+ model_mini: {
22791
+ min: '2.6.0'
22792
+ }
22793
+ };
22794
+ }
22795
+
22796
+ run() {
22797
+ return __awaiter(this, void 0, void 0, function* () {
22798
+ const responses = [];
22799
+
22800
+ for (let i = 0; i < this.params.length; i++) {
22801
+ const param = this.params[i];
22802
+ const res = yield this.device.commands.typedCall('AlgorandGetAddress', 'AlgorandAddress', Object.assign({}, param));
22803
+ const {
22804
+ address
22805
+ } = res.message;
22806
+ responses.push({
22807
+ path: serializedPath(param.address_n),
22808
+ address
22809
+ });
22810
+ }
22811
+
22812
+ return Promise.resolve(this.hasBundle ? responses : responses[0]);
22813
+ });
22814
+ }
22815
+
22816
+ }
22817
+
22818
+ class AlgoSignTransaction extends BaseMethod {
22819
+ constructor() {
22820
+ super(...arguments);
22821
+ this.hasBundle = false;
22822
+ }
22823
+
22824
+ init() {
22825
+ this.checkDeviceId = true;
22826
+ this.allowDeviceMode = [...this.allowDeviceMode];
22827
+ validateParams(this.payload, [{
22828
+ name: 'path',
22829
+ required: true
22830
+ }, {
22831
+ name: 'rawTx',
22832
+ type: 'hexString',
22833
+ required: true
22834
+ }]);
22835
+ const {
22836
+ path,
22837
+ rawTx
22838
+ } = this.payload;
22839
+ const addressN = validatePath(path, 3);
22840
+ this.params = {
22841
+ address_n: addressN,
22842
+ raw_tx: formatAnyHex(rawTx)
22843
+ };
22844
+ }
22845
+
22846
+ getVersionRange() {
22847
+ return {
22848
+ model_mini: {
22849
+ min: '2.6.0'
22850
+ }
22851
+ };
22852
+ }
22853
+
22854
+ run() {
22855
+ return __awaiter(this, void 0, void 0, function* () {
22856
+ const res = yield this.device.commands.typedCall('AlgorandSignTx', 'AlgorandSignedTx', Object.assign({}, this.params));
22857
+ const {
22858
+ signature
22859
+ } = res.message;
22860
+ return {
22861
+ path: serializedPath(this.params.address_n),
22862
+ signature
22863
+ };
22864
+ });
22865
+ }
22866
+
22867
+ }
22868
+
22869
+ class CosmosGetAddress extends BaseMethod {
22870
+ constructor() {
22871
+ super(...arguments);
22872
+ this.hasBundle = false;
22873
+ }
22874
+
22875
+ init() {
22876
+ var _a;
22877
+
22878
+ this.checkDeviceId = true;
22879
+ this.allowDeviceMode = [...this.allowDeviceMode];
22880
+ this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
22881
+ const payload = this.hasBundle ? this.payload : {
22882
+ bundle: [this.payload]
22883
+ };
22884
+ validateParams(payload, [{
22885
+ name: 'bundle',
22886
+ type: 'array'
22887
+ }]);
22888
+ this.params = [];
22889
+ payload.bundle.forEach(batch => {
22890
+ var _a;
22891
+
22892
+ const addressN = validatePath(batch.path, 3);
22893
+ validateParams(batch, [{
22894
+ name: 'path',
22895
+ required: true
22896
+ }, {
22897
+ name: 'showOnOneKey',
22898
+ type: 'boolean'
22899
+ }]);
22900
+ const showOnOneKey = (_a = batch.showOnOneKey) !== null && _a !== void 0 ? _a : true;
22901
+ this.params.push({
22902
+ address_n: addressN,
22903
+ show_display: showOnOneKey
22904
+ });
22905
+ });
22906
+ }
22907
+
22908
+ getVersionRange() {
22909
+ return {
22910
+ model_mini: {
22911
+ min: '2.6.0'
22912
+ }
22913
+ };
22914
+ }
22915
+
22916
+ run() {
22917
+ return __awaiter(this, void 0, void 0, function* () {
22918
+ const responses = [];
22919
+
22920
+ for (let i = 0; i < this.params.length; i++) {
22921
+ const param = this.params[i];
22922
+ const res = yield this.device.commands.typedCall('CosmosGetAddress', 'CosmosAddress', Object.assign({}, param));
22923
+ const {
22924
+ address
22925
+ } = res.message;
22926
+ responses.push({
22927
+ path: serializedPath(param.address_n),
22928
+ address
22929
+ });
22930
+ }
22931
+
22932
+ return Promise.resolve(this.hasBundle ? responses : responses[0]);
22933
+ });
22934
+ }
22935
+
22936
+ }
22937
+
22938
+ class CosmosSignTransaction extends BaseMethod {
22939
+ constructor() {
22940
+ super(...arguments);
22941
+ this.hasBundle = false;
22942
+ }
22943
+
22944
+ init() {
22945
+ this.checkDeviceId = true;
22946
+ this.allowDeviceMode = [...this.allowDeviceMode];
22947
+ validateParams(this.payload, [{
22948
+ name: 'path',
22949
+ required: true
22950
+ }, {
22951
+ name: 'rawTx',
22952
+ type: 'hexString',
22953
+ required: true
22954
+ }]);
22955
+ const {
22956
+ path,
22957
+ rawTx
22958
+ } = this.payload;
22959
+ const addressN = validatePath(path, 3);
22960
+ this.params = {
22961
+ address_n: addressN,
22962
+ raw_tx: formatAnyHex(rawTx)
22963
+ };
22964
+ }
22965
+
22966
+ getVersionRange() {
22967
+ return {
22968
+ model_mini: {
22969
+ min: '2.6.0'
22970
+ }
22971
+ };
22972
+ }
22973
+
22974
+ run() {
22975
+ return __awaiter(this, void 0, void 0, function* () {
22976
+ const res = yield this.device.commands.typedCall('CosmosSignTx', 'CosmosSignedTx', Object.assign({}, this.params));
22977
+ const {
22978
+ signature
22979
+ } = res.message;
22980
+ return {
22981
+ path: serializedPath(this.params.address_n),
22982
+ signature
22983
+ };
22984
+ });
22985
+ }
22986
+
22987
+ }
22988
+
22458
22989
  var ApiMethods = /*#__PURE__*/Object.freeze({
22459
22990
  __proto__: null,
22460
22991
  searchDevices: SearchDevices,
@@ -22515,7 +23046,12 @@ var ApiMethods = /*#__PURE__*/Object.freeze({
22515
23046
  nearSignTransaction: NearSignTransaction,
22516
23047
  aptosGetAddress: AptosGetAddress,
22517
23048
  aptosGetPublicKey: AptosGetPublicKey,
22518
- aptosSignTransaction: AptosSignTransaction
23049
+ aptosSignTransaction: AptosSignTransaction,
23050
+ aptosSignMessage: AptosSignMessage,
23051
+ algoGetAddress: AlgoGetAddress,
23052
+ algoSignTransaction: AlgoSignTransaction,
23053
+ cosmosGetAddress: CosmosGetAddress,
23054
+ cosmosSignTransaction: CosmosSignTransaction
22519
23055
  });
22520
23056
 
22521
23057
  function findMethod(message) {
@@ -22974,6 +23510,26 @@ function initDeviceForBle(method) {
22974
23510
  return device;
22975
23511
  }
22976
23512
 
23513
+ let bleTimeoutRetry = 0;
23514
+
23515
+ function connectDeviceForBle(method, device) {
23516
+ return __awaiter(this, void 0, void 0, function* () {
23517
+ try {
23518
+ yield device.acquire();
23519
+ yield device.initialize(parseInitOptions(method));
23520
+ } catch (err) {
23521
+ if (err.errorCode === hdShared.HardwareErrorCode.BleTimeoutError && bleTimeoutRetry <= 5) {
23522
+ bleTimeoutRetry += 1;
23523
+ Log.debug(`Bletooth connect timeout and will retry, retry count: ${bleTimeoutRetry}`);
23524
+ yield wait(3000);
23525
+ yield connectDeviceForBle(method, device);
23526
+ } else {
23527
+ throw err;
23528
+ }
23529
+ }
23530
+ });
23531
+ }
23532
+
22977
23533
  const ensureConnected = (method, pollingId) => __awaiter(void 0, void 0, void 0, function* () {
22978
23534
  let tryCount = 0;
22979
23535
  const MAX_RETRY_COUNT = method.payload && method.payload.retryCount || 5;
@@ -23032,8 +23588,8 @@ const ensureConnected = (method, pollingId) => __awaiter(void 0, void 0, void 0,
23032
23588
  }
23033
23589
 
23034
23590
  if (env === 'react-native') {
23035
- yield device.acquire();
23036
- yield device.initialize(parseInitOptions(method));
23591
+ bleTimeoutRetry = 0;
23592
+ yield connectDeviceForBle(method, device);
23037
23593
  }
23038
23594
 
23039
23595
  resolve(device);
@@ -23042,7 +23598,7 @@ const ensureConnected = (method, pollingId) => __awaiter(void 0, void 0, void 0,
23042
23598
  } catch (error) {
23043
23599
  Log.debug('device error: ', error);
23044
23600
 
23045
- if ([hdShared.HardwareErrorCode.BlePermissionError, hdShared.HardwareErrorCode.BleLocationError, hdShared.HardwareErrorCode.BleLocationServicesDisabled, hdShared.HardwareErrorCode.BleDeviceNotBonded, hdShared.HardwareErrorCode.BleCharacteristicNotifyError, hdShared.HardwareErrorCode.BleWriteCharacteristicError, hdShared.HardwareErrorCode.BleAlreadyConnected, hdShared.HardwareErrorCode.FirmwareUpdateLimitOneDevice].includes(error.errorCode)) {
23601
+ if ([hdShared.HardwareErrorCode.BlePermissionError, hdShared.HardwareErrorCode.BleLocationError, hdShared.HardwareErrorCode.BleLocationServicesDisabled, hdShared.HardwareErrorCode.BleDeviceNotBonded, hdShared.HardwareErrorCode.BleCharacteristicNotifyError, hdShared.HardwareErrorCode.BleTimeoutError, hdShared.HardwareErrorCode.BleWriteCharacteristicError, hdShared.HardwareErrorCode.BleAlreadyConnected, hdShared.HardwareErrorCode.FirmwareUpdateLimitOneDevice].includes(error.errorCode)) {
23046
23602
  reject(error);
23047
23603
  return;
23048
23604
  }
@@ -24674,6 +25230,7 @@ const HardwareErrorCode = {
24674
25230
  BleWriteCharacteristicError: 710,
24675
25231
  BleAlreadyConnected: 711,
24676
25232
  BleLocationServicesDisabled: 712,
25233
+ BleTimeoutError: 713,
24677
25234
  RuntimeError: 800,
24678
25235
  PinInvalid: 801,
24679
25236
  PinCancelled: 802,
@@ -24738,6 +25295,7 @@ const HardwareErrorCodeMessage = {
24738
25295
  [HardwareErrorCode.BleWriteCharacteristicError]: 'Write Characteristic Error',
24739
25296
  [HardwareErrorCode.BleAlreadyConnected]: 'Already connected to device',
24740
25297
  [HardwareErrorCode.BleLocationServicesDisabled]: 'Location Services disabled',
25298
+ [HardwareErrorCode.BleTimeoutError]: 'The connection has timed out unexpectedly.',
24741
25299
  [HardwareErrorCode.RuntimeError]: 'Runtime error',
24742
25300
  [HardwareErrorCode.PinInvalid]: 'Pin invalid',
24743
25301
  [HardwareErrorCode.PinCancelled]: 'Pin cancelled',
@@ -27888,9 +28446,9 @@ var __WEBPACK_AMD_DEFINE_RESULT__;;(function (globalObject) {
27888
28446
 
27889
28447
 
27890
28448
 
27891
- var base64 = __webpack_require__(5766)
27892
- var ieee754 = __webpack_require__(2333)
27893
- var customInspectSymbol =
28449
+ const base64 = __webpack_require__(5766)
28450
+ const ieee754 = __webpack_require__(2333)
28451
+ const customInspectSymbol =
27894
28452
  (typeof Symbol === 'function' && typeof Symbol['for'] === 'function') // eslint-disable-line dot-notation
27895
28453
  ? Symbol['for']('nodejs.util.inspect.custom') // eslint-disable-line dot-notation
27896
28454
  : null
@@ -27899,7 +28457,7 @@ exports.Buffer = Buffer
27899
28457
  exports.SlowBuffer = SlowBuffer
27900
28458
  exports.INSPECT_MAX_BYTES = 50
27901
28459
 
27902
- var K_MAX_LENGTH = 0x7fffffff
28460
+ const K_MAX_LENGTH = 0x7fffffff
27903
28461
  exports.kMaxLength = K_MAX_LENGTH
27904
28462
 
27905
28463
  /**
@@ -27929,8 +28487,8 @@ if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' &&
27929
28487
  function typedArraySupport () {
27930
28488
  // Can typed array instances can be augmented?
27931
28489
  try {
27932
- var arr = new Uint8Array(1)
27933
- var proto = { foo: function () { return 42 } }
28490
+ const arr = new Uint8Array(1)
28491
+ const proto = { foo: function () { return 42 } }
27934
28492
  Object.setPrototypeOf(proto, Uint8Array.prototype)
27935
28493
  Object.setPrototypeOf(arr, proto)
27936
28494
  return arr.foo() === 42
@@ -27960,7 +28518,7 @@ function createBuffer (length) {
27960
28518
  throw new RangeError('The value "' + length + '" is invalid for option "size"')
27961
28519
  }
27962
28520
  // Return an augmented `Uint8Array` instance
27963
- var buf = new Uint8Array(length)
28521
+ const buf = new Uint8Array(length)
27964
28522
  Object.setPrototypeOf(buf, Buffer.prototype)
27965
28523
  return buf
27966
28524
  }
@@ -28023,19 +28581,17 @@ function from (value, encodingOrOffset, length) {
28023
28581
  )
28024
28582
  }
28025
28583
 
28026
- var valueOf = value.valueOf && value.valueOf()
28584
+ const valueOf = value.valueOf && value.valueOf()
28027
28585
  if (valueOf != null && valueOf !== value) {
28028
28586
  return Buffer.from(valueOf, encodingOrOffset, length)
28029
28587
  }
28030
28588
 
28031
- var b = fromObject(value)
28589
+ const b = fromObject(value)
28032
28590
  if (b) return b
28033
28591
 
28034
28592
  if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null &&
28035
28593
  typeof value[Symbol.toPrimitive] === 'function') {
28036
- return Buffer.from(
28037
- value[Symbol.toPrimitive]('string'), encodingOrOffset, length
28038
- )
28594
+ return Buffer.from(value[Symbol.toPrimitive]('string'), encodingOrOffset, length)
28039
28595
  }
28040
28596
 
28041
28597
  throw new TypeError(
@@ -28120,10 +28676,10 @@ function fromString (string, encoding) {
28120
28676
  throw new TypeError('Unknown encoding: ' + encoding)
28121
28677
  }
28122
28678
 
28123
- var length = byteLength(string, encoding) | 0
28124
- var buf = createBuffer(length)
28679
+ const length = byteLength(string, encoding) | 0
28680
+ let buf = createBuffer(length)
28125
28681
 
28126
- var actual = buf.write(string, encoding)
28682
+ const actual = buf.write(string, encoding)
28127
28683
 
28128
28684
  if (actual !== length) {
28129
28685
  // Writing a hex string, for example, that contains invalid characters will
@@ -28136,9 +28692,9 @@ function fromString (string, encoding) {
28136
28692
  }
28137
28693
 
28138
28694
  function fromArrayLike (array) {
28139
- var length = array.length < 0 ? 0 : checked(array.length) | 0
28140
- var buf = createBuffer(length)
28141
- for (var i = 0; i < length; i += 1) {
28695
+ const length = array.length < 0 ? 0 : checked(array.length) | 0
28696
+ const buf = createBuffer(length)
28697
+ for (let i = 0; i < length; i += 1) {
28142
28698
  buf[i] = array[i] & 255
28143
28699
  }
28144
28700
  return buf
@@ -28146,7 +28702,7 @@ function fromArrayLike (array) {
28146
28702
 
28147
28703
  function fromArrayView (arrayView) {
28148
28704
  if (isInstance(arrayView, Uint8Array)) {
28149
- var copy = new Uint8Array(arrayView)
28705
+ const copy = new Uint8Array(arrayView)
28150
28706
  return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength)
28151
28707
  }
28152
28708
  return fromArrayLike(arrayView)
@@ -28161,7 +28717,7 @@ function fromArrayBuffer (array, byteOffset, length) {
28161
28717
  throw new RangeError('"length" is outside of buffer bounds')
28162
28718
  }
28163
28719
 
28164
- var buf
28720
+ let buf
28165
28721
  if (byteOffset === undefined && length === undefined) {
28166
28722
  buf = new Uint8Array(array)
28167
28723
  } else if (length === undefined) {
@@ -28178,8 +28734,8 @@ function fromArrayBuffer (array, byteOffset, length) {
28178
28734
 
28179
28735
  function fromObject (obj) {
28180
28736
  if (Buffer.isBuffer(obj)) {
28181
- var len = checked(obj.length) | 0
28182
- var buf = createBuffer(len)
28737
+ const len = checked(obj.length) | 0
28738
+ const buf = createBuffer(len)
28183
28739
 
28184
28740
  if (buf.length === 0) {
28185
28741
  return buf
@@ -28234,10 +28790,10 @@ Buffer.compare = function compare (a, b) {
28234
28790
 
28235
28791
  if (a === b) return 0
28236
28792
 
28237
- var x = a.length
28238
- var y = b.length
28793
+ let x = a.length
28794
+ let y = b.length
28239
28795
 
28240
- for (var i = 0, len = Math.min(x, y); i < len; ++i) {
28796
+ for (let i = 0, len = Math.min(x, y); i < len; ++i) {
28241
28797
  if (a[i] !== b[i]) {
28242
28798
  x = a[i]
28243
28799
  y = b[i]
@@ -28278,7 +28834,7 @@ Buffer.concat = function concat (list, length) {
28278
28834
  return Buffer.alloc(0)
28279
28835
  }
28280
28836
 
28281
- var i
28837
+ let i
28282
28838
  if (length === undefined) {
28283
28839
  length = 0
28284
28840
  for (i = 0; i < list.length; ++i) {
@@ -28286,13 +28842,14 @@ Buffer.concat = function concat (list, length) {
28286
28842
  }
28287
28843
  }
28288
28844
 
28289
- var buffer = Buffer.allocUnsafe(length)
28290
- var pos = 0
28845
+ const buffer = Buffer.allocUnsafe(length)
28846
+ let pos = 0
28291
28847
  for (i = 0; i < list.length; ++i) {
28292
- var buf = list[i]
28848
+ let buf = list[i]
28293
28849
  if (isInstance(buf, Uint8Array)) {
28294
28850
  if (pos + buf.length > buffer.length) {
28295
- Buffer.from(buf).copy(buffer, pos)
28851
+ if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf)
28852
+ buf.copy(buffer, pos)
28296
28853
  } else {
28297
28854
  Uint8Array.prototype.set.call(
28298
28855
  buffer,
@@ -28324,12 +28881,12 @@ function byteLength (string, encoding) {
28324
28881
  )
28325
28882
  }
28326
28883
 
28327
- var len = string.length
28328
- var mustMatch = (arguments.length > 2 && arguments[2] === true)
28884
+ const len = string.length
28885
+ const mustMatch = (arguments.length > 2 && arguments[2] === true)
28329
28886
  if (!mustMatch && len === 0) return 0
28330
28887
 
28331
28888
  // Use a for loop to avoid recursion
28332
- var loweredCase = false
28889
+ let loweredCase = false
28333
28890
  for (;;) {
28334
28891
  switch (encoding) {
28335
28892
  case 'ascii':
@@ -28360,7 +28917,7 @@ function byteLength (string, encoding) {
28360
28917
  Buffer.byteLength = byteLength
28361
28918
 
28362
28919
  function slowToString (encoding, start, end) {
28363
- var loweredCase = false
28920
+ let loweredCase = false
28364
28921
 
28365
28922
  // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
28366
28923
  // property of a typed array.
@@ -28438,28 +28995,28 @@ function slowToString (encoding, start, end) {
28438
28995
  Buffer.prototype._isBuffer = true
28439
28996
 
28440
28997
  function swap (b, n, m) {
28441
- var i = b[n]
28998
+ const i = b[n]
28442
28999
  b[n] = b[m]
28443
29000
  b[m] = i
28444
29001
  }
28445
29002
 
28446
29003
  Buffer.prototype.swap16 = function swap16 () {
28447
- var len = this.length
29004
+ const len = this.length
28448
29005
  if (len % 2 !== 0) {
28449
29006
  throw new RangeError('Buffer size must be a multiple of 16-bits')
28450
29007
  }
28451
- for (var i = 0; i < len; i += 2) {
29008
+ for (let i = 0; i < len; i += 2) {
28452
29009
  swap(this, i, i + 1)
28453
29010
  }
28454
29011
  return this
28455
29012
  }
28456
29013
 
28457
29014
  Buffer.prototype.swap32 = function swap32 () {
28458
- var len = this.length
29015
+ const len = this.length
28459
29016
  if (len % 4 !== 0) {
28460
29017
  throw new RangeError('Buffer size must be a multiple of 32-bits')
28461
29018
  }
28462
- for (var i = 0; i < len; i += 4) {
29019
+ for (let i = 0; i < len; i += 4) {
28463
29020
  swap(this, i, i + 3)
28464
29021
  swap(this, i + 1, i + 2)
28465
29022
  }
@@ -28467,11 +29024,11 @@ Buffer.prototype.swap32 = function swap32 () {
28467
29024
  }
28468
29025
 
28469
29026
  Buffer.prototype.swap64 = function swap64 () {
28470
- var len = this.length
29027
+ const len = this.length
28471
29028
  if (len % 8 !== 0) {
28472
29029
  throw new RangeError('Buffer size must be a multiple of 64-bits')
28473
29030
  }
28474
- for (var i = 0; i < len; i += 8) {
29031
+ for (let i = 0; i < len; i += 8) {
28475
29032
  swap(this, i, i + 7)
28476
29033
  swap(this, i + 1, i + 6)
28477
29034
  swap(this, i + 2, i + 5)
@@ -28481,7 +29038,7 @@ Buffer.prototype.swap64 = function swap64 () {
28481
29038
  }
28482
29039
 
28483
29040
  Buffer.prototype.toString = function toString () {
28484
- var length = this.length
29041
+ const length = this.length
28485
29042
  if (length === 0) return ''
28486
29043
  if (arguments.length === 0) return utf8Slice(this, 0, length)
28487
29044
  return slowToString.apply(this, arguments)
@@ -28496,8 +29053,8 @@ Buffer.prototype.equals = function equals (b) {
28496
29053
  }
28497
29054
 
28498
29055
  Buffer.prototype.inspect = function inspect () {
28499
- var str = ''
28500
- var max = exports.INSPECT_MAX_BYTES
29056
+ let str = ''
29057
+ const max = exports.INSPECT_MAX_BYTES
28501
29058
  str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim()
28502
29059
  if (this.length > max) str += ' ... '
28503
29060
  return '<Buffer ' + str + '>'
@@ -28551,14 +29108,14 @@ Buffer.prototype.compare = function compare (target, start, end, thisStart, this
28551
29108
 
28552
29109
  if (this === target) return 0
28553
29110
 
28554
- var x = thisEnd - thisStart
28555
- var y = end - start
28556
- var len = Math.min(x, y)
29111
+ let x = thisEnd - thisStart
29112
+ let y = end - start
29113
+ const len = Math.min(x, y)
28557
29114
 
28558
- var thisCopy = this.slice(thisStart, thisEnd)
28559
- var targetCopy = target.slice(start, end)
29115
+ const thisCopy = this.slice(thisStart, thisEnd)
29116
+ const targetCopy = target.slice(start, end)
28560
29117
 
28561
- for (var i = 0; i < len; ++i) {
29118
+ for (let i = 0; i < len; ++i) {
28562
29119
  if (thisCopy[i] !== targetCopy[i]) {
28563
29120
  x = thisCopy[i]
28564
29121
  y = targetCopy[i]
@@ -28637,9 +29194,9 @@ function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
28637
29194
  }
28638
29195
 
28639
29196
  function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
28640
- var indexSize = 1
28641
- var arrLength = arr.length
28642
- var valLength = val.length
29197
+ let indexSize = 1
29198
+ let arrLength = arr.length
29199
+ let valLength = val.length
28643
29200
 
28644
29201
  if (encoding !== undefined) {
28645
29202
  encoding = String(encoding).toLowerCase()
@@ -28663,9 +29220,9 @@ function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
28663
29220
  }
28664
29221
  }
28665
29222
 
28666
- var i
29223
+ let i
28667
29224
  if (dir) {
28668
- var foundIndex = -1
29225
+ let foundIndex = -1
28669
29226
  for (i = byteOffset; i < arrLength; i++) {
28670
29227
  if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
28671
29228
  if (foundIndex === -1) foundIndex = i
@@ -28678,8 +29235,8 @@ function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
28678
29235
  } else {
28679
29236
  if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
28680
29237
  for (i = byteOffset; i >= 0; i--) {
28681
- var found = true
28682
- for (var j = 0; j < valLength; j++) {
29238
+ let found = true
29239
+ for (let j = 0; j < valLength; j++) {
28683
29240
  if (read(arr, i + j) !== read(val, j)) {
28684
29241
  found = false
28685
29242
  break
@@ -28706,7 +29263,7 @@ Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding)
28706
29263
 
28707
29264
  function hexWrite (buf, string, offset, length) {
28708
29265
  offset = Number(offset) || 0
28709
- var remaining = buf.length - offset
29266
+ const remaining = buf.length - offset
28710
29267
  if (!length) {
28711
29268
  length = remaining
28712
29269
  } else {
@@ -28716,13 +29273,14 @@ function hexWrite (buf, string, offset, length) {
28716
29273
  }
28717
29274
  }
28718
29275
 
28719
- var strLen = string.length
29276
+ const strLen = string.length
28720
29277
 
28721
29278
  if (length > strLen / 2) {
28722
29279
  length = strLen / 2
28723
29280
  }
28724
- for (var i = 0; i < length; ++i) {
28725
- var parsed = parseInt(string.substr(i * 2, 2), 16)
29281
+ let i
29282
+ for (i = 0; i < length; ++i) {
29283
+ const parsed = parseInt(string.substr(i * 2, 2), 16)
28726
29284
  if (numberIsNaN(parsed)) return i
28727
29285
  buf[offset + i] = parsed
28728
29286
  }
@@ -28772,7 +29330,7 @@ Buffer.prototype.write = function write (string, offset, length, encoding) {
28772
29330
  )
28773
29331
  }
28774
29332
 
28775
- var remaining = this.length - offset
29333
+ const remaining = this.length - offset
28776
29334
  if (length === undefined || length > remaining) length = remaining
28777
29335
 
28778
29336
  if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
@@ -28781,7 +29339,7 @@ Buffer.prototype.write = function write (string, offset, length, encoding) {
28781
29339
 
28782
29340
  if (!encoding) encoding = 'utf8'
28783
29341
 
28784
- var loweredCase = false
29342
+ let loweredCase = false
28785
29343
  for (;;) {
28786
29344
  switch (encoding) {
28787
29345
  case 'hex':
@@ -28831,13 +29389,13 @@ function base64Slice (buf, start, end) {
28831
29389
 
28832
29390
  function utf8Slice (buf, start, end) {
28833
29391
  end = Math.min(buf.length, end)
28834
- var res = []
29392
+ const res = []
28835
29393
 
28836
- var i = start
29394
+ let i = start
28837
29395
  while (i < end) {
28838
- var firstByte = buf[i]
28839
- var codePoint = null
28840
- var bytesPerSequence = (firstByte > 0xEF)
29396
+ const firstByte = buf[i]
29397
+ let codePoint = null
29398
+ let bytesPerSequence = (firstByte > 0xEF)
28841
29399
  ? 4
28842
29400
  : (firstByte > 0xDF)
28843
29401
  ? 3
@@ -28846,7 +29404,7 @@ function utf8Slice (buf, start, end) {
28846
29404
  : 1
28847
29405
 
28848
29406
  if (i + bytesPerSequence <= end) {
28849
- var secondByte, thirdByte, fourthByte, tempCodePoint
29407
+ let secondByte, thirdByte, fourthByte, tempCodePoint
28850
29408
 
28851
29409
  switch (bytesPerSequence) {
28852
29410
  case 1:
@@ -28908,17 +29466,17 @@ function utf8Slice (buf, start, end) {
28908
29466
  // Based on http://stackoverflow.com/a/22747272/680742, the browser with
28909
29467
  // the lowest limit is Chrome, with 0x10000 args.
28910
29468
  // We go 1 magnitude less, for safety
28911
- var MAX_ARGUMENTS_LENGTH = 0x1000
29469
+ const MAX_ARGUMENTS_LENGTH = 0x1000
28912
29470
 
28913
29471
  function decodeCodePointsArray (codePoints) {
28914
- var len = codePoints.length
29472
+ const len = codePoints.length
28915
29473
  if (len <= MAX_ARGUMENTS_LENGTH) {
28916
29474
  return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
28917
29475
  }
28918
29476
 
28919
29477
  // Decode in chunks to avoid "call stack size exceeded".
28920
- var res = ''
28921
- var i = 0
29478
+ let res = ''
29479
+ let i = 0
28922
29480
  while (i < len) {
28923
29481
  res += String.fromCharCode.apply(
28924
29482
  String,
@@ -28929,50 +29487,50 @@ function decodeCodePointsArray (codePoints) {
28929
29487
  }
28930
29488
 
28931
29489
  function asciiSlice (buf, start, end) {
28932
- var ret = ''
29490
+ let ret = ''
28933
29491
  end = Math.min(buf.length, end)
28934
29492
 
28935
- for (var i = start; i < end; ++i) {
29493
+ for (let i = start; i < end; ++i) {
28936
29494
  ret += String.fromCharCode(buf[i] & 0x7F)
28937
29495
  }
28938
29496
  return ret
28939
29497
  }
28940
29498
 
28941
29499
  function latin1Slice (buf, start, end) {
28942
- var ret = ''
29500
+ let ret = ''
28943
29501
  end = Math.min(buf.length, end)
28944
29502
 
28945
- for (var i = start; i < end; ++i) {
29503
+ for (let i = start; i < end; ++i) {
28946
29504
  ret += String.fromCharCode(buf[i])
28947
29505
  }
28948
29506
  return ret
28949
29507
  }
28950
29508
 
28951
29509
  function hexSlice (buf, start, end) {
28952
- var len = buf.length
29510
+ const len = buf.length
28953
29511
 
28954
29512
  if (!start || start < 0) start = 0
28955
29513
  if (!end || end < 0 || end > len) end = len
28956
29514
 
28957
- var out = ''
28958
- for (var i = start; i < end; ++i) {
29515
+ let out = ''
29516
+ for (let i = start; i < end; ++i) {
28959
29517
  out += hexSliceLookupTable[buf[i]]
28960
29518
  }
28961
29519
  return out
28962
29520
  }
28963
29521
 
28964
29522
  function utf16leSlice (buf, start, end) {
28965
- var bytes = buf.slice(start, end)
28966
- var res = ''
29523
+ const bytes = buf.slice(start, end)
29524
+ let res = ''
28967
29525
  // If bytes.length is odd, the last 8 bits must be ignored (same as node.js)
28968
- for (var i = 0; i < bytes.length - 1; i += 2) {
29526
+ for (let i = 0; i < bytes.length - 1; i += 2) {
28969
29527
  res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256))
28970
29528
  }
28971
29529
  return res
28972
29530
  }
28973
29531
 
28974
29532
  Buffer.prototype.slice = function slice (start, end) {
28975
- var len = this.length
29533
+ const len = this.length
28976
29534
  start = ~~start
28977
29535
  end = end === undefined ? len : ~~end
28978
29536
 
@@ -28992,7 +29550,7 @@ Buffer.prototype.slice = function slice (start, end) {
28992
29550
 
28993
29551
  if (end < start) end = start
28994
29552
 
28995
- var newBuf = this.subarray(start, end)
29553
+ const newBuf = this.subarray(start, end)
28996
29554
  // Return an augmented `Uint8Array` instance
28997
29555
  Object.setPrototypeOf(newBuf, Buffer.prototype)
28998
29556
 
@@ -29013,9 +29571,9 @@ Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert)
29013
29571
  byteLength = byteLength >>> 0
29014
29572
  if (!noAssert) checkOffset(offset, byteLength, this.length)
29015
29573
 
29016
- var val = this[offset]
29017
- var mul = 1
29018
- var i = 0
29574
+ let val = this[offset]
29575
+ let mul = 1
29576
+ let i = 0
29019
29577
  while (++i < byteLength && (mul *= 0x100)) {
29020
29578
  val += this[offset + i] * mul
29021
29579
  }
@@ -29031,8 +29589,8 @@ Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert)
29031
29589
  checkOffset(offset, byteLength, this.length)
29032
29590
  }
29033
29591
 
29034
- var val = this[offset + --byteLength]
29035
- var mul = 1
29592
+ let val = this[offset + --byteLength]
29593
+ let mul = 1
29036
29594
  while (byteLength > 0 && (mul *= 0x100)) {
29037
29595
  val += this[offset + --byteLength] * mul
29038
29596
  }
@@ -29083,14 +29641,58 @@ Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
29083
29641
  this[offset + 3])
29084
29642
  }
29085
29643
 
29644
+ Buffer.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE (offset) {
29645
+ offset = offset >>> 0
29646
+ validateNumber(offset, 'offset')
29647
+ const first = this[offset]
29648
+ const last = this[offset + 7]
29649
+ if (first === undefined || last === undefined) {
29650
+ boundsError(offset, this.length - 8)
29651
+ }
29652
+
29653
+ const lo = first +
29654
+ this[++offset] * 2 ** 8 +
29655
+ this[++offset] * 2 ** 16 +
29656
+ this[++offset] * 2 ** 24
29657
+
29658
+ const hi = this[++offset] +
29659
+ this[++offset] * 2 ** 8 +
29660
+ this[++offset] * 2 ** 16 +
29661
+ last * 2 ** 24
29662
+
29663
+ return BigInt(lo) + (BigInt(hi) << BigInt(32))
29664
+ })
29665
+
29666
+ Buffer.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE (offset) {
29667
+ offset = offset >>> 0
29668
+ validateNumber(offset, 'offset')
29669
+ const first = this[offset]
29670
+ const last = this[offset + 7]
29671
+ if (first === undefined || last === undefined) {
29672
+ boundsError(offset, this.length - 8)
29673
+ }
29674
+
29675
+ const hi = first * 2 ** 24 +
29676
+ this[++offset] * 2 ** 16 +
29677
+ this[++offset] * 2 ** 8 +
29678
+ this[++offset]
29679
+
29680
+ const lo = this[++offset] * 2 ** 24 +
29681
+ this[++offset] * 2 ** 16 +
29682
+ this[++offset] * 2 ** 8 +
29683
+ last
29684
+
29685
+ return (BigInt(hi) << BigInt(32)) + BigInt(lo)
29686
+ })
29687
+
29086
29688
  Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
29087
29689
  offset = offset >>> 0
29088
29690
  byteLength = byteLength >>> 0
29089
29691
  if (!noAssert) checkOffset(offset, byteLength, this.length)
29090
29692
 
29091
- var val = this[offset]
29092
- var mul = 1
29093
- var i = 0
29693
+ let val = this[offset]
29694
+ let mul = 1
29695
+ let i = 0
29094
29696
  while (++i < byteLength && (mul *= 0x100)) {
29095
29697
  val += this[offset + i] * mul
29096
29698
  }
@@ -29106,9 +29708,9 @@ Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
29106
29708
  byteLength = byteLength >>> 0
29107
29709
  if (!noAssert) checkOffset(offset, byteLength, this.length)
29108
29710
 
29109
- var i = byteLength
29110
- var mul = 1
29111
- var val = this[offset + --i]
29711
+ let i = byteLength
29712
+ let mul = 1
29713
+ let val = this[offset + --i]
29112
29714
  while (i > 0 && (mul *= 0x100)) {
29113
29715
  val += this[offset + --i] * mul
29114
29716
  }
@@ -29129,14 +29731,14 @@ Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
29129
29731
  Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
29130
29732
  offset = offset >>> 0
29131
29733
  if (!noAssert) checkOffset(offset, 2, this.length)
29132
- var val = this[offset] | (this[offset + 1] << 8)
29734
+ const val = this[offset] | (this[offset + 1] << 8)
29133
29735
  return (val & 0x8000) ? val | 0xFFFF0000 : val
29134
29736
  }
29135
29737
 
29136
29738
  Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
29137
29739
  offset = offset >>> 0
29138
29740
  if (!noAssert) checkOffset(offset, 2, this.length)
29139
- var val = this[offset + 1] | (this[offset] << 8)
29741
+ const val = this[offset + 1] | (this[offset] << 8)
29140
29742
  return (val & 0x8000) ? val | 0xFFFF0000 : val
29141
29743
  }
29142
29744
 
@@ -29160,6 +29762,48 @@ Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
29160
29762
  (this[offset + 3])
29161
29763
  }
29162
29764
 
29765
+ Buffer.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE (offset) {
29766
+ offset = offset >>> 0
29767
+ validateNumber(offset, 'offset')
29768
+ const first = this[offset]
29769
+ const last = this[offset + 7]
29770
+ if (first === undefined || last === undefined) {
29771
+ boundsError(offset, this.length - 8)
29772
+ }
29773
+
29774
+ const val = this[offset + 4] +
29775
+ this[offset + 5] * 2 ** 8 +
29776
+ this[offset + 6] * 2 ** 16 +
29777
+ (last << 24) // Overflow
29778
+
29779
+ return (BigInt(val) << BigInt(32)) +
29780
+ BigInt(first +
29781
+ this[++offset] * 2 ** 8 +
29782
+ this[++offset] * 2 ** 16 +
29783
+ this[++offset] * 2 ** 24)
29784
+ })
29785
+
29786
+ Buffer.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE (offset) {
29787
+ offset = offset >>> 0
29788
+ validateNumber(offset, 'offset')
29789
+ const first = this[offset]
29790
+ const last = this[offset + 7]
29791
+ if (first === undefined || last === undefined) {
29792
+ boundsError(offset, this.length - 8)
29793
+ }
29794
+
29795
+ const val = (first << 24) + // Overflow
29796
+ this[++offset] * 2 ** 16 +
29797
+ this[++offset] * 2 ** 8 +
29798
+ this[++offset]
29799
+
29800
+ return (BigInt(val) << BigInt(32)) +
29801
+ BigInt(this[++offset] * 2 ** 24 +
29802
+ this[++offset] * 2 ** 16 +
29803
+ this[++offset] * 2 ** 8 +
29804
+ last)
29805
+ })
29806
+
29163
29807
  Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
29164
29808
  offset = offset >>> 0
29165
29809
  if (!noAssert) checkOffset(offset, 4, this.length)
@@ -29196,12 +29840,12 @@ Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength,
29196
29840
  offset = offset >>> 0
29197
29841
  byteLength = byteLength >>> 0
29198
29842
  if (!noAssert) {
29199
- var maxBytes = Math.pow(2, 8 * byteLength) - 1
29843
+ const maxBytes = Math.pow(2, 8 * byteLength) - 1
29200
29844
  checkInt(this, value, offset, byteLength, maxBytes, 0)
29201
29845
  }
29202
29846
 
29203
- var mul = 1
29204
- var i = 0
29847
+ let mul = 1
29848
+ let i = 0
29205
29849
  this[offset] = value & 0xFF
29206
29850
  while (++i < byteLength && (mul *= 0x100)) {
29207
29851
  this[offset + i] = (value / mul) & 0xFF
@@ -29216,12 +29860,12 @@ Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength,
29216
29860
  offset = offset >>> 0
29217
29861
  byteLength = byteLength >>> 0
29218
29862
  if (!noAssert) {
29219
- var maxBytes = Math.pow(2, 8 * byteLength) - 1
29863
+ const maxBytes = Math.pow(2, 8 * byteLength) - 1
29220
29864
  checkInt(this, value, offset, byteLength, maxBytes, 0)
29221
29865
  }
29222
29866
 
29223
- var i = byteLength - 1
29224
- var mul = 1
29867
+ let i = byteLength - 1
29868
+ let mul = 1
29225
29869
  this[offset + i] = value & 0xFF
29226
29870
  while (--i >= 0 && (mul *= 0x100)) {
29227
29871
  this[offset + i] = (value / mul) & 0xFF
@@ -29283,18 +29927,70 @@ Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert
29283
29927
  return offset + 4
29284
29928
  }
29285
29929
 
29930
+ function wrtBigUInt64LE (buf, value, offset, min, max) {
29931
+ checkIntBI(value, min, max, buf, offset, 7)
29932
+
29933
+ let lo = Number(value & BigInt(0xffffffff))
29934
+ buf[offset++] = lo
29935
+ lo = lo >> 8
29936
+ buf[offset++] = lo
29937
+ lo = lo >> 8
29938
+ buf[offset++] = lo
29939
+ lo = lo >> 8
29940
+ buf[offset++] = lo
29941
+ let hi = Number(value >> BigInt(32) & BigInt(0xffffffff))
29942
+ buf[offset++] = hi
29943
+ hi = hi >> 8
29944
+ buf[offset++] = hi
29945
+ hi = hi >> 8
29946
+ buf[offset++] = hi
29947
+ hi = hi >> 8
29948
+ buf[offset++] = hi
29949
+ return offset
29950
+ }
29951
+
29952
+ function wrtBigUInt64BE (buf, value, offset, min, max) {
29953
+ checkIntBI(value, min, max, buf, offset, 7)
29954
+
29955
+ let lo = Number(value & BigInt(0xffffffff))
29956
+ buf[offset + 7] = lo
29957
+ lo = lo >> 8
29958
+ buf[offset + 6] = lo
29959
+ lo = lo >> 8
29960
+ buf[offset + 5] = lo
29961
+ lo = lo >> 8
29962
+ buf[offset + 4] = lo
29963
+ let hi = Number(value >> BigInt(32) & BigInt(0xffffffff))
29964
+ buf[offset + 3] = hi
29965
+ hi = hi >> 8
29966
+ buf[offset + 2] = hi
29967
+ hi = hi >> 8
29968
+ buf[offset + 1] = hi
29969
+ hi = hi >> 8
29970
+ buf[offset] = hi
29971
+ return offset + 8
29972
+ }
29973
+
29974
+ Buffer.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE (value, offset = 0) {
29975
+ return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))
29976
+ })
29977
+
29978
+ Buffer.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE (value, offset = 0) {
29979
+ return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))
29980
+ })
29981
+
29286
29982
  Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
29287
29983
  value = +value
29288
29984
  offset = offset >>> 0
29289
29985
  if (!noAssert) {
29290
- var limit = Math.pow(2, (8 * byteLength) - 1)
29986
+ const limit = Math.pow(2, (8 * byteLength) - 1)
29291
29987
 
29292
29988
  checkInt(this, value, offset, byteLength, limit - 1, -limit)
29293
29989
  }
29294
29990
 
29295
- var i = 0
29296
- var mul = 1
29297
- var sub = 0
29991
+ let i = 0
29992
+ let mul = 1
29993
+ let sub = 0
29298
29994
  this[offset] = value & 0xFF
29299
29995
  while (++i < byteLength && (mul *= 0x100)) {
29300
29996
  if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
@@ -29310,14 +30006,14 @@ Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, no
29310
30006
  value = +value
29311
30007
  offset = offset >>> 0
29312
30008
  if (!noAssert) {
29313
- var limit = Math.pow(2, (8 * byteLength) - 1)
30009
+ const limit = Math.pow(2, (8 * byteLength) - 1)
29314
30010
 
29315
30011
  checkInt(this, value, offset, byteLength, limit - 1, -limit)
29316
30012
  }
29317
30013
 
29318
- var i = byteLength - 1
29319
- var mul = 1
29320
- var sub = 0
30014
+ let i = byteLength - 1
30015
+ let mul = 1
30016
+ let sub = 0
29321
30017
  this[offset + i] = value & 0xFF
29322
30018
  while (--i >= 0 && (mul *= 0x100)) {
29323
30019
  if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
@@ -29379,6 +30075,14 @@ Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert)
29379
30075
  return offset + 4
29380
30076
  }
29381
30077
 
30078
+ Buffer.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE (value, offset = 0) {
30079
+ return wrtBigUInt64LE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))
30080
+ })
30081
+
30082
+ Buffer.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE (value, offset = 0) {
30083
+ return wrtBigUInt64BE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))
30084
+ })
30085
+
29382
30086
  function checkIEEE754 (buf, value, offset, ext, max, min) {
29383
30087
  if (offset + ext > buf.length) throw new RangeError('Index out of range')
29384
30088
  if (offset < 0) throw new RangeError('Index out of range')
@@ -29446,7 +30150,7 @@ Buffer.prototype.copy = function copy (target, targetStart, start, end) {
29446
30150
  end = target.length - targetStart + start
29447
30151
  }
29448
30152
 
29449
- var len = end - start
30153
+ const len = end - start
29450
30154
 
29451
30155
  if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') {
29452
30156
  // Use built-in when available, missing from IE11
@@ -29484,7 +30188,7 @@ Buffer.prototype.fill = function fill (val, start, end, encoding) {
29484
30188
  throw new TypeError('Unknown encoding: ' + encoding)
29485
30189
  }
29486
30190
  if (val.length === 1) {
29487
- var code = val.charCodeAt(0)
30191
+ const code = val.charCodeAt(0)
29488
30192
  if ((encoding === 'utf8' && code < 128) ||
29489
30193
  encoding === 'latin1') {
29490
30194
  // Fast path: If `val` fits into a single byte, use that numeric value.
@@ -29511,16 +30215,16 @@ Buffer.prototype.fill = function fill (val, start, end, encoding) {
29511
30215
 
29512
30216
  if (!val) val = 0
29513
30217
 
29514
- var i
30218
+ let i
29515
30219
  if (typeof val === 'number') {
29516
30220
  for (i = start; i < end; ++i) {
29517
30221
  this[i] = val
29518
30222
  }
29519
30223
  } else {
29520
- var bytes = Buffer.isBuffer(val)
30224
+ const bytes = Buffer.isBuffer(val)
29521
30225
  ? val
29522
30226
  : Buffer.from(val, encoding)
29523
- var len = bytes.length
30227
+ const len = bytes.length
29524
30228
  if (len === 0) {
29525
30229
  throw new TypeError('The value "' + val +
29526
30230
  '" is invalid for argument "value"')
@@ -29533,10 +30237,143 @@ Buffer.prototype.fill = function fill (val, start, end, encoding) {
29533
30237
  return this
29534
30238
  }
29535
30239
 
30240
+ // CUSTOM ERRORS
30241
+ // =============
30242
+
30243
+ // Simplified versions from Node, changed for Buffer-only usage
30244
+ const errors = {}
30245
+ function E (sym, getMessage, Base) {
30246
+ errors[sym] = class NodeError extends Base {
30247
+ constructor () {
30248
+ super()
30249
+
30250
+ Object.defineProperty(this, 'message', {
30251
+ value: getMessage.apply(this, arguments),
30252
+ writable: true,
30253
+ configurable: true
30254
+ })
30255
+
30256
+ // Add the error code to the name to include it in the stack trace.
30257
+ this.name = `${this.name} [${sym}]`
30258
+ // Access the stack to generate the error message including the error code
30259
+ // from the name.
30260
+ this.stack // eslint-disable-line no-unused-expressions
30261
+ // Reset the name to the actual name.
30262
+ delete this.name
30263
+ }
30264
+
30265
+ get code () {
30266
+ return sym
30267
+ }
30268
+
30269
+ set code (value) {
30270
+ Object.defineProperty(this, 'code', {
30271
+ configurable: true,
30272
+ enumerable: true,
30273
+ value,
30274
+ writable: true
30275
+ })
30276
+ }
30277
+
30278
+ toString () {
30279
+ return `${this.name} [${sym}]: ${this.message}`
30280
+ }
30281
+ }
30282
+ }
30283
+
30284
+ E('ERR_BUFFER_OUT_OF_BOUNDS',
30285
+ function (name) {
30286
+ if (name) {
30287
+ return `${name} is outside of buffer bounds`
30288
+ }
30289
+
30290
+ return 'Attempt to access memory outside buffer bounds'
30291
+ }, RangeError)
30292
+ E('ERR_INVALID_ARG_TYPE',
30293
+ function (name, actual) {
30294
+ return `The "${name}" argument must be of type number. Received type ${typeof actual}`
30295
+ }, TypeError)
30296
+ E('ERR_OUT_OF_RANGE',
30297
+ function (str, range, input) {
30298
+ let msg = `The value of "${str}" is out of range.`
30299
+ let received = input
30300
+ if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) {
30301
+ received = addNumericalSeparator(String(input))
30302
+ } else if (typeof input === 'bigint') {
30303
+ received = String(input)
30304
+ if (input > BigInt(2) ** BigInt(32) || input < -(BigInt(2) ** BigInt(32))) {
30305
+ received = addNumericalSeparator(received)
30306
+ }
30307
+ received += 'n'
30308
+ }
30309
+ msg += ` It must be ${range}. Received ${received}`
30310
+ return msg
30311
+ }, RangeError)
30312
+
30313
+ function addNumericalSeparator (val) {
30314
+ let res = ''
30315
+ let i = val.length
30316
+ const start = val[0] === '-' ? 1 : 0
30317
+ for (; i >= start + 4; i -= 3) {
30318
+ res = `_${val.slice(i - 3, i)}${res}`
30319
+ }
30320
+ return `${val.slice(0, i)}${res}`
30321
+ }
30322
+
30323
+ // CHECK FUNCTIONS
30324
+ // ===============
30325
+
30326
+ function checkBounds (buf, offset, byteLength) {
30327
+ validateNumber(offset, 'offset')
30328
+ if (buf[offset] === undefined || buf[offset + byteLength] === undefined) {
30329
+ boundsError(offset, buf.length - (byteLength + 1))
30330
+ }
30331
+ }
30332
+
30333
+ function checkIntBI (value, min, max, buf, offset, byteLength) {
30334
+ if (value > max || value < min) {
30335
+ const n = typeof min === 'bigint' ? 'n' : ''
30336
+ let range
30337
+ if (byteLength > 3) {
30338
+ if (min === 0 || min === BigInt(0)) {
30339
+ range = `>= 0${n} and < 2${n} ** ${(byteLength + 1) * 8}${n}`
30340
+ } else {
30341
+ range = `>= -(2${n} ** ${(byteLength + 1) * 8 - 1}${n}) and < 2 ** ` +
30342
+ `${(byteLength + 1) * 8 - 1}${n}`
30343
+ }
30344
+ } else {
30345
+ range = `>= ${min}${n} and <= ${max}${n}`
30346
+ }
30347
+ throw new errors.ERR_OUT_OF_RANGE('value', range, value)
30348
+ }
30349
+ checkBounds(buf, offset, byteLength)
30350
+ }
30351
+
30352
+ function validateNumber (value, name) {
30353
+ if (typeof value !== 'number') {
30354
+ throw new errors.ERR_INVALID_ARG_TYPE(name, 'number', value)
30355
+ }
30356
+ }
30357
+
30358
+ function boundsError (value, length, type) {
30359
+ if (Math.floor(value) !== value) {
30360
+ validateNumber(value, type)
30361
+ throw new errors.ERR_OUT_OF_RANGE(type || 'offset', 'an integer', value)
30362
+ }
30363
+
30364
+ if (length < 0) {
30365
+ throw new errors.ERR_BUFFER_OUT_OF_BOUNDS()
30366
+ }
30367
+
30368
+ throw new errors.ERR_OUT_OF_RANGE(type || 'offset',
30369
+ `>= ${type ? 1 : 0} and <= ${length}`,
30370
+ value)
30371
+ }
30372
+
29536
30373
  // HELPER FUNCTIONS
29537
30374
  // ================
29538
30375
 
29539
- var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g
30376
+ const INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g
29540
30377
 
29541
30378
  function base64clean (str) {
29542
30379
  // Node takes equal signs as end of the Base64 encoding
@@ -29554,12 +30391,12 @@ function base64clean (str) {
29554
30391
 
29555
30392
  function utf8ToBytes (string, units) {
29556
30393
  units = units || Infinity
29557
- var codePoint
29558
- var length = string.length
29559
- var leadSurrogate = null
29560
- var bytes = []
30394
+ let codePoint
30395
+ const length = string.length
30396
+ let leadSurrogate = null
30397
+ const bytes = []
29561
30398
 
29562
- for (var i = 0; i < length; ++i) {
30399
+ for (let i = 0; i < length; ++i) {
29563
30400
  codePoint = string.charCodeAt(i)
29564
30401
 
29565
30402
  // is surrogate component
@@ -29633,8 +30470,8 @@ function utf8ToBytes (string, units) {
29633
30470
  }
29634
30471
 
29635
30472
  function asciiToBytes (str) {
29636
- var byteArray = []
29637
- for (var i = 0; i < str.length; ++i) {
30473
+ const byteArray = []
30474
+ for (let i = 0; i < str.length; ++i) {
29638
30475
  // Node's code seems to be doing this and not & 0x7F..
29639
30476
  byteArray.push(str.charCodeAt(i) & 0xFF)
29640
30477
  }
@@ -29642,9 +30479,9 @@ function asciiToBytes (str) {
29642
30479
  }
29643
30480
 
29644
30481
  function utf16leToBytes (str, units) {
29645
- var c, hi, lo
29646
- var byteArray = []
29647
- for (var i = 0; i < str.length; ++i) {
30482
+ let c, hi, lo
30483
+ const byteArray = []
30484
+ for (let i = 0; i < str.length; ++i) {
29648
30485
  if ((units -= 2) < 0) break
29649
30486
 
29650
30487
  c = str.charCodeAt(i)
@@ -29662,7 +30499,8 @@ function base64ToBytes (str) {
29662
30499
  }
29663
30500
 
29664
30501
  function blitBuffer (src, dst, offset, length) {
29665
- for (var i = 0; i < length; ++i) {
30502
+ let i
30503
+ for (i = 0; i < length; ++i) {
29666
30504
  if ((i + offset >= dst.length) || (i >= src.length)) break
29667
30505
  dst[i + offset] = src[i]
29668
30506
  }
@@ -29684,18 +30522,27 @@ function numberIsNaN (obj) {
29684
30522
 
29685
30523
  // Create lookup table for `toString('hex')`
29686
30524
  // See: https://github.com/feross/buffer/issues/219
29687
- var hexSliceLookupTable = (function () {
29688
- var alphabet = '0123456789abcdef'
29689
- var table = new Array(256)
29690
- for (var i = 0; i < 16; ++i) {
29691
- var i16 = i * 16
29692
- for (var j = 0; j < 16; ++j) {
30525
+ const hexSliceLookupTable = (function () {
30526
+ const alphabet = '0123456789abcdef'
30527
+ const table = new Array(256)
30528
+ for (let i = 0; i < 16; ++i) {
30529
+ const i16 = i * 16
30530
+ for (let j = 0; j < 16; ++j) {
29693
30531
  table[i16 + j] = alphabet[i] + alphabet[j]
29694
30532
  }
29695
30533
  }
29696
30534
  return table
29697
30535
  })()
29698
30536
 
30537
+ // Return not function with Error if BigInt not supported
30538
+ function defineBigIntMethod (fn) {
30539
+ return typeof BigInt === 'undefined' ? BufferBigIntNotDefined : fn
30540
+ }
30541
+
30542
+ function BufferBigIntNotDefined () {
30543
+ throw new Error('BigInt not supported')
30544
+ }
30545
+
29699
30546
 
29700
30547
  /***/ }),
29701
30548
 
@@ -46970,7 +47817,7 @@ try {
46970
47817
  /***/ ((module) => {
46971
47818
 
46972
47819
  "use strict";
46973
- module.exports = JSON.parse('{"name":"@onekeyfe/hd-core","version":"0.1.58","description":"> TODO: description","author":"OneKey","homepage":"https://github.com/OneKeyHQ/hardware-js-sdk#readme","license":"ISC","main":"dist/index.js","types":"dist/index.d.ts","repository":{"type":"git","url":"git+https://github.com/OneKeyHQ/hardware-js-sdk.git"},"publishConfig":{"access":"public"},"scripts":{"dev":"rimraf dist && rollup -c ../../build/rollup.config.js -w","build":"rimraf dist && rollup -c ../../build/rollup.config.js","lint":"eslint .","lint:fix":"eslint . --fix"},"bugs":{"url":"https://github.com/OneKeyHQ/hardware-js-sdk/issues"},"dependencies":{"@onekeyfe/hd-shared":"^0.1.58","@onekeyfe/hd-transport":"^0.1.58","axios":"^0.27.2","bignumber.js":"^9.0.2","jszip":"^3.10.1","parse-uri":"^1.0.7","semver":"^7.3.7"},"peerDependencies":{"@noble/hashes":"^1.1.3"},"devDependencies":{"@noble/hashes":"^1.1.3","@types/parse-uri":"^1.0.0","@types/semver":"^7.3.9"}}');
47820
+ module.exports = JSON.parse('{"name":"@onekeyfe/hd-core","version":"0.2.0","description":"> TODO: description","author":"OneKey","homepage":"https://github.com/OneKeyHQ/hardware-js-sdk#readme","license":"ISC","main":"dist/index.js","types":"dist/index.d.ts","repository":{"type":"git","url":"git+https://github.com/OneKeyHQ/hardware-js-sdk.git"},"publishConfig":{"access":"public"},"scripts":{"dev":"rimraf dist && rollup -c ../../build/rollup.config.js -w","build":"rimraf dist && rollup -c ../../build/rollup.config.js","lint":"eslint .","lint:fix":"eslint . --fix"},"bugs":{"url":"https://github.com/OneKeyHQ/hardware-js-sdk/issues"},"dependencies":{"@onekeyfe/hd-shared":"^0.2.0","@onekeyfe/hd-transport":"^0.2.0","axios":"^0.27.2","bignumber.js":"^9.0.2","jszip":"^3.10.1","parse-uri":"^1.0.7","semver":"^7.3.7"},"peerDependencies":{"@noble/hashes":"^1.1.3"},"devDependencies":{"@noble/hashes":"^1.1.3","@types/parse-uri":"^1.0.0","@types/semver":"^7.3.9"}}');
46974
47821
 
46975
47822
  /***/ })
46976
47823
 
@@ -49497,7 +50344,7 @@ const src_init = async settings => {
49497
50344
 
49498
50345
  try {
49499
50346
  await init({ ..._settings,
49500
- version: "0.1.58"
50347
+ version: "0.2.0"
49501
50348
  });
49502
50349
  return true;
49503
50350
  } catch (e) {