@onekeyfe/hd-web-sdk 0.1.52 → 0.1.53

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.
@@ -4035,6 +4035,8 @@ var sha256 = __webpack_require__(1965);
4035
4035
 
4036
4036
  var hdTransport = __webpack_require__(7495);
4037
4037
 
4038
+ var sha3 = __webpack_require__(3669);
4039
+
4038
4040
  function _interopDefaultLegacy(e) {
4039
4041
  return e && typeof e === 'object' && 'default' in e ? e : {
4040
4042
  'default': e
@@ -4049,6 +4051,8 @@ var BigNumber__default = /*#__PURE__*/_interopDefaultLegacy(BigNumber);
4049
4051
 
4050
4052
  var sha256__default = /*#__PURE__*/_interopDefaultLegacy(sha256);
4051
4053
 
4054
+ var sha3__default = /*#__PURE__*/_interopDefaultLegacy(sha3);
4055
+
4052
4056
  const inject = ({
4053
4057
  call,
4054
4058
  cancel,
@@ -5141,6 +5145,12 @@ const getPassphraseState = (features, commands) => __awaiter(void 0, void 0, voi
5141
5145
  return message.address;
5142
5146
  });
5143
5147
 
5148
+ const supportBatchPublicKey = features => {
5149
+ if (!features) return false;
5150
+ const currentVersion = getDeviceFirmwareVersion(features).join('.');
5151
+ return semver__default["default"].gte(currentVersion, '2.6.0');
5152
+ };
5153
+
5144
5154
  var nested = {
5145
5155
  AptosGetAddress: {
5146
5156
  fields: {
@@ -16472,6 +16482,29 @@ const formatAnyHex = value => {
16472
16482
  return value;
16473
16483
  };
16474
16484
 
16485
+ Array.from({
16486
+ length: 256
16487
+ }, (v, i) => i.toString(16).padStart(2, '0'));
16488
+
16489
+ function hexToBytes(hex) {
16490
+ if (typeof hex !== 'string') {
16491
+ throw new TypeError(`hexToBytes: expected string, got ${typeof hex}`);
16492
+ }
16493
+
16494
+ if (hex.length % 2) throw new Error('hexToBytes: received invalid unpadded hex');
16495
+ const array = new Uint8Array(hex.length / 2);
16496
+
16497
+ for (let i = 0; i < array.length; i++) {
16498
+ const j = i * 2;
16499
+ const hexByte = hex.slice(j, j + 2);
16500
+ const byte = Number.parseInt(hexByte, 16);
16501
+ if (Number.isNaN(byte) || byte < 0) throw new Error('Invalid byte sequence');
16502
+ array[i] = byte;
16503
+ }
16504
+
16505
+ return array;
16506
+ }
16507
+
16475
16508
  const invalidParameter = message => hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.CallMethodInvalidParameter, message);
16476
16509
 
16477
16510
  const validateParams = (values, fields) => {
@@ -20660,6 +20693,10 @@ class NearSignTransaction extends BaseMethod {
20660
20693
 
20661
20694
  }
20662
20695
 
20696
+ const {
20697
+ sha3_256: sha3Hash
20698
+ } = sha3__default["default"];
20699
+
20663
20700
  class AptosGetAddress extends BaseMethod {
20664
20701
  constructor() {
20665
20702
  super(...arguments);
@@ -20699,8 +20736,30 @@ class AptosGetAddress extends BaseMethod {
20699
20736
  });
20700
20737
  }
20701
20738
 
20739
+ publicKeyToAddress(publicKey) {
20740
+ const hash = sha3Hash.create();
20741
+ hash.update(hexToBytes(publicKey));
20742
+ hash.update("\x00");
20743
+ return hash.hex();
20744
+ }
20745
+
20702
20746
  run() {
20747
+ var _a;
20748
+
20703
20749
  return __awaiter(this, void 0, void 0, function* () {
20750
+ if (this.hasBundle && supportBatchPublicKey((_a = this.device) === null || _a === void 0 ? void 0 : _a.features)) {
20751
+ const res = yield this.device.commands.typedCall('BatchGetPublickeys', 'EcdsaPublicKeys', {
20752
+ paths: this.params,
20753
+ ecdsa_curve_name: 'ed25519'
20754
+ });
20755
+ const result = res.message.public_keys.map((publicKey, index) => ({
20756
+ path: serializedPath(this.params[index].address_n),
20757
+ publicKey,
20758
+ address: this.publicKeyToAddress(publicKey)
20759
+ }));
20760
+ return Promise.resolve(result);
20761
+ }
20762
+
20704
20763
  const responses = [];
20705
20764
 
20706
20765
  for (let i = 0; i < this.params.length; i++) {
@@ -34300,6 +34359,670 @@ var __WEBPACK_AMD_DEFINE_RESULT__;/**
34300
34359
  })();
34301
34360
 
34302
34361
 
34362
+ /***/ }),
34363
+
34364
+ /***/ 3669:
34365
+ /***/ ((module, exports, __webpack_require__) => {
34366
+
34367
+ var __WEBPACK_AMD_DEFINE_RESULT__;/**
34368
+ * [js-sha3]{@link https://github.com/emn178/js-sha3}
34369
+ *
34370
+ * @version 0.8.0
34371
+ * @author Chen, Yi-Cyuan [emn178@gmail.com]
34372
+ * @copyright Chen, Yi-Cyuan 2015-2018
34373
+ * @license MIT
34374
+ */
34375
+ /*jslint bitwise: true */
34376
+ (function () {
34377
+ 'use strict';
34378
+
34379
+ var INPUT_ERROR = 'input is invalid type';
34380
+ var FINALIZE_ERROR = 'finalize already called';
34381
+ var WINDOW = typeof window === 'object';
34382
+ var root = WINDOW ? window : {};
34383
+ if (root.JS_SHA3_NO_WINDOW) {
34384
+ WINDOW = false;
34385
+ }
34386
+ var WEB_WORKER = !WINDOW && typeof self === 'object';
34387
+ var NODE_JS = !root.JS_SHA3_NO_NODE_JS && typeof process === 'object' && process.versions && process.versions.node;
34388
+ if (NODE_JS) {
34389
+ root = __webpack_require__.g;
34390
+ } else if (WEB_WORKER) {
34391
+ root = self;
34392
+ }
34393
+ var COMMON_JS = !root.JS_SHA3_NO_COMMON_JS && "object" === 'object' && module.exports;
34394
+ var AMD = true && __webpack_require__.amdO;
34395
+ var ARRAY_BUFFER = !root.JS_SHA3_NO_ARRAY_BUFFER && typeof ArrayBuffer !== 'undefined';
34396
+ var HEX_CHARS = '0123456789abcdef'.split('');
34397
+ var SHAKE_PADDING = [31, 7936, 2031616, 520093696];
34398
+ var CSHAKE_PADDING = [4, 1024, 262144, 67108864];
34399
+ var KECCAK_PADDING = [1, 256, 65536, 16777216];
34400
+ var PADDING = [6, 1536, 393216, 100663296];
34401
+ var SHIFT = [0, 8, 16, 24];
34402
+ var RC = [1, 0, 32898, 0, 32906, 2147483648, 2147516416, 2147483648, 32907, 0, 2147483649,
34403
+ 0, 2147516545, 2147483648, 32777, 2147483648, 138, 0, 136, 0, 2147516425, 0,
34404
+ 2147483658, 0, 2147516555, 0, 139, 2147483648, 32905, 2147483648, 32771,
34405
+ 2147483648, 32770, 2147483648, 128, 2147483648, 32778, 0, 2147483658, 2147483648,
34406
+ 2147516545, 2147483648, 32896, 2147483648, 2147483649, 0, 2147516424, 2147483648];
34407
+ var BITS = [224, 256, 384, 512];
34408
+ var SHAKE_BITS = [128, 256];
34409
+ var OUTPUT_TYPES = ['hex', 'buffer', 'arrayBuffer', 'array', 'digest'];
34410
+ var CSHAKE_BYTEPAD = {
34411
+ '128': 168,
34412
+ '256': 136
34413
+ };
34414
+
34415
+ if (root.JS_SHA3_NO_NODE_JS || !Array.isArray) {
34416
+ Array.isArray = function (obj) {
34417
+ return Object.prototype.toString.call(obj) === '[object Array]';
34418
+ };
34419
+ }
34420
+
34421
+ if (ARRAY_BUFFER && (root.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW || !ArrayBuffer.isView)) {
34422
+ ArrayBuffer.isView = function (obj) {
34423
+ return typeof obj === 'object' && obj.buffer && obj.buffer.constructor === ArrayBuffer;
34424
+ };
34425
+ }
34426
+
34427
+ var createOutputMethod = function (bits, padding, outputType) {
34428
+ return function (message) {
34429
+ return new Keccak(bits, padding, bits).update(message)[outputType]();
34430
+ };
34431
+ };
34432
+
34433
+ var createShakeOutputMethod = function (bits, padding, outputType) {
34434
+ return function (message, outputBits) {
34435
+ return new Keccak(bits, padding, outputBits).update(message)[outputType]();
34436
+ };
34437
+ };
34438
+
34439
+ var createCshakeOutputMethod = function (bits, padding, outputType) {
34440
+ return function (message, outputBits, n, s) {
34441
+ return methods['cshake' + bits].update(message, outputBits, n, s)[outputType]();
34442
+ };
34443
+ };
34444
+
34445
+ var createKmacOutputMethod = function (bits, padding, outputType) {
34446
+ return function (key, message, outputBits, s) {
34447
+ return methods['kmac' + bits].update(key, message, outputBits, s)[outputType]();
34448
+ };
34449
+ };
34450
+
34451
+ var createOutputMethods = function (method, createMethod, bits, padding) {
34452
+ for (var i = 0; i < OUTPUT_TYPES.length; ++i) {
34453
+ var type = OUTPUT_TYPES[i];
34454
+ method[type] = createMethod(bits, padding, type);
34455
+ }
34456
+ return method;
34457
+ };
34458
+
34459
+ var createMethod = function (bits, padding) {
34460
+ var method = createOutputMethod(bits, padding, 'hex');
34461
+ method.create = function () {
34462
+ return new Keccak(bits, padding, bits);
34463
+ };
34464
+ method.update = function (message) {
34465
+ return method.create().update(message);
34466
+ };
34467
+ return createOutputMethods(method, createOutputMethod, bits, padding);
34468
+ };
34469
+
34470
+ var createShakeMethod = function (bits, padding) {
34471
+ var method = createShakeOutputMethod(bits, padding, 'hex');
34472
+ method.create = function (outputBits) {
34473
+ return new Keccak(bits, padding, outputBits);
34474
+ };
34475
+ method.update = function (message, outputBits) {
34476
+ return method.create(outputBits).update(message);
34477
+ };
34478
+ return createOutputMethods(method, createShakeOutputMethod, bits, padding);
34479
+ };
34480
+
34481
+ var createCshakeMethod = function (bits, padding) {
34482
+ var w = CSHAKE_BYTEPAD[bits];
34483
+ var method = createCshakeOutputMethod(bits, padding, 'hex');
34484
+ method.create = function (outputBits, n, s) {
34485
+ if (!n && !s) {
34486
+ return methods['shake' + bits].create(outputBits);
34487
+ } else {
34488
+ return new Keccak(bits, padding, outputBits).bytepad([n, s], w);
34489
+ }
34490
+ };
34491
+ method.update = function (message, outputBits, n, s) {
34492
+ return method.create(outputBits, n, s).update(message);
34493
+ };
34494
+ return createOutputMethods(method, createCshakeOutputMethod, bits, padding);
34495
+ };
34496
+
34497
+ var createKmacMethod = function (bits, padding) {
34498
+ var w = CSHAKE_BYTEPAD[bits];
34499
+ var method = createKmacOutputMethod(bits, padding, 'hex');
34500
+ method.create = function (key, outputBits, s) {
34501
+ return new Kmac(bits, padding, outputBits).bytepad(['KMAC', s], w).bytepad([key], w);
34502
+ };
34503
+ method.update = function (key, message, outputBits, s) {
34504
+ return method.create(key, outputBits, s).update(message);
34505
+ };
34506
+ return createOutputMethods(method, createKmacOutputMethod, bits, padding);
34507
+ };
34508
+
34509
+ var algorithms = [
34510
+ { name: 'keccak', padding: KECCAK_PADDING, bits: BITS, createMethod: createMethod },
34511
+ { name: 'sha3', padding: PADDING, bits: BITS, createMethod: createMethod },
34512
+ { name: 'shake', padding: SHAKE_PADDING, bits: SHAKE_BITS, createMethod: createShakeMethod },
34513
+ { name: 'cshake', padding: CSHAKE_PADDING, bits: SHAKE_BITS, createMethod: createCshakeMethod },
34514
+ { name: 'kmac', padding: CSHAKE_PADDING, bits: SHAKE_BITS, createMethod: createKmacMethod }
34515
+ ];
34516
+
34517
+ var methods = {}, methodNames = [];
34518
+
34519
+ for (var i = 0; i < algorithms.length; ++i) {
34520
+ var algorithm = algorithms[i];
34521
+ var bits = algorithm.bits;
34522
+ for (var j = 0; j < bits.length; ++j) {
34523
+ var methodName = algorithm.name + '_' + bits[j];
34524
+ methodNames.push(methodName);
34525
+ methods[methodName] = algorithm.createMethod(bits[j], algorithm.padding);
34526
+ if (algorithm.name !== 'sha3') {
34527
+ var newMethodName = algorithm.name + bits[j];
34528
+ methodNames.push(newMethodName);
34529
+ methods[newMethodName] = methods[methodName];
34530
+ }
34531
+ }
34532
+ }
34533
+
34534
+ function Keccak(bits, padding, outputBits) {
34535
+ this.blocks = [];
34536
+ this.s = [];
34537
+ this.padding = padding;
34538
+ this.outputBits = outputBits;
34539
+ this.reset = true;
34540
+ this.finalized = false;
34541
+ this.block = 0;
34542
+ this.start = 0;
34543
+ this.blockCount = (1600 - (bits << 1)) >> 5;
34544
+ this.byteCount = this.blockCount << 2;
34545
+ this.outputBlocks = outputBits >> 5;
34546
+ this.extraBytes = (outputBits & 31) >> 3;
34547
+
34548
+ for (var i = 0; i < 50; ++i) {
34549
+ this.s[i] = 0;
34550
+ }
34551
+ }
34552
+
34553
+ Keccak.prototype.update = function (message) {
34554
+ if (this.finalized) {
34555
+ throw new Error(FINALIZE_ERROR);
34556
+ }
34557
+ var notString, type = typeof message;
34558
+ if (type !== 'string') {
34559
+ if (type === 'object') {
34560
+ if (message === null) {
34561
+ throw new Error(INPUT_ERROR);
34562
+ } else if (ARRAY_BUFFER && message.constructor === ArrayBuffer) {
34563
+ message = new Uint8Array(message);
34564
+ } else if (!Array.isArray(message)) {
34565
+ if (!ARRAY_BUFFER || !ArrayBuffer.isView(message)) {
34566
+ throw new Error(INPUT_ERROR);
34567
+ }
34568
+ }
34569
+ } else {
34570
+ throw new Error(INPUT_ERROR);
34571
+ }
34572
+ notString = true;
34573
+ }
34574
+ var blocks = this.blocks, byteCount = this.byteCount, length = message.length,
34575
+ blockCount = this.blockCount, index = 0, s = this.s, i, code;
34576
+
34577
+ while (index < length) {
34578
+ if (this.reset) {
34579
+ this.reset = false;
34580
+ blocks[0] = this.block;
34581
+ for (i = 1; i < blockCount + 1; ++i) {
34582
+ blocks[i] = 0;
34583
+ }
34584
+ }
34585
+ if (notString) {
34586
+ for (i = this.start; index < length && i < byteCount; ++index) {
34587
+ blocks[i >> 2] |= message[index] << SHIFT[i++ & 3];
34588
+ }
34589
+ } else {
34590
+ for (i = this.start; index < length && i < byteCount; ++index) {
34591
+ code = message.charCodeAt(index);
34592
+ if (code < 0x80) {
34593
+ blocks[i >> 2] |= code << SHIFT[i++ & 3];
34594
+ } else if (code < 0x800) {
34595
+ blocks[i >> 2] |= (0xc0 | (code >> 6)) << SHIFT[i++ & 3];
34596
+ blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];
34597
+ } else if (code < 0xd800 || code >= 0xe000) {
34598
+ blocks[i >> 2] |= (0xe0 | (code >> 12)) << SHIFT[i++ & 3];
34599
+ blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3];
34600
+ blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];
34601
+ } else {
34602
+ code = 0x10000 + (((code & 0x3ff) << 10) | (message.charCodeAt(++index) & 0x3ff));
34603
+ blocks[i >> 2] |= (0xf0 | (code >> 18)) << SHIFT[i++ & 3];
34604
+ blocks[i >> 2] |= (0x80 | ((code >> 12) & 0x3f)) << SHIFT[i++ & 3];
34605
+ blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3];
34606
+ blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];
34607
+ }
34608
+ }
34609
+ }
34610
+ this.lastByteIndex = i;
34611
+ if (i >= byteCount) {
34612
+ this.start = i - byteCount;
34613
+ this.block = blocks[blockCount];
34614
+ for (i = 0; i < blockCount; ++i) {
34615
+ s[i] ^= blocks[i];
34616
+ }
34617
+ f(s);
34618
+ this.reset = true;
34619
+ } else {
34620
+ this.start = i;
34621
+ }
34622
+ }
34623
+ return this;
34624
+ };
34625
+
34626
+ Keccak.prototype.encode = function (x, right) {
34627
+ var o = x & 255, n = 1;
34628
+ var bytes = [o];
34629
+ x = x >> 8;
34630
+ o = x & 255;
34631
+ while (o > 0) {
34632
+ bytes.unshift(o);
34633
+ x = x >> 8;
34634
+ o = x & 255;
34635
+ ++n;
34636
+ }
34637
+ if (right) {
34638
+ bytes.push(n);
34639
+ } else {
34640
+ bytes.unshift(n);
34641
+ }
34642
+ this.update(bytes);
34643
+ return bytes.length;
34644
+ };
34645
+
34646
+ Keccak.prototype.encodeString = function (str) {
34647
+ var notString, type = typeof str;
34648
+ if (type !== 'string') {
34649
+ if (type === 'object') {
34650
+ if (str === null) {
34651
+ throw new Error(INPUT_ERROR);
34652
+ } else if (ARRAY_BUFFER && str.constructor === ArrayBuffer) {
34653
+ str = new Uint8Array(str);
34654
+ } else if (!Array.isArray(str)) {
34655
+ if (!ARRAY_BUFFER || !ArrayBuffer.isView(str)) {
34656
+ throw new Error(INPUT_ERROR);
34657
+ }
34658
+ }
34659
+ } else {
34660
+ throw new Error(INPUT_ERROR);
34661
+ }
34662
+ notString = true;
34663
+ }
34664
+ var bytes = 0, length = str.length;
34665
+ if (notString) {
34666
+ bytes = length;
34667
+ } else {
34668
+ for (var i = 0; i < str.length; ++i) {
34669
+ var code = str.charCodeAt(i);
34670
+ if (code < 0x80) {
34671
+ bytes += 1;
34672
+ } else if (code < 0x800) {
34673
+ bytes += 2;
34674
+ } else if (code < 0xd800 || code >= 0xe000) {
34675
+ bytes += 3;
34676
+ } else {
34677
+ code = 0x10000 + (((code & 0x3ff) << 10) | (str.charCodeAt(++i) & 0x3ff));
34678
+ bytes += 4;
34679
+ }
34680
+ }
34681
+ }
34682
+ bytes += this.encode(bytes * 8);
34683
+ this.update(str);
34684
+ return bytes;
34685
+ };
34686
+
34687
+ Keccak.prototype.bytepad = function (strs, w) {
34688
+ var bytes = this.encode(w);
34689
+ for (var i = 0; i < strs.length; ++i) {
34690
+ bytes += this.encodeString(strs[i]);
34691
+ }
34692
+ var paddingBytes = w - bytes % w;
34693
+ var zeros = [];
34694
+ zeros.length = paddingBytes;
34695
+ this.update(zeros);
34696
+ return this;
34697
+ };
34698
+
34699
+ Keccak.prototype.finalize = function () {
34700
+ if (this.finalized) {
34701
+ return;
34702
+ }
34703
+ this.finalized = true;
34704
+ var blocks = this.blocks, i = this.lastByteIndex, blockCount = this.blockCount, s = this.s;
34705
+ blocks[i >> 2] |= this.padding[i & 3];
34706
+ if (this.lastByteIndex === this.byteCount) {
34707
+ blocks[0] = blocks[blockCount];
34708
+ for (i = 1; i < blockCount + 1; ++i) {
34709
+ blocks[i] = 0;
34710
+ }
34711
+ }
34712
+ blocks[blockCount - 1] |= 0x80000000;
34713
+ for (i = 0; i < blockCount; ++i) {
34714
+ s[i] ^= blocks[i];
34715
+ }
34716
+ f(s);
34717
+ };
34718
+
34719
+ Keccak.prototype.toString = Keccak.prototype.hex = function () {
34720
+ this.finalize();
34721
+
34722
+ var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks,
34723
+ extraBytes = this.extraBytes, i = 0, j = 0;
34724
+ var hex = '', block;
34725
+ while (j < outputBlocks) {
34726
+ for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) {
34727
+ block = s[i];
34728
+ hex += HEX_CHARS[(block >> 4) & 0x0F] + HEX_CHARS[block & 0x0F] +
34729
+ HEX_CHARS[(block >> 12) & 0x0F] + HEX_CHARS[(block >> 8) & 0x0F] +
34730
+ HEX_CHARS[(block >> 20) & 0x0F] + HEX_CHARS[(block >> 16) & 0x0F] +
34731
+ HEX_CHARS[(block >> 28) & 0x0F] + HEX_CHARS[(block >> 24) & 0x0F];
34732
+ }
34733
+ if (j % blockCount === 0) {
34734
+ f(s);
34735
+ i = 0;
34736
+ }
34737
+ }
34738
+ if (extraBytes) {
34739
+ block = s[i];
34740
+ hex += HEX_CHARS[(block >> 4) & 0x0F] + HEX_CHARS[block & 0x0F];
34741
+ if (extraBytes > 1) {
34742
+ hex += HEX_CHARS[(block >> 12) & 0x0F] + HEX_CHARS[(block >> 8) & 0x0F];
34743
+ }
34744
+ if (extraBytes > 2) {
34745
+ hex += HEX_CHARS[(block >> 20) & 0x0F] + HEX_CHARS[(block >> 16) & 0x0F];
34746
+ }
34747
+ }
34748
+ return hex;
34749
+ };
34750
+
34751
+ Keccak.prototype.arrayBuffer = function () {
34752
+ this.finalize();
34753
+
34754
+ var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks,
34755
+ extraBytes = this.extraBytes, i = 0, j = 0;
34756
+ var bytes = this.outputBits >> 3;
34757
+ var buffer;
34758
+ if (extraBytes) {
34759
+ buffer = new ArrayBuffer((outputBlocks + 1) << 2);
34760
+ } else {
34761
+ buffer = new ArrayBuffer(bytes);
34762
+ }
34763
+ var array = new Uint32Array(buffer);
34764
+ while (j < outputBlocks) {
34765
+ for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) {
34766
+ array[j] = s[i];
34767
+ }
34768
+ if (j % blockCount === 0) {
34769
+ f(s);
34770
+ }
34771
+ }
34772
+ if (extraBytes) {
34773
+ array[i] = s[i];
34774
+ buffer = buffer.slice(0, bytes);
34775
+ }
34776
+ return buffer;
34777
+ };
34778
+
34779
+ Keccak.prototype.buffer = Keccak.prototype.arrayBuffer;
34780
+
34781
+ Keccak.prototype.digest = Keccak.prototype.array = function () {
34782
+ this.finalize();
34783
+
34784
+ var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks,
34785
+ extraBytes = this.extraBytes, i = 0, j = 0;
34786
+ var array = [], offset, block;
34787
+ while (j < outputBlocks) {
34788
+ for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) {
34789
+ offset = j << 2;
34790
+ block = s[i];
34791
+ array[offset] = block & 0xFF;
34792
+ array[offset + 1] = (block >> 8) & 0xFF;
34793
+ array[offset + 2] = (block >> 16) & 0xFF;
34794
+ array[offset + 3] = (block >> 24) & 0xFF;
34795
+ }
34796
+ if (j % blockCount === 0) {
34797
+ f(s);
34798
+ }
34799
+ }
34800
+ if (extraBytes) {
34801
+ offset = j << 2;
34802
+ block = s[i];
34803
+ array[offset] = block & 0xFF;
34804
+ if (extraBytes > 1) {
34805
+ array[offset + 1] = (block >> 8) & 0xFF;
34806
+ }
34807
+ if (extraBytes > 2) {
34808
+ array[offset + 2] = (block >> 16) & 0xFF;
34809
+ }
34810
+ }
34811
+ return array;
34812
+ };
34813
+
34814
+ function Kmac(bits, padding, outputBits) {
34815
+ Keccak.call(this, bits, padding, outputBits);
34816
+ }
34817
+
34818
+ Kmac.prototype = new Keccak();
34819
+
34820
+ Kmac.prototype.finalize = function () {
34821
+ this.encode(this.outputBits, true);
34822
+ return Keccak.prototype.finalize.call(this);
34823
+ };
34824
+
34825
+ var f = function (s) {
34826
+ var h, l, n, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9,
34827
+ b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16, b17,
34828
+ b18, b19, b20, b21, b22, b23, b24, b25, b26, b27, b28, b29, b30, b31, b32, b33,
34829
+ b34, b35, b36, b37, b38, b39, b40, b41, b42, b43, b44, b45, b46, b47, b48, b49;
34830
+ for (n = 0; n < 48; n += 2) {
34831
+ c0 = s[0] ^ s[10] ^ s[20] ^ s[30] ^ s[40];
34832
+ c1 = s[1] ^ s[11] ^ s[21] ^ s[31] ^ s[41];
34833
+ c2 = s[2] ^ s[12] ^ s[22] ^ s[32] ^ s[42];
34834
+ c3 = s[3] ^ s[13] ^ s[23] ^ s[33] ^ s[43];
34835
+ c4 = s[4] ^ s[14] ^ s[24] ^ s[34] ^ s[44];
34836
+ c5 = s[5] ^ s[15] ^ s[25] ^ s[35] ^ s[45];
34837
+ c6 = s[6] ^ s[16] ^ s[26] ^ s[36] ^ s[46];
34838
+ c7 = s[7] ^ s[17] ^ s[27] ^ s[37] ^ s[47];
34839
+ c8 = s[8] ^ s[18] ^ s[28] ^ s[38] ^ s[48];
34840
+ c9 = s[9] ^ s[19] ^ s[29] ^ s[39] ^ s[49];
34841
+
34842
+ h = c8 ^ ((c2 << 1) | (c3 >>> 31));
34843
+ l = c9 ^ ((c3 << 1) | (c2 >>> 31));
34844
+ s[0] ^= h;
34845
+ s[1] ^= l;
34846
+ s[10] ^= h;
34847
+ s[11] ^= l;
34848
+ s[20] ^= h;
34849
+ s[21] ^= l;
34850
+ s[30] ^= h;
34851
+ s[31] ^= l;
34852
+ s[40] ^= h;
34853
+ s[41] ^= l;
34854
+ h = c0 ^ ((c4 << 1) | (c5 >>> 31));
34855
+ l = c1 ^ ((c5 << 1) | (c4 >>> 31));
34856
+ s[2] ^= h;
34857
+ s[3] ^= l;
34858
+ s[12] ^= h;
34859
+ s[13] ^= l;
34860
+ s[22] ^= h;
34861
+ s[23] ^= l;
34862
+ s[32] ^= h;
34863
+ s[33] ^= l;
34864
+ s[42] ^= h;
34865
+ s[43] ^= l;
34866
+ h = c2 ^ ((c6 << 1) | (c7 >>> 31));
34867
+ l = c3 ^ ((c7 << 1) | (c6 >>> 31));
34868
+ s[4] ^= h;
34869
+ s[5] ^= l;
34870
+ s[14] ^= h;
34871
+ s[15] ^= l;
34872
+ s[24] ^= h;
34873
+ s[25] ^= l;
34874
+ s[34] ^= h;
34875
+ s[35] ^= l;
34876
+ s[44] ^= h;
34877
+ s[45] ^= l;
34878
+ h = c4 ^ ((c8 << 1) | (c9 >>> 31));
34879
+ l = c5 ^ ((c9 << 1) | (c8 >>> 31));
34880
+ s[6] ^= h;
34881
+ s[7] ^= l;
34882
+ s[16] ^= h;
34883
+ s[17] ^= l;
34884
+ s[26] ^= h;
34885
+ s[27] ^= l;
34886
+ s[36] ^= h;
34887
+ s[37] ^= l;
34888
+ s[46] ^= h;
34889
+ s[47] ^= l;
34890
+ h = c6 ^ ((c0 << 1) | (c1 >>> 31));
34891
+ l = c7 ^ ((c1 << 1) | (c0 >>> 31));
34892
+ s[8] ^= h;
34893
+ s[9] ^= l;
34894
+ s[18] ^= h;
34895
+ s[19] ^= l;
34896
+ s[28] ^= h;
34897
+ s[29] ^= l;
34898
+ s[38] ^= h;
34899
+ s[39] ^= l;
34900
+ s[48] ^= h;
34901
+ s[49] ^= l;
34902
+
34903
+ b0 = s[0];
34904
+ b1 = s[1];
34905
+ b32 = (s[11] << 4) | (s[10] >>> 28);
34906
+ b33 = (s[10] << 4) | (s[11] >>> 28);
34907
+ b14 = (s[20] << 3) | (s[21] >>> 29);
34908
+ b15 = (s[21] << 3) | (s[20] >>> 29);
34909
+ b46 = (s[31] << 9) | (s[30] >>> 23);
34910
+ b47 = (s[30] << 9) | (s[31] >>> 23);
34911
+ b28 = (s[40] << 18) | (s[41] >>> 14);
34912
+ b29 = (s[41] << 18) | (s[40] >>> 14);
34913
+ b20 = (s[2] << 1) | (s[3] >>> 31);
34914
+ b21 = (s[3] << 1) | (s[2] >>> 31);
34915
+ b2 = (s[13] << 12) | (s[12] >>> 20);
34916
+ b3 = (s[12] << 12) | (s[13] >>> 20);
34917
+ b34 = (s[22] << 10) | (s[23] >>> 22);
34918
+ b35 = (s[23] << 10) | (s[22] >>> 22);
34919
+ b16 = (s[33] << 13) | (s[32] >>> 19);
34920
+ b17 = (s[32] << 13) | (s[33] >>> 19);
34921
+ b48 = (s[42] << 2) | (s[43] >>> 30);
34922
+ b49 = (s[43] << 2) | (s[42] >>> 30);
34923
+ b40 = (s[5] << 30) | (s[4] >>> 2);
34924
+ b41 = (s[4] << 30) | (s[5] >>> 2);
34925
+ b22 = (s[14] << 6) | (s[15] >>> 26);
34926
+ b23 = (s[15] << 6) | (s[14] >>> 26);
34927
+ b4 = (s[25] << 11) | (s[24] >>> 21);
34928
+ b5 = (s[24] << 11) | (s[25] >>> 21);
34929
+ b36 = (s[34] << 15) | (s[35] >>> 17);
34930
+ b37 = (s[35] << 15) | (s[34] >>> 17);
34931
+ b18 = (s[45] << 29) | (s[44] >>> 3);
34932
+ b19 = (s[44] << 29) | (s[45] >>> 3);
34933
+ b10 = (s[6] << 28) | (s[7] >>> 4);
34934
+ b11 = (s[7] << 28) | (s[6] >>> 4);
34935
+ b42 = (s[17] << 23) | (s[16] >>> 9);
34936
+ b43 = (s[16] << 23) | (s[17] >>> 9);
34937
+ b24 = (s[26] << 25) | (s[27] >>> 7);
34938
+ b25 = (s[27] << 25) | (s[26] >>> 7);
34939
+ b6 = (s[36] << 21) | (s[37] >>> 11);
34940
+ b7 = (s[37] << 21) | (s[36] >>> 11);
34941
+ b38 = (s[47] << 24) | (s[46] >>> 8);
34942
+ b39 = (s[46] << 24) | (s[47] >>> 8);
34943
+ b30 = (s[8] << 27) | (s[9] >>> 5);
34944
+ b31 = (s[9] << 27) | (s[8] >>> 5);
34945
+ b12 = (s[18] << 20) | (s[19] >>> 12);
34946
+ b13 = (s[19] << 20) | (s[18] >>> 12);
34947
+ b44 = (s[29] << 7) | (s[28] >>> 25);
34948
+ b45 = (s[28] << 7) | (s[29] >>> 25);
34949
+ b26 = (s[38] << 8) | (s[39] >>> 24);
34950
+ b27 = (s[39] << 8) | (s[38] >>> 24);
34951
+ b8 = (s[48] << 14) | (s[49] >>> 18);
34952
+ b9 = (s[49] << 14) | (s[48] >>> 18);
34953
+
34954
+ s[0] = b0 ^ (~b2 & b4);
34955
+ s[1] = b1 ^ (~b3 & b5);
34956
+ s[10] = b10 ^ (~b12 & b14);
34957
+ s[11] = b11 ^ (~b13 & b15);
34958
+ s[20] = b20 ^ (~b22 & b24);
34959
+ s[21] = b21 ^ (~b23 & b25);
34960
+ s[30] = b30 ^ (~b32 & b34);
34961
+ s[31] = b31 ^ (~b33 & b35);
34962
+ s[40] = b40 ^ (~b42 & b44);
34963
+ s[41] = b41 ^ (~b43 & b45);
34964
+ s[2] = b2 ^ (~b4 & b6);
34965
+ s[3] = b3 ^ (~b5 & b7);
34966
+ s[12] = b12 ^ (~b14 & b16);
34967
+ s[13] = b13 ^ (~b15 & b17);
34968
+ s[22] = b22 ^ (~b24 & b26);
34969
+ s[23] = b23 ^ (~b25 & b27);
34970
+ s[32] = b32 ^ (~b34 & b36);
34971
+ s[33] = b33 ^ (~b35 & b37);
34972
+ s[42] = b42 ^ (~b44 & b46);
34973
+ s[43] = b43 ^ (~b45 & b47);
34974
+ s[4] = b4 ^ (~b6 & b8);
34975
+ s[5] = b5 ^ (~b7 & b9);
34976
+ s[14] = b14 ^ (~b16 & b18);
34977
+ s[15] = b15 ^ (~b17 & b19);
34978
+ s[24] = b24 ^ (~b26 & b28);
34979
+ s[25] = b25 ^ (~b27 & b29);
34980
+ s[34] = b34 ^ (~b36 & b38);
34981
+ s[35] = b35 ^ (~b37 & b39);
34982
+ s[44] = b44 ^ (~b46 & b48);
34983
+ s[45] = b45 ^ (~b47 & b49);
34984
+ s[6] = b6 ^ (~b8 & b0);
34985
+ s[7] = b7 ^ (~b9 & b1);
34986
+ s[16] = b16 ^ (~b18 & b10);
34987
+ s[17] = b17 ^ (~b19 & b11);
34988
+ s[26] = b26 ^ (~b28 & b20);
34989
+ s[27] = b27 ^ (~b29 & b21);
34990
+ s[36] = b36 ^ (~b38 & b30);
34991
+ s[37] = b37 ^ (~b39 & b31);
34992
+ s[46] = b46 ^ (~b48 & b40);
34993
+ s[47] = b47 ^ (~b49 & b41);
34994
+ s[8] = b8 ^ (~b0 & b2);
34995
+ s[9] = b9 ^ (~b1 & b3);
34996
+ s[18] = b18 ^ (~b10 & b12);
34997
+ s[19] = b19 ^ (~b11 & b13);
34998
+ s[28] = b28 ^ (~b20 & b22);
34999
+ s[29] = b29 ^ (~b21 & b23);
35000
+ s[38] = b38 ^ (~b30 & b32);
35001
+ s[39] = b39 ^ (~b31 & b33);
35002
+ s[48] = b48 ^ (~b40 & b42);
35003
+ s[49] = b49 ^ (~b41 & b43);
35004
+
35005
+ s[0] ^= RC[n];
35006
+ s[1] ^= RC[n + 1];
35007
+ }
35008
+ };
35009
+
35010
+ if (COMMON_JS) {
35011
+ module.exports = methods;
35012
+ } else {
35013
+ for (i = 0; i < methodNames.length; ++i) {
35014
+ root[methodNames[i]] = methods[methodNames[i]];
35015
+ }
35016
+ if (AMD) {
35017
+ !(__WEBPACK_AMD_DEFINE_RESULT__ = (function () {
35018
+ return methods;
35019
+ }).call(exports, __webpack_require__, exports, module),
35020
+ __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
35021
+ }
35022
+ }
35023
+ })();
35024
+
35025
+
34303
35026
  /***/ }),
34304
35027
 
34305
35028
  /***/ 857:
@@ -45755,7 +46478,7 @@ try {
45755
46478
  /***/ ((module) => {
45756
46479
 
45757
46480
  "use strict";
45758
- module.exports = JSON.parse('{"name":"@onekeyfe/hd-core","version":"0.1.52","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.52","@onekeyfe/hd-transport":"^0.1.52","axios":"^0.27.2","bignumber.js":"^9.0.2","js-sha256":"^0.9.0","parse-uri":"^1.0.7","semver":"^7.3.7"},"devDependencies":{"@types/parse-uri":"^1.0.0","@types/semver":"^7.3.9"}}');
46481
+ module.exports = JSON.parse('{"name":"@onekeyfe/hd-core","version":"0.1.53","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.53","@onekeyfe/hd-transport":"^0.1.53","axios":"^0.27.2","bignumber.js":"^9.0.2","js-sha256":"^0.9.0","js-sha3":"^0.8.0","parse-uri":"^1.0.7","semver":"^7.3.7"},"devDependencies":{"@types/parse-uri":"^1.0.0","@types/semver":"^7.3.9"}}');
45759
46482
 
45760
46483
  /***/ })
45761
46484
 
@@ -48287,7 +49010,7 @@ const src_init = async settings => {
48287
49010
 
48288
49011
  try {
48289
49012
  await init({ ..._settings,
48290
- version: "0.1.52"
49013
+ version: "0.1.53"
48291
49014
  });
48292
49015
  return true;
48293
49016
  } catch (e) {