@onekeyfe/hd-web-sdk 0.1.9 → 0.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/iframe.html +1 -1
- package/build/js/iframe.ae8a60bf83e0c694af12.js +3 -0
- package/build/js/{iframe.ca8c9bf911f6e891b2e3.js.LICENSE.txt → iframe.ae8a60bf83e0c694af12.js.LICENSE.txt} +9 -0
- package/build/js/iframe.ae8a60bf83e0c694af12.js.map +1 -0
- package/build/onekey-js-sdk.js +575 -2
- package/build/onekey-js-sdk.js.map +1 -1
- package/build/onekey-js-sdk.min.js +1 -1
- package/build/onekey-js-sdk.min.js.map +1 -1
- package/package.json +5 -5
- package/build/js/iframe.ca8c9bf911f6e891b2e3.js +0 -3
- package/build/js/iframe.ca8c9bf911f6e891b2e3.js.map +0 -1
package/build/onekey-js-sdk.js
CHANGED
|
@@ -4031,6 +4031,8 @@ var axios = __webpack_require__(9644);
|
|
|
4031
4031
|
|
|
4032
4032
|
var BigNumber = __webpack_require__(6391);
|
|
4033
4033
|
|
|
4034
|
+
var sha256 = __webpack_require__(1965);
|
|
4035
|
+
|
|
4034
4036
|
var hdTransport = __webpack_require__(7495);
|
|
4035
4037
|
|
|
4036
4038
|
function _interopDefaultLegacy(e) {
|
|
@@ -4045,6 +4047,8 @@ var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
|
|
|
4045
4047
|
|
|
4046
4048
|
var BigNumber__default = /*#__PURE__*/_interopDefaultLegacy(BigNumber);
|
|
4047
4049
|
|
|
4050
|
+
var sha256__default = /*#__PURE__*/_interopDefaultLegacy(sha256);
|
|
4051
|
+
|
|
4048
4052
|
const inject = ({
|
|
4049
4053
|
call,
|
|
4050
4054
|
cancel,
|
|
@@ -4086,6 +4090,9 @@ const inject = ({
|
|
|
4086
4090
|
checkTransportRelease: () => call({
|
|
4087
4091
|
method: 'checkTransportRelease'
|
|
4088
4092
|
}),
|
|
4093
|
+
checkBridgeStatus: () => call({
|
|
4094
|
+
method: 'checkBridgeStatus'
|
|
4095
|
+
}),
|
|
4089
4096
|
cipherKeyValue: (connectId, params) => call(Object.assign(Object.assign({}, params), {
|
|
4090
4097
|
connectId,
|
|
4091
4098
|
method: 'cipherKeyValue'
|
|
@@ -4972,6 +4979,18 @@ const versionCompare = (a, b) => {
|
|
|
4972
4979
|
return 0;
|
|
4973
4980
|
};
|
|
4974
4981
|
|
|
4982
|
+
function patchFeatures(response) {
|
|
4983
|
+
if (response.type !== 'Features') {
|
|
4984
|
+
return response;
|
|
4985
|
+
}
|
|
4986
|
+
|
|
4987
|
+
if (response.message.major_version < 1) {
|
|
4988
|
+
response.message.major_version = 1;
|
|
4989
|
+
}
|
|
4990
|
+
|
|
4991
|
+
return response;
|
|
4992
|
+
}
|
|
4993
|
+
|
|
4975
4994
|
const getDeviceModel = features => {
|
|
4976
4995
|
if (!features || typeof features !== 'object') {
|
|
4977
4996
|
return 'model_mini';
|
|
@@ -14327,7 +14346,7 @@ class DeviceCommands {
|
|
|
14327
14346
|
}
|
|
14328
14347
|
|
|
14329
14348
|
if (res.type === 'Features') {
|
|
14330
|
-
return Promise.resolve(res);
|
|
14349
|
+
return Promise.resolve(patchFeatures(res));
|
|
14331
14350
|
}
|
|
14332
14351
|
|
|
14333
14352
|
if (res.type === 'ButtonRequest') {
|
|
@@ -16333,6 +16352,25 @@ class CheckTransportRelease extends BaseMethod {
|
|
|
16333
16352
|
|
|
16334
16353
|
}
|
|
16335
16354
|
|
|
16355
|
+
class CheckBridgeStatus extends BaseMethod {
|
|
16356
|
+
init() {
|
|
16357
|
+
this.useDevice = false;
|
|
16358
|
+
}
|
|
16359
|
+
|
|
16360
|
+
run() {
|
|
16361
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
16362
|
+
return new Promise(resolve => {
|
|
16363
|
+
axios__default["default"].request({
|
|
16364
|
+
url: 'http://localhost:21320',
|
|
16365
|
+
method: 'POST',
|
|
16366
|
+
withCredentials: false
|
|
16367
|
+
}).then(() => resolve(true)).catch(() => resolve(false));
|
|
16368
|
+
});
|
|
16369
|
+
});
|
|
16370
|
+
}
|
|
16371
|
+
|
|
16372
|
+
}
|
|
16373
|
+
|
|
16336
16374
|
class DeviceBackup extends BaseMethod {
|
|
16337
16375
|
init() {}
|
|
16338
16376
|
|
|
@@ -16601,7 +16639,9 @@ class DeviceVerify extends BaseMethod {
|
|
|
16601
16639
|
let response;
|
|
16602
16640
|
|
|
16603
16641
|
if (deviceType === 'classic') {
|
|
16604
|
-
const res = yield this.device.commands.typedCall('BixinVerifyDeviceRequest', 'BixinVerifyDeviceAck', Object.assign({}, this.params)
|
|
16642
|
+
const res = yield this.device.commands.typedCall('BixinVerifyDeviceRequest', 'BixinVerifyDeviceAck', Object.assign(Object.assign({}, this.params), {
|
|
16643
|
+
data: sha256__default["default"].sha256(this.params.data)
|
|
16644
|
+
}));
|
|
16605
16645
|
response = res.message;
|
|
16606
16646
|
} else if (deviceType === 'mini') {
|
|
16607
16647
|
const signatureRes = yield this.device.commands.typedCall('SESignMessage', 'SEMessageSignature', {
|
|
@@ -18572,6 +18612,7 @@ var ApiMethods = /*#__PURE__*/Object.freeze({
|
|
|
18572
18612
|
checkFirmwareRelease: CheckFirmwareRelease,
|
|
18573
18613
|
checkBLEFirmwareRelease: CheckBLEFirmwareRelease,
|
|
18574
18614
|
checkTransportRelease: CheckTransportRelease,
|
|
18615
|
+
checkBridgeStatus: CheckBridgeStatus,
|
|
18575
18616
|
deviceBackup: DeviceBackup,
|
|
18576
18617
|
deviceChangePin: DeviceChangePin,
|
|
18577
18618
|
deviceFlags: DeviceFlags,
|
|
@@ -19222,6 +19263,7 @@ __webpack_unused_export__ = isValidVersionString;
|
|
|
19222
19263
|
__webpack_unused_export__ = normalizeVersionArray;
|
|
19223
19264
|
exports._4 = parseConnectSettings;
|
|
19224
19265
|
exports.kW = parseMessage;
|
|
19266
|
+
__webpack_unused_export__ = patchFeatures;
|
|
19225
19267
|
__webpack_unused_export__ = safeThrowError;
|
|
19226
19268
|
__webpack_unused_export__ = versionCompare;
|
|
19227
19269
|
__webpack_unused_export__ = versionSplit;
|
|
@@ -31176,6 +31218,532 @@ exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
|
|
|
31176
31218
|
}
|
|
31177
31219
|
|
|
31178
31220
|
|
|
31221
|
+
/***/ }),
|
|
31222
|
+
|
|
31223
|
+
/***/ 1965:
|
|
31224
|
+
/***/ ((module, exports, __webpack_require__) => {
|
|
31225
|
+
|
|
31226
|
+
var __WEBPACK_AMD_DEFINE_RESULT__;/**
|
|
31227
|
+
* [js-sha256]{@link https://github.com/emn178/js-sha256}
|
|
31228
|
+
*
|
|
31229
|
+
* @version 0.9.0
|
|
31230
|
+
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
|
31231
|
+
* @copyright Chen, Yi-Cyuan 2014-2017
|
|
31232
|
+
* @license MIT
|
|
31233
|
+
*/
|
|
31234
|
+
/*jslint bitwise: true */
|
|
31235
|
+
(function () {
|
|
31236
|
+
'use strict';
|
|
31237
|
+
|
|
31238
|
+
var ERROR = 'input is invalid type';
|
|
31239
|
+
var WINDOW = typeof window === 'object';
|
|
31240
|
+
var root = WINDOW ? window : {};
|
|
31241
|
+
if (root.JS_SHA256_NO_WINDOW) {
|
|
31242
|
+
WINDOW = false;
|
|
31243
|
+
}
|
|
31244
|
+
var WEB_WORKER = !WINDOW && typeof self === 'object';
|
|
31245
|
+
var NODE_JS = !root.JS_SHA256_NO_NODE_JS && typeof process === 'object' && process.versions && process.versions.node;
|
|
31246
|
+
if (NODE_JS) {
|
|
31247
|
+
root = __webpack_require__.g;
|
|
31248
|
+
} else if (WEB_WORKER) {
|
|
31249
|
+
root = self;
|
|
31250
|
+
}
|
|
31251
|
+
var COMMON_JS = !root.JS_SHA256_NO_COMMON_JS && "object" === 'object' && module.exports;
|
|
31252
|
+
var AMD = true && __webpack_require__.amdO;
|
|
31253
|
+
var ARRAY_BUFFER = !root.JS_SHA256_NO_ARRAY_BUFFER && typeof ArrayBuffer !== 'undefined';
|
|
31254
|
+
var HEX_CHARS = '0123456789abcdef'.split('');
|
|
31255
|
+
var EXTRA = [-2147483648, 8388608, 32768, 128];
|
|
31256
|
+
var SHIFT = [24, 16, 8, 0];
|
|
31257
|
+
var K = [
|
|
31258
|
+
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
|
|
31259
|
+
0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
|
|
31260
|
+
0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
|
|
31261
|
+
0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
|
|
31262
|
+
0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
|
|
31263
|
+
0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
|
|
31264
|
+
0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
|
|
31265
|
+
0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
|
|
31266
|
+
];
|
|
31267
|
+
var OUTPUT_TYPES = ['hex', 'array', 'digest', 'arrayBuffer'];
|
|
31268
|
+
|
|
31269
|
+
var blocks = [];
|
|
31270
|
+
|
|
31271
|
+
if (root.JS_SHA256_NO_NODE_JS || !Array.isArray) {
|
|
31272
|
+
Array.isArray = function (obj) {
|
|
31273
|
+
return Object.prototype.toString.call(obj) === '[object Array]';
|
|
31274
|
+
};
|
|
31275
|
+
}
|
|
31276
|
+
|
|
31277
|
+
if (ARRAY_BUFFER && (root.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW || !ArrayBuffer.isView)) {
|
|
31278
|
+
ArrayBuffer.isView = function (obj) {
|
|
31279
|
+
return typeof obj === 'object' && obj.buffer && obj.buffer.constructor === ArrayBuffer;
|
|
31280
|
+
};
|
|
31281
|
+
}
|
|
31282
|
+
|
|
31283
|
+
var createOutputMethod = function (outputType, is224) {
|
|
31284
|
+
return function (message) {
|
|
31285
|
+
return new Sha256(is224, true).update(message)[outputType]();
|
|
31286
|
+
};
|
|
31287
|
+
};
|
|
31288
|
+
|
|
31289
|
+
var createMethod = function (is224) {
|
|
31290
|
+
var method = createOutputMethod('hex', is224);
|
|
31291
|
+
if (NODE_JS) {
|
|
31292
|
+
method = nodeWrap(method, is224);
|
|
31293
|
+
}
|
|
31294
|
+
method.create = function () {
|
|
31295
|
+
return new Sha256(is224);
|
|
31296
|
+
};
|
|
31297
|
+
method.update = function (message) {
|
|
31298
|
+
return method.create().update(message);
|
|
31299
|
+
};
|
|
31300
|
+
for (var i = 0; i < OUTPUT_TYPES.length; ++i) {
|
|
31301
|
+
var type = OUTPUT_TYPES[i];
|
|
31302
|
+
method[type] = createOutputMethod(type, is224);
|
|
31303
|
+
}
|
|
31304
|
+
return method;
|
|
31305
|
+
};
|
|
31306
|
+
|
|
31307
|
+
var nodeWrap = function (method, is224) {
|
|
31308
|
+
var crypto = eval("require('crypto')");
|
|
31309
|
+
var Buffer = eval("require('buffer').Buffer");
|
|
31310
|
+
var algorithm = is224 ? 'sha224' : 'sha256';
|
|
31311
|
+
var nodeMethod = function (message) {
|
|
31312
|
+
if (typeof message === 'string') {
|
|
31313
|
+
return crypto.createHash(algorithm).update(message, 'utf8').digest('hex');
|
|
31314
|
+
} else {
|
|
31315
|
+
if (message === null || message === undefined) {
|
|
31316
|
+
throw new Error(ERROR);
|
|
31317
|
+
} else if (message.constructor === ArrayBuffer) {
|
|
31318
|
+
message = new Uint8Array(message);
|
|
31319
|
+
}
|
|
31320
|
+
}
|
|
31321
|
+
if (Array.isArray(message) || ArrayBuffer.isView(message) ||
|
|
31322
|
+
message.constructor === Buffer) {
|
|
31323
|
+
return crypto.createHash(algorithm).update(new Buffer(message)).digest('hex');
|
|
31324
|
+
} else {
|
|
31325
|
+
return method(message);
|
|
31326
|
+
}
|
|
31327
|
+
};
|
|
31328
|
+
return nodeMethod;
|
|
31329
|
+
};
|
|
31330
|
+
|
|
31331
|
+
var createHmacOutputMethod = function (outputType, is224) {
|
|
31332
|
+
return function (key, message) {
|
|
31333
|
+
return new HmacSha256(key, is224, true).update(message)[outputType]();
|
|
31334
|
+
};
|
|
31335
|
+
};
|
|
31336
|
+
|
|
31337
|
+
var createHmacMethod = function (is224) {
|
|
31338
|
+
var method = createHmacOutputMethod('hex', is224);
|
|
31339
|
+
method.create = function (key) {
|
|
31340
|
+
return new HmacSha256(key, is224);
|
|
31341
|
+
};
|
|
31342
|
+
method.update = function (key, message) {
|
|
31343
|
+
return method.create(key).update(message);
|
|
31344
|
+
};
|
|
31345
|
+
for (var i = 0; i < OUTPUT_TYPES.length; ++i) {
|
|
31346
|
+
var type = OUTPUT_TYPES[i];
|
|
31347
|
+
method[type] = createHmacOutputMethod(type, is224);
|
|
31348
|
+
}
|
|
31349
|
+
return method;
|
|
31350
|
+
};
|
|
31351
|
+
|
|
31352
|
+
function Sha256(is224, sharedMemory) {
|
|
31353
|
+
if (sharedMemory) {
|
|
31354
|
+
blocks[0] = blocks[16] = blocks[1] = blocks[2] = blocks[3] =
|
|
31355
|
+
blocks[4] = blocks[5] = blocks[6] = blocks[7] =
|
|
31356
|
+
blocks[8] = blocks[9] = blocks[10] = blocks[11] =
|
|
31357
|
+
blocks[12] = blocks[13] = blocks[14] = blocks[15] = 0;
|
|
31358
|
+
this.blocks = blocks;
|
|
31359
|
+
} else {
|
|
31360
|
+
this.blocks = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
|
|
31361
|
+
}
|
|
31362
|
+
|
|
31363
|
+
if (is224) {
|
|
31364
|
+
this.h0 = 0xc1059ed8;
|
|
31365
|
+
this.h1 = 0x367cd507;
|
|
31366
|
+
this.h2 = 0x3070dd17;
|
|
31367
|
+
this.h3 = 0xf70e5939;
|
|
31368
|
+
this.h4 = 0xffc00b31;
|
|
31369
|
+
this.h5 = 0x68581511;
|
|
31370
|
+
this.h6 = 0x64f98fa7;
|
|
31371
|
+
this.h7 = 0xbefa4fa4;
|
|
31372
|
+
} else { // 256
|
|
31373
|
+
this.h0 = 0x6a09e667;
|
|
31374
|
+
this.h1 = 0xbb67ae85;
|
|
31375
|
+
this.h2 = 0x3c6ef372;
|
|
31376
|
+
this.h3 = 0xa54ff53a;
|
|
31377
|
+
this.h4 = 0x510e527f;
|
|
31378
|
+
this.h5 = 0x9b05688c;
|
|
31379
|
+
this.h6 = 0x1f83d9ab;
|
|
31380
|
+
this.h7 = 0x5be0cd19;
|
|
31381
|
+
}
|
|
31382
|
+
|
|
31383
|
+
this.block = this.start = this.bytes = this.hBytes = 0;
|
|
31384
|
+
this.finalized = this.hashed = false;
|
|
31385
|
+
this.first = true;
|
|
31386
|
+
this.is224 = is224;
|
|
31387
|
+
}
|
|
31388
|
+
|
|
31389
|
+
Sha256.prototype.update = function (message) {
|
|
31390
|
+
if (this.finalized) {
|
|
31391
|
+
return;
|
|
31392
|
+
}
|
|
31393
|
+
var notString, type = typeof message;
|
|
31394
|
+
if (type !== 'string') {
|
|
31395
|
+
if (type === 'object') {
|
|
31396
|
+
if (message === null) {
|
|
31397
|
+
throw new Error(ERROR);
|
|
31398
|
+
} else if (ARRAY_BUFFER && message.constructor === ArrayBuffer) {
|
|
31399
|
+
message = new Uint8Array(message);
|
|
31400
|
+
} else if (!Array.isArray(message)) {
|
|
31401
|
+
if (!ARRAY_BUFFER || !ArrayBuffer.isView(message)) {
|
|
31402
|
+
throw new Error(ERROR);
|
|
31403
|
+
}
|
|
31404
|
+
}
|
|
31405
|
+
} else {
|
|
31406
|
+
throw new Error(ERROR);
|
|
31407
|
+
}
|
|
31408
|
+
notString = true;
|
|
31409
|
+
}
|
|
31410
|
+
var code, index = 0, i, length = message.length, blocks = this.blocks;
|
|
31411
|
+
|
|
31412
|
+
while (index < length) {
|
|
31413
|
+
if (this.hashed) {
|
|
31414
|
+
this.hashed = false;
|
|
31415
|
+
blocks[0] = this.block;
|
|
31416
|
+
blocks[16] = blocks[1] = blocks[2] = blocks[3] =
|
|
31417
|
+
blocks[4] = blocks[5] = blocks[6] = blocks[7] =
|
|
31418
|
+
blocks[8] = blocks[9] = blocks[10] = blocks[11] =
|
|
31419
|
+
blocks[12] = blocks[13] = blocks[14] = blocks[15] = 0;
|
|
31420
|
+
}
|
|
31421
|
+
|
|
31422
|
+
if (notString) {
|
|
31423
|
+
for (i = this.start; index < length && i < 64; ++index) {
|
|
31424
|
+
blocks[i >> 2] |= message[index] << SHIFT[i++ & 3];
|
|
31425
|
+
}
|
|
31426
|
+
} else {
|
|
31427
|
+
for (i = this.start; index < length && i < 64; ++index) {
|
|
31428
|
+
code = message.charCodeAt(index);
|
|
31429
|
+
if (code < 0x80) {
|
|
31430
|
+
blocks[i >> 2] |= code << SHIFT[i++ & 3];
|
|
31431
|
+
} else if (code < 0x800) {
|
|
31432
|
+
blocks[i >> 2] |= (0xc0 | (code >> 6)) << SHIFT[i++ & 3];
|
|
31433
|
+
blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];
|
|
31434
|
+
} else if (code < 0xd800 || code >= 0xe000) {
|
|
31435
|
+
blocks[i >> 2] |= (0xe0 | (code >> 12)) << SHIFT[i++ & 3];
|
|
31436
|
+
blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3];
|
|
31437
|
+
blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];
|
|
31438
|
+
} else {
|
|
31439
|
+
code = 0x10000 + (((code & 0x3ff) << 10) | (message.charCodeAt(++index) & 0x3ff));
|
|
31440
|
+
blocks[i >> 2] |= (0xf0 | (code >> 18)) << SHIFT[i++ & 3];
|
|
31441
|
+
blocks[i >> 2] |= (0x80 | ((code >> 12) & 0x3f)) << SHIFT[i++ & 3];
|
|
31442
|
+
blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3];
|
|
31443
|
+
blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];
|
|
31444
|
+
}
|
|
31445
|
+
}
|
|
31446
|
+
}
|
|
31447
|
+
|
|
31448
|
+
this.lastByteIndex = i;
|
|
31449
|
+
this.bytes += i - this.start;
|
|
31450
|
+
if (i >= 64) {
|
|
31451
|
+
this.block = blocks[16];
|
|
31452
|
+
this.start = i - 64;
|
|
31453
|
+
this.hash();
|
|
31454
|
+
this.hashed = true;
|
|
31455
|
+
} else {
|
|
31456
|
+
this.start = i;
|
|
31457
|
+
}
|
|
31458
|
+
}
|
|
31459
|
+
if (this.bytes > 4294967295) {
|
|
31460
|
+
this.hBytes += this.bytes / 4294967296 << 0;
|
|
31461
|
+
this.bytes = this.bytes % 4294967296;
|
|
31462
|
+
}
|
|
31463
|
+
return this;
|
|
31464
|
+
};
|
|
31465
|
+
|
|
31466
|
+
Sha256.prototype.finalize = function () {
|
|
31467
|
+
if (this.finalized) {
|
|
31468
|
+
return;
|
|
31469
|
+
}
|
|
31470
|
+
this.finalized = true;
|
|
31471
|
+
var blocks = this.blocks, i = this.lastByteIndex;
|
|
31472
|
+
blocks[16] = this.block;
|
|
31473
|
+
blocks[i >> 2] |= EXTRA[i & 3];
|
|
31474
|
+
this.block = blocks[16];
|
|
31475
|
+
if (i >= 56) {
|
|
31476
|
+
if (!this.hashed) {
|
|
31477
|
+
this.hash();
|
|
31478
|
+
}
|
|
31479
|
+
blocks[0] = this.block;
|
|
31480
|
+
blocks[16] = blocks[1] = blocks[2] = blocks[3] =
|
|
31481
|
+
blocks[4] = blocks[5] = blocks[6] = blocks[7] =
|
|
31482
|
+
blocks[8] = blocks[9] = blocks[10] = blocks[11] =
|
|
31483
|
+
blocks[12] = blocks[13] = blocks[14] = blocks[15] = 0;
|
|
31484
|
+
}
|
|
31485
|
+
blocks[14] = this.hBytes << 3 | this.bytes >>> 29;
|
|
31486
|
+
blocks[15] = this.bytes << 3;
|
|
31487
|
+
this.hash();
|
|
31488
|
+
};
|
|
31489
|
+
|
|
31490
|
+
Sha256.prototype.hash = function () {
|
|
31491
|
+
var a = this.h0, b = this.h1, c = this.h2, d = this.h3, e = this.h4, f = this.h5, g = this.h6,
|
|
31492
|
+
h = this.h7, blocks = this.blocks, j, s0, s1, maj, t1, t2, ch, ab, da, cd, bc;
|
|
31493
|
+
|
|
31494
|
+
for (j = 16; j < 64; ++j) {
|
|
31495
|
+
// rightrotate
|
|
31496
|
+
t1 = blocks[j - 15];
|
|
31497
|
+
s0 = ((t1 >>> 7) | (t1 << 25)) ^ ((t1 >>> 18) | (t1 << 14)) ^ (t1 >>> 3);
|
|
31498
|
+
t1 = blocks[j - 2];
|
|
31499
|
+
s1 = ((t1 >>> 17) | (t1 << 15)) ^ ((t1 >>> 19) | (t1 << 13)) ^ (t1 >>> 10);
|
|
31500
|
+
blocks[j] = blocks[j - 16] + s0 + blocks[j - 7] + s1 << 0;
|
|
31501
|
+
}
|
|
31502
|
+
|
|
31503
|
+
bc = b & c;
|
|
31504
|
+
for (j = 0; j < 64; j += 4) {
|
|
31505
|
+
if (this.first) {
|
|
31506
|
+
if (this.is224) {
|
|
31507
|
+
ab = 300032;
|
|
31508
|
+
t1 = blocks[0] - 1413257819;
|
|
31509
|
+
h = t1 - 150054599 << 0;
|
|
31510
|
+
d = t1 + 24177077 << 0;
|
|
31511
|
+
} else {
|
|
31512
|
+
ab = 704751109;
|
|
31513
|
+
t1 = blocks[0] - 210244248;
|
|
31514
|
+
h = t1 - 1521486534 << 0;
|
|
31515
|
+
d = t1 + 143694565 << 0;
|
|
31516
|
+
}
|
|
31517
|
+
this.first = false;
|
|
31518
|
+
} else {
|
|
31519
|
+
s0 = ((a >>> 2) | (a << 30)) ^ ((a >>> 13) | (a << 19)) ^ ((a >>> 22) | (a << 10));
|
|
31520
|
+
s1 = ((e >>> 6) | (e << 26)) ^ ((e >>> 11) | (e << 21)) ^ ((e >>> 25) | (e << 7));
|
|
31521
|
+
ab = a & b;
|
|
31522
|
+
maj = ab ^ (a & c) ^ bc;
|
|
31523
|
+
ch = (e & f) ^ (~e & g);
|
|
31524
|
+
t1 = h + s1 + ch + K[j] + blocks[j];
|
|
31525
|
+
t2 = s0 + maj;
|
|
31526
|
+
h = d + t1 << 0;
|
|
31527
|
+
d = t1 + t2 << 0;
|
|
31528
|
+
}
|
|
31529
|
+
s0 = ((d >>> 2) | (d << 30)) ^ ((d >>> 13) | (d << 19)) ^ ((d >>> 22) | (d << 10));
|
|
31530
|
+
s1 = ((h >>> 6) | (h << 26)) ^ ((h >>> 11) | (h << 21)) ^ ((h >>> 25) | (h << 7));
|
|
31531
|
+
da = d & a;
|
|
31532
|
+
maj = da ^ (d & b) ^ ab;
|
|
31533
|
+
ch = (h & e) ^ (~h & f);
|
|
31534
|
+
t1 = g + s1 + ch + K[j + 1] + blocks[j + 1];
|
|
31535
|
+
t2 = s0 + maj;
|
|
31536
|
+
g = c + t1 << 0;
|
|
31537
|
+
c = t1 + t2 << 0;
|
|
31538
|
+
s0 = ((c >>> 2) | (c << 30)) ^ ((c >>> 13) | (c << 19)) ^ ((c >>> 22) | (c << 10));
|
|
31539
|
+
s1 = ((g >>> 6) | (g << 26)) ^ ((g >>> 11) | (g << 21)) ^ ((g >>> 25) | (g << 7));
|
|
31540
|
+
cd = c & d;
|
|
31541
|
+
maj = cd ^ (c & a) ^ da;
|
|
31542
|
+
ch = (g & h) ^ (~g & e);
|
|
31543
|
+
t1 = f + s1 + ch + K[j + 2] + blocks[j + 2];
|
|
31544
|
+
t2 = s0 + maj;
|
|
31545
|
+
f = b + t1 << 0;
|
|
31546
|
+
b = t1 + t2 << 0;
|
|
31547
|
+
s0 = ((b >>> 2) | (b << 30)) ^ ((b >>> 13) | (b << 19)) ^ ((b >>> 22) | (b << 10));
|
|
31548
|
+
s1 = ((f >>> 6) | (f << 26)) ^ ((f >>> 11) | (f << 21)) ^ ((f >>> 25) | (f << 7));
|
|
31549
|
+
bc = b & c;
|
|
31550
|
+
maj = bc ^ (b & d) ^ cd;
|
|
31551
|
+
ch = (f & g) ^ (~f & h);
|
|
31552
|
+
t1 = e + s1 + ch + K[j + 3] + blocks[j + 3];
|
|
31553
|
+
t2 = s0 + maj;
|
|
31554
|
+
e = a + t1 << 0;
|
|
31555
|
+
a = t1 + t2 << 0;
|
|
31556
|
+
}
|
|
31557
|
+
|
|
31558
|
+
this.h0 = this.h0 + a << 0;
|
|
31559
|
+
this.h1 = this.h1 + b << 0;
|
|
31560
|
+
this.h2 = this.h2 + c << 0;
|
|
31561
|
+
this.h3 = this.h3 + d << 0;
|
|
31562
|
+
this.h4 = this.h4 + e << 0;
|
|
31563
|
+
this.h5 = this.h5 + f << 0;
|
|
31564
|
+
this.h6 = this.h6 + g << 0;
|
|
31565
|
+
this.h7 = this.h7 + h << 0;
|
|
31566
|
+
};
|
|
31567
|
+
|
|
31568
|
+
Sha256.prototype.hex = function () {
|
|
31569
|
+
this.finalize();
|
|
31570
|
+
|
|
31571
|
+
var h0 = this.h0, h1 = this.h1, h2 = this.h2, h3 = this.h3, h4 = this.h4, h5 = this.h5,
|
|
31572
|
+
h6 = this.h6, h7 = this.h7;
|
|
31573
|
+
|
|
31574
|
+
var hex = HEX_CHARS[(h0 >> 28) & 0x0F] + HEX_CHARS[(h0 >> 24) & 0x0F] +
|
|
31575
|
+
HEX_CHARS[(h0 >> 20) & 0x0F] + HEX_CHARS[(h0 >> 16) & 0x0F] +
|
|
31576
|
+
HEX_CHARS[(h0 >> 12) & 0x0F] + HEX_CHARS[(h0 >> 8) & 0x0F] +
|
|
31577
|
+
HEX_CHARS[(h0 >> 4) & 0x0F] + HEX_CHARS[h0 & 0x0F] +
|
|
31578
|
+
HEX_CHARS[(h1 >> 28) & 0x0F] + HEX_CHARS[(h1 >> 24) & 0x0F] +
|
|
31579
|
+
HEX_CHARS[(h1 >> 20) & 0x0F] + HEX_CHARS[(h1 >> 16) & 0x0F] +
|
|
31580
|
+
HEX_CHARS[(h1 >> 12) & 0x0F] + HEX_CHARS[(h1 >> 8) & 0x0F] +
|
|
31581
|
+
HEX_CHARS[(h1 >> 4) & 0x0F] + HEX_CHARS[h1 & 0x0F] +
|
|
31582
|
+
HEX_CHARS[(h2 >> 28) & 0x0F] + HEX_CHARS[(h2 >> 24) & 0x0F] +
|
|
31583
|
+
HEX_CHARS[(h2 >> 20) & 0x0F] + HEX_CHARS[(h2 >> 16) & 0x0F] +
|
|
31584
|
+
HEX_CHARS[(h2 >> 12) & 0x0F] + HEX_CHARS[(h2 >> 8) & 0x0F] +
|
|
31585
|
+
HEX_CHARS[(h2 >> 4) & 0x0F] + HEX_CHARS[h2 & 0x0F] +
|
|
31586
|
+
HEX_CHARS[(h3 >> 28) & 0x0F] + HEX_CHARS[(h3 >> 24) & 0x0F] +
|
|
31587
|
+
HEX_CHARS[(h3 >> 20) & 0x0F] + HEX_CHARS[(h3 >> 16) & 0x0F] +
|
|
31588
|
+
HEX_CHARS[(h3 >> 12) & 0x0F] + HEX_CHARS[(h3 >> 8) & 0x0F] +
|
|
31589
|
+
HEX_CHARS[(h3 >> 4) & 0x0F] + HEX_CHARS[h3 & 0x0F] +
|
|
31590
|
+
HEX_CHARS[(h4 >> 28) & 0x0F] + HEX_CHARS[(h4 >> 24) & 0x0F] +
|
|
31591
|
+
HEX_CHARS[(h4 >> 20) & 0x0F] + HEX_CHARS[(h4 >> 16) & 0x0F] +
|
|
31592
|
+
HEX_CHARS[(h4 >> 12) & 0x0F] + HEX_CHARS[(h4 >> 8) & 0x0F] +
|
|
31593
|
+
HEX_CHARS[(h4 >> 4) & 0x0F] + HEX_CHARS[h4 & 0x0F] +
|
|
31594
|
+
HEX_CHARS[(h5 >> 28) & 0x0F] + HEX_CHARS[(h5 >> 24) & 0x0F] +
|
|
31595
|
+
HEX_CHARS[(h5 >> 20) & 0x0F] + HEX_CHARS[(h5 >> 16) & 0x0F] +
|
|
31596
|
+
HEX_CHARS[(h5 >> 12) & 0x0F] + HEX_CHARS[(h5 >> 8) & 0x0F] +
|
|
31597
|
+
HEX_CHARS[(h5 >> 4) & 0x0F] + HEX_CHARS[h5 & 0x0F] +
|
|
31598
|
+
HEX_CHARS[(h6 >> 28) & 0x0F] + HEX_CHARS[(h6 >> 24) & 0x0F] +
|
|
31599
|
+
HEX_CHARS[(h6 >> 20) & 0x0F] + HEX_CHARS[(h6 >> 16) & 0x0F] +
|
|
31600
|
+
HEX_CHARS[(h6 >> 12) & 0x0F] + HEX_CHARS[(h6 >> 8) & 0x0F] +
|
|
31601
|
+
HEX_CHARS[(h6 >> 4) & 0x0F] + HEX_CHARS[h6 & 0x0F];
|
|
31602
|
+
if (!this.is224) {
|
|
31603
|
+
hex += HEX_CHARS[(h7 >> 28) & 0x0F] + HEX_CHARS[(h7 >> 24) & 0x0F] +
|
|
31604
|
+
HEX_CHARS[(h7 >> 20) & 0x0F] + HEX_CHARS[(h7 >> 16) & 0x0F] +
|
|
31605
|
+
HEX_CHARS[(h7 >> 12) & 0x0F] + HEX_CHARS[(h7 >> 8) & 0x0F] +
|
|
31606
|
+
HEX_CHARS[(h7 >> 4) & 0x0F] + HEX_CHARS[h7 & 0x0F];
|
|
31607
|
+
}
|
|
31608
|
+
return hex;
|
|
31609
|
+
};
|
|
31610
|
+
|
|
31611
|
+
Sha256.prototype.toString = Sha256.prototype.hex;
|
|
31612
|
+
|
|
31613
|
+
Sha256.prototype.digest = function () {
|
|
31614
|
+
this.finalize();
|
|
31615
|
+
|
|
31616
|
+
var h0 = this.h0, h1 = this.h1, h2 = this.h2, h3 = this.h3, h4 = this.h4, h5 = this.h5,
|
|
31617
|
+
h6 = this.h6, h7 = this.h7;
|
|
31618
|
+
|
|
31619
|
+
var arr = [
|
|
31620
|
+
(h0 >> 24) & 0xFF, (h0 >> 16) & 0xFF, (h0 >> 8) & 0xFF, h0 & 0xFF,
|
|
31621
|
+
(h1 >> 24) & 0xFF, (h1 >> 16) & 0xFF, (h1 >> 8) & 0xFF, h1 & 0xFF,
|
|
31622
|
+
(h2 >> 24) & 0xFF, (h2 >> 16) & 0xFF, (h2 >> 8) & 0xFF, h2 & 0xFF,
|
|
31623
|
+
(h3 >> 24) & 0xFF, (h3 >> 16) & 0xFF, (h3 >> 8) & 0xFF, h3 & 0xFF,
|
|
31624
|
+
(h4 >> 24) & 0xFF, (h4 >> 16) & 0xFF, (h4 >> 8) & 0xFF, h4 & 0xFF,
|
|
31625
|
+
(h5 >> 24) & 0xFF, (h5 >> 16) & 0xFF, (h5 >> 8) & 0xFF, h5 & 0xFF,
|
|
31626
|
+
(h6 >> 24) & 0xFF, (h6 >> 16) & 0xFF, (h6 >> 8) & 0xFF, h6 & 0xFF
|
|
31627
|
+
];
|
|
31628
|
+
if (!this.is224) {
|
|
31629
|
+
arr.push((h7 >> 24) & 0xFF, (h7 >> 16) & 0xFF, (h7 >> 8) & 0xFF, h7 & 0xFF);
|
|
31630
|
+
}
|
|
31631
|
+
return arr;
|
|
31632
|
+
};
|
|
31633
|
+
|
|
31634
|
+
Sha256.prototype.array = Sha256.prototype.digest;
|
|
31635
|
+
|
|
31636
|
+
Sha256.prototype.arrayBuffer = function () {
|
|
31637
|
+
this.finalize();
|
|
31638
|
+
|
|
31639
|
+
var buffer = new ArrayBuffer(this.is224 ? 28 : 32);
|
|
31640
|
+
var dataView = new DataView(buffer);
|
|
31641
|
+
dataView.setUint32(0, this.h0);
|
|
31642
|
+
dataView.setUint32(4, this.h1);
|
|
31643
|
+
dataView.setUint32(8, this.h2);
|
|
31644
|
+
dataView.setUint32(12, this.h3);
|
|
31645
|
+
dataView.setUint32(16, this.h4);
|
|
31646
|
+
dataView.setUint32(20, this.h5);
|
|
31647
|
+
dataView.setUint32(24, this.h6);
|
|
31648
|
+
if (!this.is224) {
|
|
31649
|
+
dataView.setUint32(28, this.h7);
|
|
31650
|
+
}
|
|
31651
|
+
return buffer;
|
|
31652
|
+
};
|
|
31653
|
+
|
|
31654
|
+
function HmacSha256(key, is224, sharedMemory) {
|
|
31655
|
+
var i, type = typeof key;
|
|
31656
|
+
if (type === 'string') {
|
|
31657
|
+
var bytes = [], length = key.length, index = 0, code;
|
|
31658
|
+
for (i = 0; i < length; ++i) {
|
|
31659
|
+
code = key.charCodeAt(i);
|
|
31660
|
+
if (code < 0x80) {
|
|
31661
|
+
bytes[index++] = code;
|
|
31662
|
+
} else if (code < 0x800) {
|
|
31663
|
+
bytes[index++] = (0xc0 | (code >> 6));
|
|
31664
|
+
bytes[index++] = (0x80 | (code & 0x3f));
|
|
31665
|
+
} else if (code < 0xd800 || code >= 0xe000) {
|
|
31666
|
+
bytes[index++] = (0xe0 | (code >> 12));
|
|
31667
|
+
bytes[index++] = (0x80 | ((code >> 6) & 0x3f));
|
|
31668
|
+
bytes[index++] = (0x80 | (code & 0x3f));
|
|
31669
|
+
} else {
|
|
31670
|
+
code = 0x10000 + (((code & 0x3ff) << 10) | (key.charCodeAt(++i) & 0x3ff));
|
|
31671
|
+
bytes[index++] = (0xf0 | (code >> 18));
|
|
31672
|
+
bytes[index++] = (0x80 | ((code >> 12) & 0x3f));
|
|
31673
|
+
bytes[index++] = (0x80 | ((code >> 6) & 0x3f));
|
|
31674
|
+
bytes[index++] = (0x80 | (code & 0x3f));
|
|
31675
|
+
}
|
|
31676
|
+
}
|
|
31677
|
+
key = bytes;
|
|
31678
|
+
} else {
|
|
31679
|
+
if (type === 'object') {
|
|
31680
|
+
if (key === null) {
|
|
31681
|
+
throw new Error(ERROR);
|
|
31682
|
+
} else if (ARRAY_BUFFER && key.constructor === ArrayBuffer) {
|
|
31683
|
+
key = new Uint8Array(key);
|
|
31684
|
+
} else if (!Array.isArray(key)) {
|
|
31685
|
+
if (!ARRAY_BUFFER || !ArrayBuffer.isView(key)) {
|
|
31686
|
+
throw new Error(ERROR);
|
|
31687
|
+
}
|
|
31688
|
+
}
|
|
31689
|
+
} else {
|
|
31690
|
+
throw new Error(ERROR);
|
|
31691
|
+
}
|
|
31692
|
+
}
|
|
31693
|
+
|
|
31694
|
+
if (key.length > 64) {
|
|
31695
|
+
key = (new Sha256(is224, true)).update(key).array();
|
|
31696
|
+
}
|
|
31697
|
+
|
|
31698
|
+
var oKeyPad = [], iKeyPad = [];
|
|
31699
|
+
for (i = 0; i < 64; ++i) {
|
|
31700
|
+
var b = key[i] || 0;
|
|
31701
|
+
oKeyPad[i] = 0x5c ^ b;
|
|
31702
|
+
iKeyPad[i] = 0x36 ^ b;
|
|
31703
|
+
}
|
|
31704
|
+
|
|
31705
|
+
Sha256.call(this, is224, sharedMemory);
|
|
31706
|
+
|
|
31707
|
+
this.update(iKeyPad);
|
|
31708
|
+
this.oKeyPad = oKeyPad;
|
|
31709
|
+
this.inner = true;
|
|
31710
|
+
this.sharedMemory = sharedMemory;
|
|
31711
|
+
}
|
|
31712
|
+
HmacSha256.prototype = new Sha256();
|
|
31713
|
+
|
|
31714
|
+
HmacSha256.prototype.finalize = function () {
|
|
31715
|
+
Sha256.prototype.finalize.call(this);
|
|
31716
|
+
if (this.inner) {
|
|
31717
|
+
this.inner = false;
|
|
31718
|
+
var innerHash = this.array();
|
|
31719
|
+
Sha256.call(this, this.is224, this.sharedMemory);
|
|
31720
|
+
this.update(this.oKeyPad);
|
|
31721
|
+
this.update(innerHash);
|
|
31722
|
+
Sha256.prototype.finalize.call(this);
|
|
31723
|
+
}
|
|
31724
|
+
};
|
|
31725
|
+
|
|
31726
|
+
var exports = createMethod();
|
|
31727
|
+
exports.sha256 = exports;
|
|
31728
|
+
exports.sha224 = createMethod(true);
|
|
31729
|
+
exports.sha256.hmac = createHmacMethod();
|
|
31730
|
+
exports.sha224.hmac = createHmacMethod(true);
|
|
31731
|
+
|
|
31732
|
+
if (COMMON_JS) {
|
|
31733
|
+
module.exports = exports;
|
|
31734
|
+
} else {
|
|
31735
|
+
root.sha256 = exports.sha256;
|
|
31736
|
+
root.sha224 = exports.sha224;
|
|
31737
|
+
if (AMD) {
|
|
31738
|
+
!(__WEBPACK_AMD_DEFINE_RESULT__ = (function () {
|
|
31739
|
+
return exports;
|
|
31740
|
+
}).call(exports, __webpack_require__, exports, module),
|
|
31741
|
+
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
|
31742
|
+
}
|
|
31743
|
+
}
|
|
31744
|
+
})();
|
|
31745
|
+
|
|
31746
|
+
|
|
31179
31747
|
/***/ }),
|
|
31180
31748
|
|
|
31181
31749
|
/***/ 857:
|
|
@@ -42654,6 +43222,11 @@ try {
|
|
|
42654
43222
|
/******/ }
|
|
42655
43223
|
/******/
|
|
42656
43224
|
/************************************************************************/
|
|
43225
|
+
/******/ /* webpack/runtime/amd options */
|
|
43226
|
+
/******/ (() => {
|
|
43227
|
+
/******/ __webpack_require__.amdO = {};
|
|
43228
|
+
/******/ })();
|
|
43229
|
+
/******/
|
|
42657
43230
|
/******/ /* webpack/runtime/compat get default export */
|
|
42658
43231
|
/******/ (() => {
|
|
42659
43232
|
/******/ // getDefaultExport function for compatibility with non-harmony modules
|