@leofcoin/chain 1.5.65 → 1.5.67

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.
Files changed (22) hide show
  1. package/exports/browser/{_polyfill-node.url-1q06MepH.js → _polyfill-node.url-Bp9XkJZf.js} +1 -1
  2. package/exports/browser/{browser-1GyRaZxg-C9SpI6hG.js → browser-Ei0BXMlu-C1_XUL9Y.js} +2 -2
  3. package/exports/browser/browser-store.js +122 -309
  4. package/exports/browser/chain.js +38 -14
  5. package/exports/browser/{client-UOCjJBGl-pbv-pTHd.js → client-A009z8av-DQfd3vOY.js} +5 -5
  6. package/exports/browser/{index-ub31QSed-EMPr2oeb.js → index-G74WLzL7-Dt2dwaXq.js} +2 -2
  7. package/exports/browser/{index-K4Kwju30-vS3fNpxy.js → index-YQrIDBUQ-c7011Ab4.js} +2 -2
  8. package/exports/browser/{messages-guyZfse6-JeAlT5Nb.js → messages-lWRTai7t-ClhClfC1.js} +2 -2
  9. package/exports/browser/{node-browser-0Ly80awM.js → node-browser-DqIklEKv.js} +624 -622
  10. package/exports/browser/node-browser.js +2 -2
  11. package/exports/browser/workers/block-worker.js +1 -1
  12. package/exports/browser/workers/machine-worker.js +1 -1
  13. package/exports/chain.js +8 -1
  14. package/exports/workers/block-worker.js +1 -1
  15. package/exports/workers/machine-worker.js +1 -1
  16. package/package.json +1 -1
  17. /package/exports/browser/{_polyfill-node.child_process-rc1HO9Xs.js → _polyfill-node.child_process-BsjYmFff.js} +0 -0
  18. /package/exports/browser/{browser-AyxSBUXj-AyxSBUXj.js → browser-AyxSBUXj-pguCHlVu.js} +0 -0
  19. /package/exports/browser/{password-JCRBtU5A.js → password-oDixGC8h.js} +0 -0
  20. /package/exports/browser/{qr-scanner-worker.min-RaSiJc_R-RaSiJc_R.js → qr-scanner-worker.min-RaSiJc_R-Dy0qkKA4.js} +0 -0
  21. /package/exports/browser/workers/{worker-hbo9s9AT.js → worker-CltAyHf1.js} +0 -0
  22. /package/exports/workers/{worker-hbo9s9AT.js → worker-CltAyHf1.js} +0 -0
@@ -1,4 +1,4 @@
1
- import { C as ContractMessage, T as TransactionMessage, B as BlockMessage, a as BWMessage, b as BWRequestMessage, V as ValidatorMessage } from './_polyfill-node.child_process-rc1HO9Xs.js';
1
+ import { C as ContractMessage, T as TransactionMessage, B as BlockMessage, a as BWMessage, b as BWRequestMessage, V as ValidatorMessage } from './_polyfill-node.child_process-BsjYmFff.js';
2
2
 
3
3
  var nodeConfig = async (config = {
4
4
  network: 'leofcoin:peach',
@@ -107,7 +107,8 @@ const debug$1 = (target, text) => {
107
107
  globalThis.DEBUG === 'true' ||
108
108
  globalThis.DEBUG === true ||
109
109
  globalThis.DEBUG?.indexOf(target) !== -1 ||
110
- globalThis.DEBUG?.indexOf('*') !== -1
110
+ globalThis.DEBUG?.indexOf('*') !== -1 ||
111
+ globalThis.DEBUG?.indexOf(target.split('/')[0]) !== -1
111
112
  )
112
113
  if (text) console.log('\x1b[34m\x1b[1m%s', `${target}: ${text}`, '\x1b[0m');
113
114
  else console.log('\x1b[34m\x1b[1m%s', `${target}`, '\x1b[0m');
@@ -12858,6 +12859,7 @@ const nothingFoundError = (hash) => {
12858
12859
  };
12859
12860
 
12860
12861
  const isBrowser = globalThis.process?.versions?.node ? false : true;
12862
+
12861
12863
  let LeofcoinStorage$1 = class LeofcoinStorage {
12862
12864
  name;
12863
12865
  root;
@@ -12893,7 +12895,7 @@ let LeofcoinStorage$1 = class LeofcoinStorage {
12893
12895
  if (typeof key === 'object')
12894
12896
  return this.many('has', key);
12895
12897
  try {
12896
- const has = await this.db.get(new KeyPath(key));
12898
+ const has = await this.db.has(new KeyPath(key));
12897
12899
  return Boolean(has);
12898
12900
  }
12899
12901
  catch (e) {
@@ -13106,185 +13108,522 @@ var index$1 = {
13106
13108
  }
13107
13109
  };
13108
13110
 
13109
- var elliptic$2 = {};
13110
-
13111
- var name = "elliptic";
13112
- var version$1 = "6.5.4";
13113
- var description = "EC cryptography";
13114
- var main = "lib/elliptic.js";
13115
- var files = [
13116
- "lib"
13117
- ];
13118
- var scripts = {
13119
- lint: "eslint lib test",
13120
- "lint:fix": "npm run lint -- --fix",
13121
- unit: "istanbul test _mocha --reporter=spec test/index.js",
13122
- test: "npm run lint && npm run unit",
13123
- version: "grunt dist && git add dist/"
13124
- };
13125
- var repository = {
13126
- type: "git",
13127
- url: "git@github.com:indutny/elliptic"
13128
- };
13129
- var keywords = [
13130
- "EC",
13131
- "Elliptic",
13132
- "curve",
13133
- "Cryptography"
13134
- ];
13135
- var author = "Fedor Indutny <fedor@indutny.com>";
13136
- var license = "MIT";
13137
- var bugs = {
13138
- url: "https://github.com/indutny/elliptic/issues"
13139
- };
13140
- var homepage = "https://github.com/indutny/elliptic";
13141
- var devDependencies = {
13142
- brfs: "^2.0.2",
13143
- coveralls: "^3.1.0",
13144
- eslint: "^7.6.0",
13145
- grunt: "^1.2.1",
13146
- "grunt-browserify": "^5.3.0",
13147
- "grunt-cli": "^1.3.2",
13148
- "grunt-contrib-connect": "^3.0.0",
13149
- "grunt-contrib-copy": "^1.0.0",
13150
- "grunt-contrib-uglify": "^5.0.0",
13151
- "grunt-mocha-istanbul": "^5.0.2",
13152
- "grunt-saucelabs": "^9.0.1",
13153
- istanbul: "^0.4.5",
13154
- mocha: "^8.0.1"
13155
- };
13156
- var dependencies = {
13157
- "bn.js": "^4.11.9",
13158
- brorand: "^1.1.0",
13159
- "hash.js": "^1.0.0",
13160
- "hmac-drbg": "^1.0.1",
13161
- inherits: "^2.0.4",
13162
- "minimalistic-assert": "^1.0.1",
13163
- "minimalistic-crypto-utils": "^1.0.1"
13164
- };
13165
- var require$$0 = {
13166
- name: name,
13167
- version: version$1,
13168
- description: description,
13169
- main: main,
13170
- files: files,
13171
- scripts: scripts,
13172
- repository: repository,
13173
- keywords: keywords,
13174
- author: author,
13175
- license: license,
13176
- bugs: bugs,
13177
- homepage: homepage,
13178
- devDependencies: devDependencies,
13179
- dependencies: dependencies
13111
+ const errors = {
13112
+ IMPOSSIBLE_CASE: 'Impossible case. Please create issue.',
13113
+ TWEAK_ADD:
13114
+ 'The tweak was out of range or the resulted private key is invalid',
13115
+ TWEAK_MUL: 'The tweak was out of range or equal to zero',
13116
+ CONTEXT_RANDOMIZE_UNKNOW: 'Unknow error on context randomization',
13117
+ SECKEY_INVALID: 'Private Key is invalid',
13118
+ PUBKEY_PARSE: 'Public Key could not be parsed',
13119
+ PUBKEY_SERIALIZE: 'Public Key serialization error',
13120
+ PUBKEY_COMBINE: 'The sum of the public keys is not valid',
13121
+ SIG_PARSE: 'Signature could not be parsed',
13122
+ SIGN: 'The nonce generation function failed, or the private key was invalid',
13123
+ RECOVER: 'Public key could not be recover',
13124
+ ECDH: 'Scalar was invalid (zero or overflow)'
13180
13125
  };
13181
13126
 
13182
- var utils$o = {};
13183
-
13184
- var bn = {exports: {}};
13127
+ function assert$g (cond, msg) {
13128
+ if (!cond) throw new Error(msg)
13129
+ }
13185
13130
 
13186
- (function (module) {
13187
- (function (module, exports) {
13131
+ function isUint8Array (name, value, length) {
13132
+ assert$g(value instanceof Uint8Array, `Expected ${name} to be an Uint8Array`);
13188
13133
 
13189
- // Utils
13190
- function assert (val, msg) {
13191
- if (!val) throw new Error(msg || 'Assertion failed');
13192
- }
13134
+ if (length !== undefined) {
13135
+ if (Array.isArray(length)) {
13136
+ const numbers = length.join(', ');
13137
+ const msg = `Expected ${name} to be an Uint8Array with length [${numbers}]`;
13138
+ assert$g(length.includes(value.length), msg);
13139
+ } else {
13140
+ const msg = `Expected ${name} to be an Uint8Array with length ${length}`;
13141
+ assert$g(value.length === length, msg);
13142
+ }
13143
+ }
13144
+ }
13193
13145
 
13194
- // Could use `inherits` module, but don't want to move from single file
13195
- // architecture yet.
13196
- function inherits (ctor, superCtor) {
13197
- ctor.super_ = superCtor;
13198
- var TempCtor = function () {};
13199
- TempCtor.prototype = superCtor.prototype;
13200
- ctor.prototype = new TempCtor();
13201
- ctor.prototype.constructor = ctor;
13202
- }
13146
+ function isCompressed (value) {
13147
+ assert$g(toTypeString(value) === 'Boolean', 'Expected compressed to be a Boolean');
13148
+ }
13203
13149
 
13204
- // BN
13150
+ function getAssertedOutput (output = (len) => new Uint8Array(len), length) {
13151
+ if (typeof output === 'function') output = output(length);
13152
+ isUint8Array('output', output, length);
13153
+ return output
13154
+ }
13205
13155
 
13206
- function BN (number, base, endian) {
13207
- if (BN.isBN(number)) {
13208
- return number;
13209
- }
13156
+ function toTypeString (value) {
13157
+ return Object.prototype.toString.call(value).slice(8, -1)
13158
+ }
13210
13159
 
13211
- this.negative = 0;
13212
- this.words = null;
13213
- this.length = 0;
13160
+ var lib = (secp256k1) => {
13161
+ return {
13162
+ contextRandomize (seed) {
13163
+ assert$g(
13164
+ seed === null || seed instanceof Uint8Array,
13165
+ 'Expected seed to be an Uint8Array or null'
13166
+ );
13167
+ if (seed !== null) isUint8Array('seed', seed, 32);
13214
13168
 
13215
- // Reduction context
13216
- this.red = null;
13169
+ switch (secp256k1.contextRandomize(seed)) {
13170
+ case 1:
13171
+ throw new Error(errors.CONTEXT_RANDOMIZE_UNKNOW)
13172
+ }
13173
+ },
13217
13174
 
13218
- if (number !== null) {
13219
- if (base === 'le' || base === 'be') {
13220
- endian = base;
13221
- base = 10;
13222
- }
13175
+ privateKeyVerify (seckey) {
13176
+ isUint8Array('private key', seckey, 32);
13223
13177
 
13224
- this._init(number || 0, base || 10, endian || 'be');
13225
- }
13226
- }
13227
- if (typeof module === 'object') {
13228
- module.exports = BN;
13229
- } else {
13230
- exports.BN = BN;
13231
- }
13178
+ return secp256k1.privateKeyVerify(seckey) === 0
13179
+ },
13232
13180
 
13233
- BN.BN = BN;
13234
- BN.wordSize = 26;
13181
+ privateKeyNegate (seckey) {
13182
+ isUint8Array('private key', seckey, 32);
13235
13183
 
13236
- var Buffer;
13237
- try {
13238
- if (typeof window !== 'undefined' && typeof window.Buffer !== 'undefined') {
13239
- Buffer = window.Buffer;
13240
- } else {
13241
- Buffer = require$$3.Buffer;
13242
- }
13243
- } catch (e) {
13244
- }
13184
+ switch (secp256k1.privateKeyNegate(seckey)) {
13185
+ case 0:
13186
+ return seckey
13187
+ case 1:
13188
+ throw new Error(errors.IMPOSSIBLE_CASE)
13189
+ }
13190
+ },
13245
13191
 
13246
- BN.isBN = function isBN (num) {
13247
- if (num instanceof BN) {
13248
- return true;
13249
- }
13192
+ privateKeyTweakAdd (seckey, tweak) {
13193
+ isUint8Array('private key', seckey, 32);
13194
+ isUint8Array('tweak', tweak, 32);
13250
13195
 
13251
- return num !== null && typeof num === 'object' &&
13252
- num.constructor.wordSize === BN.wordSize && Array.isArray(num.words);
13253
- };
13196
+ switch (secp256k1.privateKeyTweakAdd(seckey, tweak)) {
13197
+ case 0:
13198
+ return seckey
13199
+ case 1:
13200
+ throw new Error(errors.TWEAK_ADD)
13201
+ }
13202
+ },
13254
13203
 
13255
- BN.max = function max (left, right) {
13256
- if (left.cmp(right) > 0) return left;
13257
- return right;
13258
- };
13204
+ privateKeyTweakMul (seckey, tweak) {
13205
+ isUint8Array('private key', seckey, 32);
13206
+ isUint8Array('tweak', tweak, 32);
13259
13207
 
13260
- BN.min = function min (left, right) {
13261
- if (left.cmp(right) < 0) return left;
13262
- return right;
13263
- };
13208
+ switch (secp256k1.privateKeyTweakMul(seckey, tweak)) {
13209
+ case 0:
13210
+ return seckey
13211
+ case 1:
13212
+ throw new Error(errors.TWEAK_MUL)
13213
+ }
13214
+ },
13264
13215
 
13265
- BN.prototype._init = function init (number, base, endian) {
13266
- if (typeof number === 'number') {
13267
- return this._initNumber(number, base, endian);
13268
- }
13216
+ publicKeyVerify (pubkey) {
13217
+ isUint8Array('public key', pubkey, [33, 65]);
13269
13218
 
13270
- if (typeof number === 'object') {
13271
- return this._initArray(number, base, endian);
13272
- }
13219
+ return secp256k1.publicKeyVerify(pubkey) === 0
13220
+ },
13273
13221
 
13274
- if (base === 'hex') {
13275
- base = 16;
13276
- }
13277
- assert(base === (base | 0) && base >= 2 && base <= 36);
13222
+ publicKeyCreate (seckey, compressed = true, output) {
13223
+ isUint8Array('private key', seckey, 32);
13224
+ isCompressed(compressed);
13225
+ output = getAssertedOutput(output, compressed ? 33 : 65);
13278
13226
 
13279
- number = number.toString().replace(/\s+/g, '');
13280
- var start = 0;
13281
- if (number[0] === '-') {
13282
- start++;
13283
- this.negative = 1;
13284
- }
13227
+ switch (secp256k1.publicKeyCreate(output, seckey)) {
13228
+ case 0:
13229
+ return output
13230
+ case 1:
13231
+ throw new Error(errors.SECKEY_INVALID)
13232
+ case 2:
13233
+ throw new Error(errors.PUBKEY_SERIALIZE)
13234
+ }
13235
+ },
13285
13236
 
13286
- if (start < number.length) {
13287
- if (base === 16) {
13237
+ publicKeyConvert (pubkey, compressed = true, output) {
13238
+ isUint8Array('public key', pubkey, [33, 65]);
13239
+ isCompressed(compressed);
13240
+ output = getAssertedOutput(output, compressed ? 33 : 65);
13241
+
13242
+ switch (secp256k1.publicKeyConvert(output, pubkey)) {
13243
+ case 0:
13244
+ return output
13245
+ case 1:
13246
+ throw new Error(errors.PUBKEY_PARSE)
13247
+ case 2:
13248
+ throw new Error(errors.PUBKEY_SERIALIZE)
13249
+ }
13250
+ },
13251
+
13252
+ publicKeyNegate (pubkey, compressed = true, output) {
13253
+ isUint8Array('public key', pubkey, [33, 65]);
13254
+ isCompressed(compressed);
13255
+ output = getAssertedOutput(output, compressed ? 33 : 65);
13256
+
13257
+ switch (secp256k1.publicKeyNegate(output, pubkey)) {
13258
+ case 0:
13259
+ return output
13260
+ case 1:
13261
+ throw new Error(errors.PUBKEY_PARSE)
13262
+ case 2:
13263
+ throw new Error(errors.IMPOSSIBLE_CASE)
13264
+ case 3:
13265
+ throw new Error(errors.PUBKEY_SERIALIZE)
13266
+ }
13267
+ },
13268
+
13269
+ publicKeyCombine (pubkeys, compressed = true, output) {
13270
+ assert$g(Array.isArray(pubkeys), 'Expected public keys to be an Array');
13271
+ assert$g(pubkeys.length > 0, 'Expected public keys array will have more than zero items');
13272
+ for (const pubkey of pubkeys) {
13273
+ isUint8Array('public key', pubkey, [33, 65]);
13274
+ }
13275
+ isCompressed(compressed);
13276
+ output = getAssertedOutput(output, compressed ? 33 : 65);
13277
+
13278
+ switch (secp256k1.publicKeyCombine(output, pubkeys)) {
13279
+ case 0:
13280
+ return output
13281
+ case 1:
13282
+ throw new Error(errors.PUBKEY_PARSE)
13283
+ case 2:
13284
+ throw new Error(errors.PUBKEY_COMBINE)
13285
+ case 3:
13286
+ throw new Error(errors.PUBKEY_SERIALIZE)
13287
+ }
13288
+ },
13289
+
13290
+ publicKeyTweakAdd (pubkey, tweak, compressed = true, output) {
13291
+ isUint8Array('public key', pubkey, [33, 65]);
13292
+ isUint8Array('tweak', tweak, 32);
13293
+ isCompressed(compressed);
13294
+ output = getAssertedOutput(output, compressed ? 33 : 65);
13295
+
13296
+ switch (secp256k1.publicKeyTweakAdd(output, pubkey, tweak)) {
13297
+ case 0:
13298
+ return output
13299
+ case 1:
13300
+ throw new Error(errors.PUBKEY_PARSE)
13301
+ case 2:
13302
+ throw new Error(errors.TWEAK_ADD)
13303
+ }
13304
+ },
13305
+
13306
+ publicKeyTweakMul (pubkey, tweak, compressed = true, output) {
13307
+ isUint8Array('public key', pubkey, [33, 65]);
13308
+ isUint8Array('tweak', tweak, 32);
13309
+ isCompressed(compressed);
13310
+ output = getAssertedOutput(output, compressed ? 33 : 65);
13311
+
13312
+ switch (secp256k1.publicKeyTweakMul(output, pubkey, tweak)) {
13313
+ case 0:
13314
+ return output
13315
+ case 1:
13316
+ throw new Error(errors.PUBKEY_PARSE)
13317
+ case 2:
13318
+ throw new Error(errors.TWEAK_MUL)
13319
+ }
13320
+ },
13321
+
13322
+ signatureNormalize (sig) {
13323
+ isUint8Array('signature', sig, 64);
13324
+
13325
+ switch (secp256k1.signatureNormalize(sig)) {
13326
+ case 0:
13327
+ return sig
13328
+ case 1:
13329
+ throw new Error(errors.SIG_PARSE)
13330
+ }
13331
+ },
13332
+
13333
+ signatureExport (sig, output) {
13334
+ isUint8Array('signature', sig, 64);
13335
+ output = getAssertedOutput(output, 72);
13336
+
13337
+ const obj = { output, outputlen: 72 };
13338
+ switch (secp256k1.signatureExport(obj, sig)) {
13339
+ case 0:
13340
+ return output.slice(0, obj.outputlen)
13341
+ case 1:
13342
+ throw new Error(errors.SIG_PARSE)
13343
+ case 2:
13344
+ throw new Error(errors.IMPOSSIBLE_CASE)
13345
+ }
13346
+ },
13347
+
13348
+ signatureImport (sig, output) {
13349
+ isUint8Array('signature', sig);
13350
+ output = getAssertedOutput(output, 64);
13351
+
13352
+ switch (secp256k1.signatureImport(output, sig)) {
13353
+ case 0:
13354
+ return output
13355
+ case 1:
13356
+ throw new Error(errors.SIG_PARSE)
13357
+ case 2:
13358
+ throw new Error(errors.IMPOSSIBLE_CASE)
13359
+ }
13360
+ },
13361
+
13362
+ ecdsaSign (msg32, seckey, options = {}, output) {
13363
+ isUint8Array('message', msg32, 32);
13364
+ isUint8Array('private key', seckey, 32);
13365
+ assert$g(toTypeString(options) === 'Object', 'Expected options to be an Object');
13366
+ if (options.data !== undefined) isUint8Array('options.data', options.data);
13367
+ if (options.noncefn !== undefined) assert$g(toTypeString(options.noncefn) === 'Function', 'Expected options.noncefn to be a Function');
13368
+ output = getAssertedOutput(output, 64);
13369
+
13370
+ const obj = { signature: output, recid: null };
13371
+ switch (secp256k1.ecdsaSign(obj, msg32, seckey, options.data, options.noncefn)) {
13372
+ case 0:
13373
+ return obj
13374
+ case 1:
13375
+ throw new Error(errors.SIGN)
13376
+ case 2:
13377
+ throw new Error(errors.IMPOSSIBLE_CASE)
13378
+ }
13379
+ },
13380
+
13381
+ ecdsaVerify (sig, msg32, pubkey) {
13382
+ isUint8Array('signature', sig, 64);
13383
+ isUint8Array('message', msg32, 32);
13384
+ isUint8Array('public key', pubkey, [33, 65]);
13385
+
13386
+ switch (secp256k1.ecdsaVerify(sig, msg32, pubkey)) {
13387
+ case 0:
13388
+ return true
13389
+ case 3:
13390
+ return false
13391
+ case 1:
13392
+ throw new Error(errors.SIG_PARSE)
13393
+ case 2:
13394
+ throw new Error(errors.PUBKEY_PARSE)
13395
+ }
13396
+ },
13397
+
13398
+ ecdsaRecover (sig, recid, msg32, compressed = true, output) {
13399
+ isUint8Array('signature', sig, 64);
13400
+ assert$g(
13401
+ toTypeString(recid) === 'Number' &&
13402
+ recid >= 0 &&
13403
+ recid <= 3,
13404
+ 'Expected recovery id to be a Number within interval [0, 3]'
13405
+ );
13406
+ isUint8Array('message', msg32, 32);
13407
+ isCompressed(compressed);
13408
+ output = getAssertedOutput(output, compressed ? 33 : 65);
13409
+
13410
+ switch (secp256k1.ecdsaRecover(output, sig, recid, msg32)) {
13411
+ case 0:
13412
+ return output
13413
+ case 1:
13414
+ throw new Error(errors.SIG_PARSE)
13415
+ case 2:
13416
+ throw new Error(errors.RECOVER)
13417
+ case 3:
13418
+ throw new Error(errors.IMPOSSIBLE_CASE)
13419
+ }
13420
+ },
13421
+
13422
+ ecdh (pubkey, seckey, options = {}, output) {
13423
+ isUint8Array('public key', pubkey, [33, 65]);
13424
+ isUint8Array('private key', seckey, 32);
13425
+ assert$g(toTypeString(options) === 'Object', 'Expected options to be an Object');
13426
+ if (options.data !== undefined) isUint8Array('options.data', options.data);
13427
+ if (options.hashfn !== undefined) {
13428
+ assert$g(toTypeString(options.hashfn) === 'Function', 'Expected options.hashfn to be a Function');
13429
+ if (options.xbuf !== undefined) isUint8Array('options.xbuf', options.xbuf, 32);
13430
+ if (options.ybuf !== undefined) isUint8Array('options.ybuf', options.ybuf, 32);
13431
+ isUint8Array('output', output);
13432
+ } else {
13433
+ output = getAssertedOutput(output, 32);
13434
+ }
13435
+
13436
+ switch (secp256k1.ecdh(output, pubkey, seckey, options.data, options.hashfn, options.xbuf, options.ybuf)) {
13437
+ case 0:
13438
+ return output
13439
+ case 1:
13440
+ throw new Error(errors.PUBKEY_PARSE)
13441
+ case 2:
13442
+ throw new Error(errors.ECDH)
13443
+ }
13444
+ }
13445
+ }
13446
+ };
13447
+
13448
+ var elliptic$2 = {};
13449
+
13450
+ var name = "elliptic";
13451
+ var version$1 = "6.5.4";
13452
+ var description = "EC cryptography";
13453
+ var main = "lib/elliptic.js";
13454
+ var files = [
13455
+ "lib"
13456
+ ];
13457
+ var scripts = {
13458
+ lint: "eslint lib test",
13459
+ "lint:fix": "npm run lint -- --fix",
13460
+ unit: "istanbul test _mocha --reporter=spec test/index.js",
13461
+ test: "npm run lint && npm run unit",
13462
+ version: "grunt dist && git add dist/"
13463
+ };
13464
+ var repository = {
13465
+ type: "git",
13466
+ url: "git@github.com:indutny/elliptic"
13467
+ };
13468
+ var keywords = [
13469
+ "EC",
13470
+ "Elliptic",
13471
+ "curve",
13472
+ "Cryptography"
13473
+ ];
13474
+ var author = "Fedor Indutny <fedor@indutny.com>";
13475
+ var license = "MIT";
13476
+ var bugs = {
13477
+ url: "https://github.com/indutny/elliptic/issues"
13478
+ };
13479
+ var homepage = "https://github.com/indutny/elliptic";
13480
+ var devDependencies = {
13481
+ brfs: "^2.0.2",
13482
+ coveralls: "^3.1.0",
13483
+ eslint: "^7.6.0",
13484
+ grunt: "^1.2.1",
13485
+ "grunt-browserify": "^5.3.0",
13486
+ "grunt-cli": "^1.3.2",
13487
+ "grunt-contrib-connect": "^3.0.0",
13488
+ "grunt-contrib-copy": "^1.0.0",
13489
+ "grunt-contrib-uglify": "^5.0.0",
13490
+ "grunt-mocha-istanbul": "^5.0.2",
13491
+ "grunt-saucelabs": "^9.0.1",
13492
+ istanbul: "^0.4.5",
13493
+ mocha: "^8.0.1"
13494
+ };
13495
+ var dependencies = {
13496
+ "bn.js": "^4.11.9",
13497
+ brorand: "^1.1.0",
13498
+ "hash.js": "^1.0.0",
13499
+ "hmac-drbg": "^1.0.1",
13500
+ inherits: "^2.0.4",
13501
+ "minimalistic-assert": "^1.0.1",
13502
+ "minimalistic-crypto-utils": "^1.0.1"
13503
+ };
13504
+ var require$$0 = {
13505
+ name: name,
13506
+ version: version$1,
13507
+ description: description,
13508
+ main: main,
13509
+ files: files,
13510
+ scripts: scripts,
13511
+ repository: repository,
13512
+ keywords: keywords,
13513
+ author: author,
13514
+ license: license,
13515
+ bugs: bugs,
13516
+ homepage: homepage,
13517
+ devDependencies: devDependencies,
13518
+ dependencies: dependencies
13519
+ };
13520
+
13521
+ var utils$o = {};
13522
+
13523
+ var bn = {exports: {}};
13524
+
13525
+ (function (module) {
13526
+ (function (module, exports) {
13527
+
13528
+ // Utils
13529
+ function assert (val, msg) {
13530
+ if (!val) throw new Error(msg || 'Assertion failed');
13531
+ }
13532
+
13533
+ // Could use `inherits` module, but don't want to move from single file
13534
+ // architecture yet.
13535
+ function inherits (ctor, superCtor) {
13536
+ ctor.super_ = superCtor;
13537
+ var TempCtor = function () {};
13538
+ TempCtor.prototype = superCtor.prototype;
13539
+ ctor.prototype = new TempCtor();
13540
+ ctor.prototype.constructor = ctor;
13541
+ }
13542
+
13543
+ // BN
13544
+
13545
+ function BN (number, base, endian) {
13546
+ if (BN.isBN(number)) {
13547
+ return number;
13548
+ }
13549
+
13550
+ this.negative = 0;
13551
+ this.words = null;
13552
+ this.length = 0;
13553
+
13554
+ // Reduction context
13555
+ this.red = null;
13556
+
13557
+ if (number !== null) {
13558
+ if (base === 'le' || base === 'be') {
13559
+ endian = base;
13560
+ base = 10;
13561
+ }
13562
+
13563
+ this._init(number || 0, base || 10, endian || 'be');
13564
+ }
13565
+ }
13566
+ if (typeof module === 'object') {
13567
+ module.exports = BN;
13568
+ } else {
13569
+ exports.BN = BN;
13570
+ }
13571
+
13572
+ BN.BN = BN;
13573
+ BN.wordSize = 26;
13574
+
13575
+ var Buffer;
13576
+ try {
13577
+ if (typeof window !== 'undefined' && typeof window.Buffer !== 'undefined') {
13578
+ Buffer = window.Buffer;
13579
+ } else {
13580
+ Buffer = require$$3.Buffer;
13581
+ }
13582
+ } catch (e) {
13583
+ }
13584
+
13585
+ BN.isBN = function isBN (num) {
13586
+ if (num instanceof BN) {
13587
+ return true;
13588
+ }
13589
+
13590
+ return num !== null && typeof num === 'object' &&
13591
+ num.constructor.wordSize === BN.wordSize && Array.isArray(num.words);
13592
+ };
13593
+
13594
+ BN.max = function max (left, right) {
13595
+ if (left.cmp(right) > 0) return left;
13596
+ return right;
13597
+ };
13598
+
13599
+ BN.min = function min (left, right) {
13600
+ if (left.cmp(right) < 0) return left;
13601
+ return right;
13602
+ };
13603
+
13604
+ BN.prototype._init = function init (number, base, endian) {
13605
+ if (typeof number === 'number') {
13606
+ return this._initNumber(number, base, endian);
13607
+ }
13608
+
13609
+ if (typeof number === 'object') {
13610
+ return this._initArray(number, base, endian);
13611
+ }
13612
+
13613
+ if (base === 'hex') {
13614
+ base = 16;
13615
+ }
13616
+ assert(base === (base | 0) && base >= 2 && base <= 36);
13617
+
13618
+ number = number.toString().replace(/\s+/g, '');
13619
+ var start = 0;
13620
+ if (number[0] === '-') {
13621
+ start++;
13622
+ this.negative = 1;
13623
+ }
13624
+
13625
+ if (start < number.length) {
13626
+ if (base === 16) {
13288
13627
  this._parseHex(number, start, endian);
13289
13628
  } else {
13290
13629
  this._parseBase(number, base, start);
@@ -16631,14 +16970,14 @@ var bn = {exports: {}};
16631
16970
 
16632
16971
  var bnExports = bn.exports;
16633
16972
 
16634
- var minimalisticAssert = assert$g;
16973
+ var minimalisticAssert = assert$f;
16635
16974
 
16636
- function assert$g(val, msg) {
16975
+ function assert$f(val, msg) {
16637
16976
  if (!val)
16638
16977
  throw new Error(msg || 'Assertion failed');
16639
16978
  }
16640
16979
 
16641
- assert$g.equal = function assertEqual(l, r, msg) {
16980
+ assert$f.equal = function assertEqual(l, r, msg) {
16642
16981
  if (l != r)
16643
16982
  throw new Error(msg || ('Assertion failed: ' + l + ' != ' + r));
16644
16983
  };
@@ -16901,7 +17240,7 @@ var BN$8 = bnExports;
16901
17240
  var utils$m = utils$o;
16902
17241
  var getNAF = utils$m.getNAF;
16903
17242
  var getJSF = utils$m.getJSF;
16904
- var assert$f = utils$m.assert;
17243
+ var assert$e = utils$m.assert;
16905
17244
 
16906
17245
  function BaseCurve(type, conf) {
16907
17246
  this.type = type;
@@ -16947,7 +17286,7 @@ BaseCurve.prototype.validate = function validate() {
16947
17286
  };
16948
17287
 
16949
17288
  BaseCurve.prototype._fixedNafMul = function _fixedNafMul(p, k) {
16950
- assert$f(p.precomputed);
17289
+ assert$e(p.precomputed);
16951
17290
  var doubles = p._getDoubles();
16952
17291
 
16953
17292
  var naf = getNAF(k, 1, this._bitLength);
@@ -17004,7 +17343,7 @@ BaseCurve.prototype._wnafMul = function _wnafMul(p, k) {
17004
17343
  if (i < 0)
17005
17344
  break;
17006
17345
  var z = naf[i];
17007
- assert$f(z !== 0);
17346
+ assert$e(z !== 0);
17008
17347
  if (p.type === 'affine') {
17009
17348
  // J +- P
17010
17349
  if (z > 0)
@@ -17172,9 +17511,9 @@ BaseCurve.prototype.decodePoint = function decodePoint(bytes, enc) {
17172
17511
  if ((bytes[0] === 0x04 || bytes[0] === 0x06 || bytes[0] === 0x07) &&
17173
17512
  bytes.length - 1 === 2 * len) {
17174
17513
  if (bytes[0] === 0x06)
17175
- assert$f(bytes[bytes.length - 1] % 2 === 0);
17514
+ assert$e(bytes[bytes.length - 1] % 2 === 0);
17176
17515
  else if (bytes[0] === 0x07)
17177
- assert$f(bytes[bytes.length - 1] % 2 === 1);
17516
+ assert$e(bytes[bytes.length - 1] % 2 === 1);
17178
17517
 
17179
17518
  var res = this.point(bytes.slice(1, 1 + len),
17180
17519
  bytes.slice(1 + len, 1 + 2 * len));
@@ -17313,7 +17652,7 @@ var BN$7 = bnExports;
17313
17652
  var inherits$3 = inherits_browserExports;
17314
17653
  var Base$2 = base;
17315
17654
 
17316
- var assert$e = utils$l.assert;
17655
+ var assert$d = utils$l.assert;
17317
17656
 
17318
17657
  function ShortCurve(conf) {
17319
17658
  Base$2.call(this, 'short', conf);
@@ -17358,7 +17697,7 @@ ShortCurve.prototype._getEndomorphism = function _getEndomorphism(conf) {
17358
17697
  lambda = lambdas[0];
17359
17698
  } else {
17360
17699
  lambda = lambdas[1];
17361
- assert$e(this.g.mul(lambda).x.cmp(this.g.x.redMul(beta)) === 0);
17700
+ assert$d(this.g.mul(lambda).x.cmp(this.g.x.redMul(beta)) === 0);
17362
17701
  }
17363
17702
  }
17364
17703
 
@@ -18427,7 +18766,7 @@ var BN$5 = bnExports;
18427
18766
  var inherits$1 = inherits_browserExports;
18428
18767
  var Base = base;
18429
18768
 
18430
- var assert$d = utils$j.assert;
18769
+ var assert$c = utils$j.assert;
18431
18770
 
18432
18771
  function EdwardsCurve(conf) {
18433
18772
  // NOTE: Important as we are creating point in Base.call()
@@ -18444,7 +18783,7 @@ function EdwardsCurve(conf) {
18444
18783
  this.d = new BN$5(conf.d, 16).toRed(this.red);
18445
18784
  this.dd = this.d.redAdd(this.d);
18446
18785
 
18447
- assert$d(!this.twisted || this.c.fromRed().cmpn(1) === 0);
18786
+ assert$c(!this.twisted || this.c.fromRed().cmpn(1) === 0);
18448
18787
  this.oneC = (conf.c | 0) === 1;
18449
18788
  }
18450
18789
  inherits$1(EdwardsCurve, Base);
@@ -18872,7 +19211,7 @@ var hash$2 = {};
18872
19211
 
18873
19212
  var utils$i = {};
18874
19213
 
18875
- var assert$c = minimalisticAssert;
19214
+ var assert$b = minimalisticAssert;
18876
19215
  var inherits = inherits_browserExports;
18877
19216
 
18878
19217
  utils$i.inherits = inherits;
@@ -18993,7 +19332,7 @@ utils$i.zero8 = zero8;
18993
19332
 
18994
19333
  function join32(msg, start, end, endian) {
18995
19334
  var len = end - start;
18996
- assert$c(len % 4 === 0);
19335
+ assert$b(len % 4 === 0);
18997
19336
  var res = new Array(len / 4);
18998
19337
  for (var i = 0, k = start; i < res.length; i++, k += 4) {
18999
19338
  var w;
@@ -19152,7 +19491,7 @@ utils$i.shr64_lo = shr64_lo$1;
19152
19491
  var common$5 = {};
19153
19492
 
19154
19493
  var utils$h = utils$i;
19155
- var assert$b = minimalisticAssert;
19494
+ var assert$a = minimalisticAssert;
19156
19495
 
19157
19496
  function BlockHash$4() {
19158
19497
  this.pending = null;
@@ -19197,7 +19536,7 @@ BlockHash$4.prototype.update = function update(msg, enc) {
19197
19536
 
19198
19537
  BlockHash$4.prototype.digest = function digest(enc) {
19199
19538
  this.update(this._pad());
19200
- assert$b(this.pending === null);
19539
+ assert$a(this.pending === null);
19201
19540
 
19202
19541
  return this._digest(enc);
19203
19542
  };
@@ -19370,7 +19709,7 @@ SHA1.prototype._digest = function digest(enc) {
19370
19709
  var utils$e = utils$i;
19371
19710
  var common$2 = common$5;
19372
19711
  var shaCommon = common$4;
19373
- var assert$a = minimalisticAssert;
19712
+ var assert$9 = minimalisticAssert;
19374
19713
 
19375
19714
  var sum32$1 = utils$e.sum32;
19376
19715
  var sum32_4$1 = utils$e.sum32_4;
@@ -19440,7 +19779,7 @@ SHA256$1.prototype._update = function _update(msg, start) {
19440
19779
  var g = this.h[6];
19441
19780
  var h = this.h[7];
19442
19781
 
19443
- assert$a(this.k.length === W.length);
19782
+ assert$9(this.k.length === W.length);
19444
19783
  for (i = 0; i < W.length; i++) {
19445
19784
  var T1 = sum32_5(h, s1_256(e), ch32(e, f, g), this.k[i], W[i]);
19446
19785
  var T2 = sum32$1(s0_256(a), maj32(a, b, c));
@@ -19501,7 +19840,7 @@ SHA224.prototype._digest = function digest(enc) {
19501
19840
 
19502
19841
  var utils$c = utils$i;
19503
19842
  var common$1 = common$5;
19504
- var assert$9 = minimalisticAssert;
19843
+ var assert$8 = minimalisticAssert;
19505
19844
 
19506
19845
  var rotr64_hi = utils$c.rotr64_hi;
19507
19846
  var rotr64_lo = utils$c.rotr64_lo;
@@ -19636,7 +19975,7 @@ SHA512$1.prototype._update = function _update(msg, start) {
19636
19975
  var hh = this.h[14];
19637
19976
  var hl = this.h[15];
19638
19977
 
19639
- assert$9(this.k.length === W.length);
19978
+ assert$8(this.k.length === W.length);
19640
19979
  for (var i = 0; i < W.length; i += 2) {
19641
19980
  var c0_hi = hh;
19642
19981
  var c0_lo = hl;
@@ -20016,7 +20355,7 @@ var sh = [
20016
20355
  ];
20017
20356
 
20018
20357
  var utils$9 = utils$i;
20019
- var assert$8 = minimalisticAssert;
20358
+ var assert$7 = minimalisticAssert;
20020
20359
 
20021
20360
  function Hmac(hash, key, enc) {
20022
20361
  if (!(this instanceof Hmac))
@@ -20035,7 +20374,7 @@ Hmac.prototype._init = function init(key) {
20035
20374
  // Shorten key, if needed
20036
20375
  if (key.length > this.blockSize)
20037
20376
  key = new this.Hash().update(key).digest();
20038
- assert$8(key.length <= this.blockSize);
20377
+ assert$7(key.length <= this.blockSize);
20039
20378
 
20040
20379
  // Add padding to key
20041
20380
  for (var i = key.length; i < this.blockSize; i++)
@@ -21078,7 +21417,7 @@ function requireSecp256k1 () {
21078
21417
 
21079
21418
  var hash$1 = hash$2;
21080
21419
  var utils$8 = utils$n;
21081
- var assert$7 = minimalisticAssert;
21420
+ var assert$6 = minimalisticAssert;
21082
21421
 
21083
21422
  function HmacDRBG$1(options) {
21084
21423
  if (!(this instanceof HmacDRBG$1))
@@ -21097,7 +21436,7 @@ function HmacDRBG$1(options) {
21097
21436
  var entropy = utils$8.toArray(options.entropy, options.entropyEnc || 'hex');
21098
21437
  var nonce = utils$8.toArray(options.nonce, options.nonceEnc || 'hex');
21099
21438
  var pers = utils$8.toArray(options.pers, options.persEnc || 'hex');
21100
- assert$7(entropy.length >= (this.minEntropy / 8),
21439
+ assert$6(entropy.length >= (this.minEntropy / 8),
21101
21440
  'Not enough entropy. Minimum is: ' + this.minEntropy + ' bits');
21102
21441
  this._init(entropy, nonce, pers);
21103
21442
  }
@@ -21152,7 +21491,7 @@ HmacDRBG$1.prototype.reseed = function reseed(entropy, entropyEnc, add, addEnc)
21152
21491
  entropy = utils$8.toArray(entropy, entropyEnc);
21153
21492
  add = utils$8.toArray(add, addEnc);
21154
21493
 
21155
- assert$7(entropy.length >= (this.minEntropy / 8),
21494
+ assert$6(entropy.length >= (this.minEntropy / 8),
21156
21495
  'Not enough entropy. Minimum is: ' + this.minEntropy + ' bits');
21157
21496
 
21158
21497
  this._update(entropy.concat(add || []));
@@ -21190,7 +21529,7 @@ HmacDRBG$1.prototype.generate = function generate(len, enc, add, addEnc) {
21190
21529
 
21191
21530
  var BN$4 = bnExports;
21192
21531
  var utils$7 = utils$o;
21193
- var assert$6 = utils$7.assert;
21532
+ var assert$5 = utils$7.assert;
21194
21533
 
21195
21534
  function KeyPair$3(ec, options) {
21196
21535
  this.ec = ec;
@@ -21275,10 +21614,10 @@ KeyPair$3.prototype._importPublic = function _importPublic(key, enc) {
21275
21614
  // Weierstrass/Edwards points on the other hand have both `x` and
21276
21615
  // `y` coordinates.
21277
21616
  if (this.ec.curve.type === 'mont') {
21278
- assert$6(key.x, 'Need x coordinate');
21617
+ assert$5(key.x, 'Need x coordinate');
21279
21618
  } else if (this.ec.curve.type === 'short' ||
21280
21619
  this.ec.curve.type === 'edwards') {
21281
- assert$6(key.x && key.y, 'Need both x and y coordinate');
21620
+ assert$5(key.x && key.y, 'Need both x and y coordinate');
21282
21621
  }
21283
21622
  this.pub = this.ec.curve.point(key.x, key.y);
21284
21623
  return;
@@ -21289,7 +21628,7 @@ KeyPair$3.prototype._importPublic = function _importPublic(key, enc) {
21289
21628
  // ECDH
21290
21629
  KeyPair$3.prototype.derive = function derive(pub) {
21291
21630
  if(!pub.validate()) {
21292
- assert$6(pub.validate(), 'public point not validated');
21631
+ assert$5(pub.validate(), 'public point not validated');
21293
21632
  }
21294
21633
  return pub.mul(this.priv).getX();
21295
21634
  };
@@ -21311,7 +21650,7 @@ KeyPair$3.prototype.inspect = function inspect() {
21311
21650
  var BN$3 = bnExports;
21312
21651
 
21313
21652
  var utils$6 = utils$o;
21314
- var assert$5 = utils$6.assert;
21653
+ var assert$4 = utils$6.assert;
21315
21654
 
21316
21655
  function Signature$3(options, enc) {
21317
21656
  if (options instanceof Signature$3)
@@ -21320,7 +21659,7 @@ function Signature$3(options, enc) {
21320
21659
  if (this._importDER(options, enc))
21321
21660
  return;
21322
21661
 
21323
- assert$5(options.r && options.s, 'Signature without r or s');
21662
+ assert$4(options.r && options.s, 'Signature without r or s');
21324
21663
  this.r = new BN$3(options.r, 16);
21325
21664
  this.s = new BN$3(options.s, 16);
21326
21665
  if (options.recoveryParam === undefined)
@@ -21478,7 +21817,7 @@ var HmacDRBG = hmacDrbg;
21478
21817
  var utils$5 = utils$o;
21479
21818
  var curves$1 = curves$2;
21480
21819
  var rand = brorandExports;
21481
- var assert$4 = utils$5.assert;
21820
+ var assert$3 = utils$5.assert;
21482
21821
 
21483
21822
  var KeyPair$2 = key$1;
21484
21823
  var Signature$2 = signature$1;
@@ -21489,7 +21828,7 @@ function EC$1(options) {
21489
21828
 
21490
21829
  // Shortcut `elliptic.ec(curve-name)`
21491
21830
  if (typeof options === 'string') {
21492
- assert$4(Object.prototype.hasOwnProperty.call(curves$1, options),
21831
+ assert$3(Object.prototype.hasOwnProperty.call(curves$1, options),
21493
21832
  'Unknown curve ' + options);
21494
21833
 
21495
21834
  options = curves$1[options];
@@ -21667,7 +22006,7 @@ EC$1.prototype.verify = function verify(msg, signature, key, enc) {
21667
22006
  };
21668
22007
 
21669
22008
  EC$1.prototype.recoverPubKey = function(msg, signature, j, enc) {
21670
- assert$4((3 & j) === j, 'The recovery param is more than two bits');
22009
+ assert$3((3 & j) === j, 'The recovery param is more than two bits');
21671
22010
  signature = new Signature$2(signature, enc);
21672
22011
 
21673
22012
  var n = this.n;
@@ -21716,7 +22055,7 @@ EC$1.prototype.getKeyRecoveryParam = function(e, signature, Q, enc) {
21716
22055
  };
21717
22056
 
21718
22057
  var utils$4 = utils$o;
21719
- var assert$3 = utils$4.assert;
22058
+ var assert$2 = utils$4.assert;
21720
22059
  var parseBytes$2 = utils$4.parseBytes;
21721
22060
  var cachedProperty$1 = utils$4.cachedProperty;
21722
22061
 
@@ -21790,7 +22129,7 @@ cachedProperty$1(KeyPair$1, 'messagePrefix', function messagePrefix() {
21790
22129
  });
21791
22130
 
21792
22131
  KeyPair$1.prototype.sign = function sign(message) {
21793
- assert$3(this._secret, 'KeyPair can only verify');
22132
+ assert$2(this._secret, 'KeyPair can only verify');
21794
22133
  return this.eddsa.sign(message, this);
21795
22134
  };
21796
22135
 
@@ -21799,7 +22138,7 @@ KeyPair$1.prototype.verify = function verify(message, sig) {
21799
22138
  };
21800
22139
 
21801
22140
  KeyPair$1.prototype.getSecret = function getSecret(enc) {
21802
- assert$3(this._secret, 'KeyPair is public only');
22141
+ assert$2(this._secret, 'KeyPair is public only');
21803
22142
  return utils$4.encode(this.secret(), enc);
21804
22143
  };
21805
22144
 
@@ -21811,7 +22150,7 @@ var key = KeyPair$1;
21811
22150
 
21812
22151
  var BN$1 = bnExports;
21813
22152
  var utils$3 = utils$o;
21814
- var assert$2 = utils$3.assert;
22153
+ var assert$1 = utils$3.assert;
21815
22154
  var cachedProperty = utils$3.cachedProperty;
21816
22155
  var parseBytes$1 = utils$3.parseBytes;
21817
22156
 
@@ -21836,7 +22175,7 @@ function Signature$1(eddsa, sig) {
21836
22175
  };
21837
22176
  }
21838
22177
 
21839
- assert$2(sig.R && sig.S, 'Signature without R or S');
22178
+ assert$1(sig.R && sig.S, 'Signature without R or S');
21840
22179
 
21841
22180
  if (eddsa.isPoint(sig.R))
21842
22181
  this._R = sig.R;
@@ -21876,13 +22215,13 @@ var signature = Signature$1;
21876
22215
  var hash = hash$2;
21877
22216
  var curves = curves$2;
21878
22217
  var utils$2 = utils$o;
21879
- var assert$1 = utils$2.assert;
22218
+ var assert = utils$2.assert;
21880
22219
  var parseBytes = utils$2.parseBytes;
21881
22220
  var KeyPair = key;
21882
22221
  var Signature = signature;
21883
22222
 
21884
22223
  function EDDSA(curve) {
21885
- assert$1(curve === 'ed25519', 'only tested with ed25519 so far');
22224
+ assert(curve === 'ed25519', 'only tested with ed25519 so far');
21886
22225
 
21887
22226
  if (!(this instanceof EDDSA))
21888
22227
  return new EDDSA(curve);
@@ -22301,447 +22640,110 @@ var elliptic$1 = {
22301
22640
  if (s.cmp(ecparams.n) >= 0) s = new BN(0);
22302
22641
 
22303
22642
  output.set(r.toArrayLike(Uint8Array, 'be', 32), 0);
22304
- output.set(s.toArrayLike(Uint8Array, 'be', 32), 32);
22305
-
22306
- return 0
22307
- },
22308
-
22309
- ecdsaSign (obj, message, seckey, data, noncefn) {
22310
- if (noncefn) {
22311
- const _noncefn = noncefn;
22312
- noncefn = (counter) => {
22313
- const nonce = _noncefn(message, seckey, null, data, counter);
22314
-
22315
- const isValid = nonce instanceof Uint8Array && nonce.length === 32;
22316
- if (!isValid) throw new Error('This is the way')
22317
-
22318
- return new BN(nonce)
22319
- };
22320
- }
22321
-
22322
- const d = new BN(seckey);
22323
- if (d.cmp(ecparams.n) >= 0 || d.isZero()) return 1
22324
-
22325
- let sig;
22326
- try {
22327
- sig = ec.sign(message, seckey, { canonical: true, k: noncefn, pers: data });
22328
- } catch (err) {
22329
- return 1
22330
- }
22331
-
22332
- obj.signature.set(sig.r.toArrayLike(Uint8Array, 'be', 32), 0);
22333
- obj.signature.set(sig.s.toArrayLike(Uint8Array, 'be', 32), 32);
22334
- obj.recid = sig.recoveryParam;
22335
-
22336
- return 0
22337
- },
22338
-
22339
- ecdsaVerify (sig, msg32, pubkey) {
22340
- const sigObj = { r: sig.subarray(0, 32), s: sig.subarray(32, 64) };
22341
-
22342
- const sigr = new BN(sigObj.r);
22343
- const sigs = new BN(sigObj.s);
22344
- if (sigr.cmp(ecparams.n) >= 0 || sigs.cmp(ecparams.n) >= 0) return 1
22345
- if (sigs.cmp(ec.nh) === 1 || sigr.isZero() || sigs.isZero()) return 3
22346
-
22347
- const pair = loadPublicKey(pubkey);
22348
- if (pair === null) return 2
22349
-
22350
- const point = pair.getPublic();
22351
- const isValid = ec.verify(msg32, sigObj, point);
22352
- return isValid ? 0 : 3
22353
- },
22354
-
22355
- ecdsaRecover (output, sig, recid, msg32) {
22356
- const sigObj = { r: sig.slice(0, 32), s: sig.slice(32, 64) };
22357
-
22358
- const sigr = new BN(sigObj.r);
22359
- const sigs = new BN(sigObj.s);
22360
- if (sigr.cmp(ecparams.n) >= 0 || sigs.cmp(ecparams.n) >= 0) return 1
22361
-
22362
- if (sigr.isZero() || sigs.isZero()) return 2
22363
-
22364
- // Can throw `throw new Error('Unable to find sencond key candinate');`
22365
- let point;
22366
- try {
22367
- point = ec.recoverPubKey(msg32, sigObj, recid);
22368
- } catch (err) {
22369
- return 2
22370
- }
22371
-
22372
- savePublicKey(output, point);
22373
-
22374
- return 0
22375
- },
22376
-
22377
- ecdh (output, pubkey, seckey, data, hashfn, xbuf, ybuf) {
22378
- const pair = loadPublicKey(pubkey);
22379
- if (pair === null) return 1
22380
-
22381
- const scalar = new BN(seckey);
22382
- if (scalar.cmp(ecparams.n) >= 0 || scalar.isZero()) return 2
22383
-
22384
- const point = pair.getPublic().mul(scalar);
22385
-
22386
- if (hashfn === undefined) {
22387
- const data = point.encode(null, true);
22388
- const sha256 = ec.hash().update(data).digest();
22389
- for (let i = 0; i < 32; ++i) output[i] = sha256[i];
22390
- } else {
22391
- if (!xbuf) xbuf = new Uint8Array(32);
22392
- const x = point.getX().toArray('be', 32);
22393
- for (let i = 0; i < 32; ++i) xbuf[i] = x[i];
22394
-
22395
- if (!ybuf) ybuf = new Uint8Array(32);
22396
- const y = point.getY().toArray('be', 32);
22397
- for (let i = 0; i < 32; ++i) ybuf[i] = y[i];
22398
-
22399
- const hash = hashfn(xbuf, ybuf, data);
22400
-
22401
- const isValid = hash instanceof Uint8Array && hash.length === output.length;
22402
- if (!isValid) return 2
22403
-
22404
- output.set(hash);
22405
- }
22406
-
22407
- return 0
22408
- }
22409
- };
22410
-
22411
- const errors = {
22412
- IMPOSSIBLE_CASE: 'Impossible case. Please create issue.',
22413
- TWEAK_ADD:
22414
- 'The tweak was out of range or the resulted private key is invalid',
22415
- TWEAK_MUL: 'The tweak was out of range or equal to zero',
22416
- CONTEXT_RANDOMIZE_UNKNOW: 'Unknow error on context randomization',
22417
- SECKEY_INVALID: 'Private Key is invalid',
22418
- PUBKEY_PARSE: 'Public Key could not be parsed',
22419
- PUBKEY_SERIALIZE: 'Public Key serialization error',
22420
- PUBKEY_COMBINE: 'The sum of the public keys is not valid',
22421
- SIG_PARSE: 'Signature could not be parsed',
22422
- SIGN: 'The nonce generation function failed, or the private key was invalid',
22423
- RECOVER: 'Public key could not be recover',
22424
- ECDH: 'Scalar was invalid (zero or overflow)'
22425
- };
22426
-
22427
- function assert (cond, msg) {
22428
- if (!cond) throw new Error(msg)
22429
- }
22430
-
22431
- function isUint8Array (name, value, length) {
22432
- assert(value instanceof Uint8Array, `Expected ${name} to be an Uint8Array`);
22433
-
22434
- if (length !== undefined) {
22435
- if (Array.isArray(length)) {
22436
- const numbers = length.join(', ');
22437
- const msg = `Expected ${name} to be an Uint8Array with length [${numbers}]`;
22438
- assert(length.includes(value.length), msg);
22439
- } else {
22440
- const msg = `Expected ${name} to be an Uint8Array with length ${length}`;
22441
- assert(value.length === length, msg);
22442
- }
22443
- }
22444
- }
22445
-
22446
- function isCompressed (value) {
22447
- assert(toTypeString(value) === 'Boolean', 'Expected compressed to be a Boolean');
22448
- }
22449
-
22450
- function getAssertedOutput (output = (len) => new Uint8Array(len), length) {
22451
- if (typeof output === 'function') output = output(length);
22452
- isUint8Array('output', output, length);
22453
- return output
22454
- }
22455
-
22456
- function toTypeString (value) {
22457
- return Object.prototype.toString.call(value).slice(8, -1)
22458
- }
22459
-
22460
- var lib = (secp256k1) => {
22461
- return {
22462
- contextRandomize (seed) {
22463
- assert(
22464
- seed === null || seed instanceof Uint8Array,
22465
- 'Expected seed to be an Uint8Array or null'
22466
- );
22467
- if (seed !== null) isUint8Array('seed', seed, 32);
22468
-
22469
- switch (secp256k1.contextRandomize(seed)) {
22470
- case 1:
22471
- throw new Error(errors.CONTEXT_RANDOMIZE_UNKNOW)
22472
- }
22473
- },
22474
-
22475
- privateKeyVerify (seckey) {
22476
- isUint8Array('private key', seckey, 32);
22477
-
22478
- return secp256k1.privateKeyVerify(seckey) === 0
22479
- },
22480
-
22481
- privateKeyNegate (seckey) {
22482
- isUint8Array('private key', seckey, 32);
22483
-
22484
- switch (secp256k1.privateKeyNegate(seckey)) {
22485
- case 0:
22486
- return seckey
22487
- case 1:
22488
- throw new Error(errors.IMPOSSIBLE_CASE)
22489
- }
22490
- },
22491
-
22492
- privateKeyTweakAdd (seckey, tweak) {
22493
- isUint8Array('private key', seckey, 32);
22494
- isUint8Array('tweak', tweak, 32);
22495
-
22496
- switch (secp256k1.privateKeyTweakAdd(seckey, tweak)) {
22497
- case 0:
22498
- return seckey
22499
- case 1:
22500
- throw new Error(errors.TWEAK_ADD)
22501
- }
22502
- },
22503
-
22504
- privateKeyTweakMul (seckey, tweak) {
22505
- isUint8Array('private key', seckey, 32);
22506
- isUint8Array('tweak', tweak, 32);
22507
-
22508
- switch (secp256k1.privateKeyTweakMul(seckey, tweak)) {
22509
- case 0:
22510
- return seckey
22511
- case 1:
22512
- throw new Error(errors.TWEAK_MUL)
22513
- }
22514
- },
22515
-
22516
- publicKeyVerify (pubkey) {
22517
- isUint8Array('public key', pubkey, [33, 65]);
22518
-
22519
- return secp256k1.publicKeyVerify(pubkey) === 0
22520
- },
22521
-
22522
- publicKeyCreate (seckey, compressed = true, output) {
22523
- isUint8Array('private key', seckey, 32);
22524
- isCompressed(compressed);
22525
- output = getAssertedOutput(output, compressed ? 33 : 65);
22526
-
22527
- switch (secp256k1.publicKeyCreate(output, seckey)) {
22528
- case 0:
22529
- return output
22530
- case 1:
22531
- throw new Error(errors.SECKEY_INVALID)
22532
- case 2:
22533
- throw new Error(errors.PUBKEY_SERIALIZE)
22534
- }
22535
- },
22643
+ output.set(s.toArrayLike(Uint8Array, 'be', 32), 32);
22536
22644
 
22537
- publicKeyConvert (pubkey, compressed = true, output) {
22538
- isUint8Array('public key', pubkey, [33, 65]);
22539
- isCompressed(compressed);
22540
- output = getAssertedOutput(output, compressed ? 33 : 65);
22645
+ return 0
22646
+ },
22541
22647
 
22542
- switch (secp256k1.publicKeyConvert(output, pubkey)) {
22543
- case 0:
22544
- return output
22545
- case 1:
22546
- throw new Error(errors.PUBKEY_PARSE)
22547
- case 2:
22548
- throw new Error(errors.PUBKEY_SERIALIZE)
22549
- }
22550
- },
22648
+ ecdsaSign (obj, message, seckey, data, noncefn) {
22649
+ if (noncefn) {
22650
+ const _noncefn = noncefn;
22651
+ noncefn = (counter) => {
22652
+ const nonce = _noncefn(message, seckey, null, data, counter);
22551
22653
 
22552
- publicKeyNegate (pubkey, compressed = true, output) {
22553
- isUint8Array('public key', pubkey, [33, 65]);
22554
- isCompressed(compressed);
22555
- output = getAssertedOutput(output, compressed ? 33 : 65);
22654
+ const isValid = nonce instanceof Uint8Array && nonce.length === 32;
22655
+ if (!isValid) throw new Error('This is the way')
22556
22656
 
22557
- switch (secp256k1.publicKeyNegate(output, pubkey)) {
22558
- case 0:
22559
- return output
22560
- case 1:
22561
- throw new Error(errors.PUBKEY_PARSE)
22562
- case 2:
22563
- throw new Error(errors.IMPOSSIBLE_CASE)
22564
- case 3:
22565
- throw new Error(errors.PUBKEY_SERIALIZE)
22566
- }
22567
- },
22657
+ return new BN(nonce)
22658
+ };
22659
+ }
22568
22660
 
22569
- publicKeyCombine (pubkeys, compressed = true, output) {
22570
- assert(Array.isArray(pubkeys), 'Expected public keys to be an Array');
22571
- assert(pubkeys.length > 0, 'Expected public keys array will have more than zero items');
22572
- for (const pubkey of pubkeys) {
22573
- isUint8Array('public key', pubkey, [33, 65]);
22574
- }
22575
- isCompressed(compressed);
22576
- output = getAssertedOutput(output, compressed ? 33 : 65);
22661
+ const d = new BN(seckey);
22662
+ if (d.cmp(ecparams.n) >= 0 || d.isZero()) return 1
22577
22663
 
22578
- switch (secp256k1.publicKeyCombine(output, pubkeys)) {
22579
- case 0:
22580
- return output
22581
- case 1:
22582
- throw new Error(errors.PUBKEY_PARSE)
22583
- case 2:
22584
- throw new Error(errors.PUBKEY_COMBINE)
22585
- case 3:
22586
- throw new Error(errors.PUBKEY_SERIALIZE)
22587
- }
22588
- },
22664
+ let sig;
22665
+ try {
22666
+ sig = ec.sign(message, seckey, { canonical: true, k: noncefn, pers: data });
22667
+ } catch (err) {
22668
+ return 1
22669
+ }
22589
22670
 
22590
- publicKeyTweakAdd (pubkey, tweak, compressed = true, output) {
22591
- isUint8Array('public key', pubkey, [33, 65]);
22592
- isUint8Array('tweak', tweak, 32);
22593
- isCompressed(compressed);
22594
- output = getAssertedOutput(output, compressed ? 33 : 65);
22671
+ obj.signature.set(sig.r.toArrayLike(Uint8Array, 'be', 32), 0);
22672
+ obj.signature.set(sig.s.toArrayLike(Uint8Array, 'be', 32), 32);
22673
+ obj.recid = sig.recoveryParam;
22595
22674
 
22596
- switch (secp256k1.publicKeyTweakAdd(output, pubkey, tweak)) {
22597
- case 0:
22598
- return output
22599
- case 1:
22600
- throw new Error(errors.PUBKEY_PARSE)
22601
- case 2:
22602
- throw new Error(errors.TWEAK_ADD)
22603
- }
22604
- },
22675
+ return 0
22676
+ },
22605
22677
 
22606
- publicKeyTweakMul (pubkey, tweak, compressed = true, output) {
22607
- isUint8Array('public key', pubkey, [33, 65]);
22608
- isUint8Array('tweak', tweak, 32);
22609
- isCompressed(compressed);
22610
- output = getAssertedOutput(output, compressed ? 33 : 65);
22678
+ ecdsaVerify (sig, msg32, pubkey) {
22679
+ const sigObj = { r: sig.subarray(0, 32), s: sig.subarray(32, 64) };
22611
22680
 
22612
- switch (secp256k1.publicKeyTweakMul(output, pubkey, tweak)) {
22613
- case 0:
22614
- return output
22615
- case 1:
22616
- throw new Error(errors.PUBKEY_PARSE)
22617
- case 2:
22618
- throw new Error(errors.TWEAK_MUL)
22619
- }
22620
- },
22681
+ const sigr = new BN(sigObj.r);
22682
+ const sigs = new BN(sigObj.s);
22683
+ if (sigr.cmp(ecparams.n) >= 0 || sigs.cmp(ecparams.n) >= 0) return 1
22684
+ if (sigs.cmp(ec.nh) === 1 || sigr.isZero() || sigs.isZero()) return 3
22621
22685
 
22622
- signatureNormalize (sig) {
22623
- isUint8Array('signature', sig, 64);
22686
+ const pair = loadPublicKey(pubkey);
22687
+ if (pair === null) return 2
22624
22688
 
22625
- switch (secp256k1.signatureNormalize(sig)) {
22626
- case 0:
22627
- return sig
22628
- case 1:
22629
- throw new Error(errors.SIG_PARSE)
22630
- }
22631
- },
22689
+ const point = pair.getPublic();
22690
+ const isValid = ec.verify(msg32, sigObj, point);
22691
+ return isValid ? 0 : 3
22692
+ },
22632
22693
 
22633
- signatureExport (sig, output) {
22634
- isUint8Array('signature', sig, 64);
22635
- output = getAssertedOutput(output, 72);
22694
+ ecdsaRecover (output, sig, recid, msg32) {
22695
+ const sigObj = { r: sig.slice(0, 32), s: sig.slice(32, 64) };
22636
22696
 
22637
- const obj = { output, outputlen: 72 };
22638
- switch (secp256k1.signatureExport(obj, sig)) {
22639
- case 0:
22640
- return output.slice(0, obj.outputlen)
22641
- case 1:
22642
- throw new Error(errors.SIG_PARSE)
22643
- case 2:
22644
- throw new Error(errors.IMPOSSIBLE_CASE)
22645
- }
22646
- },
22697
+ const sigr = new BN(sigObj.r);
22698
+ const sigs = new BN(sigObj.s);
22699
+ if (sigr.cmp(ecparams.n) >= 0 || sigs.cmp(ecparams.n) >= 0) return 1
22647
22700
 
22648
- signatureImport (sig, output) {
22649
- isUint8Array('signature', sig);
22650
- output = getAssertedOutput(output, 64);
22701
+ if (sigr.isZero() || sigs.isZero()) return 2
22651
22702
 
22652
- switch (secp256k1.signatureImport(output, sig)) {
22653
- case 0:
22654
- return output
22655
- case 1:
22656
- throw new Error(errors.SIG_PARSE)
22657
- case 2:
22658
- throw new Error(errors.IMPOSSIBLE_CASE)
22659
- }
22660
- },
22703
+ // Can throw `throw new Error('Unable to find sencond key candinate');`
22704
+ let point;
22705
+ try {
22706
+ point = ec.recoverPubKey(msg32, sigObj, recid);
22707
+ } catch (err) {
22708
+ return 2
22709
+ }
22661
22710
 
22662
- ecdsaSign (msg32, seckey, options = {}, output) {
22663
- isUint8Array('message', msg32, 32);
22664
- isUint8Array('private key', seckey, 32);
22665
- assert(toTypeString(options) === 'Object', 'Expected options to be an Object');
22666
- if (options.data !== undefined) isUint8Array('options.data', options.data);
22667
- if (options.noncefn !== undefined) assert(toTypeString(options.noncefn) === 'Function', 'Expected options.noncefn to be a Function');
22668
- output = getAssertedOutput(output, 64);
22711
+ savePublicKey(output, point);
22669
22712
 
22670
- const obj = { signature: output, recid: null };
22671
- switch (secp256k1.ecdsaSign(obj, msg32, seckey, options.data, options.noncefn)) {
22672
- case 0:
22673
- return obj
22674
- case 1:
22675
- throw new Error(errors.SIGN)
22676
- case 2:
22677
- throw new Error(errors.IMPOSSIBLE_CASE)
22678
- }
22679
- },
22713
+ return 0
22714
+ },
22680
22715
 
22681
- ecdsaVerify (sig, msg32, pubkey) {
22682
- isUint8Array('signature', sig, 64);
22683
- isUint8Array('message', msg32, 32);
22684
- isUint8Array('public key', pubkey, [33, 65]);
22716
+ ecdh (output, pubkey, seckey, data, hashfn, xbuf, ybuf) {
22717
+ const pair = loadPublicKey(pubkey);
22718
+ if (pair === null) return 1
22685
22719
 
22686
- switch (secp256k1.ecdsaVerify(sig, msg32, pubkey)) {
22687
- case 0:
22688
- return true
22689
- case 3:
22690
- return false
22691
- case 1:
22692
- throw new Error(errors.SIG_PARSE)
22693
- case 2:
22694
- throw new Error(errors.PUBKEY_PARSE)
22695
- }
22696
- },
22720
+ const scalar = new BN(seckey);
22721
+ if (scalar.cmp(ecparams.n) >= 0 || scalar.isZero()) return 2
22697
22722
 
22698
- ecdsaRecover (sig, recid, msg32, compressed = true, output) {
22699
- isUint8Array('signature', sig, 64);
22700
- assert(
22701
- toTypeString(recid) === 'Number' &&
22702
- recid >= 0 &&
22703
- recid <= 3,
22704
- 'Expected recovery id to be a Number within interval [0, 3]'
22705
- );
22706
- isUint8Array('message', msg32, 32);
22707
- isCompressed(compressed);
22708
- output = getAssertedOutput(output, compressed ? 33 : 65);
22723
+ const point = pair.getPublic().mul(scalar);
22709
22724
 
22710
- switch (secp256k1.ecdsaRecover(output, sig, recid, msg32)) {
22711
- case 0:
22712
- return output
22713
- case 1:
22714
- throw new Error(errors.SIG_PARSE)
22715
- case 2:
22716
- throw new Error(errors.RECOVER)
22717
- case 3:
22718
- throw new Error(errors.IMPOSSIBLE_CASE)
22719
- }
22720
- },
22725
+ if (hashfn === undefined) {
22726
+ const data = point.encode(null, true);
22727
+ const sha256 = ec.hash().update(data).digest();
22728
+ for (let i = 0; i < 32; ++i) output[i] = sha256[i];
22729
+ } else {
22730
+ if (!xbuf) xbuf = new Uint8Array(32);
22731
+ const x = point.getX().toArray('be', 32);
22732
+ for (let i = 0; i < 32; ++i) xbuf[i] = x[i];
22721
22733
 
22722
- ecdh (pubkey, seckey, options = {}, output) {
22723
- isUint8Array('public key', pubkey, [33, 65]);
22724
- isUint8Array('private key', seckey, 32);
22725
- assert(toTypeString(options) === 'Object', 'Expected options to be an Object');
22726
- if (options.data !== undefined) isUint8Array('options.data', options.data);
22727
- if (options.hashfn !== undefined) {
22728
- assert(toTypeString(options.hashfn) === 'Function', 'Expected options.hashfn to be a Function');
22729
- if (options.xbuf !== undefined) isUint8Array('options.xbuf', options.xbuf, 32);
22730
- if (options.ybuf !== undefined) isUint8Array('options.ybuf', options.ybuf, 32);
22731
- isUint8Array('output', output);
22732
- } else {
22733
- output = getAssertedOutput(output, 32);
22734
- }
22734
+ if (!ybuf) ybuf = new Uint8Array(32);
22735
+ const y = point.getY().toArray('be', 32);
22736
+ for (let i = 0; i < 32; ++i) ybuf[i] = y[i];
22735
22737
 
22736
- switch (secp256k1.ecdh(output, pubkey, seckey, options.data, options.hashfn, options.xbuf, options.ybuf)) {
22737
- case 0:
22738
- return output
22739
- case 1:
22740
- throw new Error(errors.PUBKEY_PARSE)
22741
- case 2:
22742
- throw new Error(errors.ECDH)
22743
- }
22738
+ const hash = hashfn(xbuf, ybuf, data);
22739
+
22740
+ const isValid = hash instanceof Uint8Array && hash.length === output.length;
22741
+ if (!isValid) return 2
22742
+
22743
+ output.set(hash);
22744
22744
  }
22745
+
22746
+ return 0
22745
22747
  }
22746
22748
  };
22747
22749
 
@@ -24222,7 +24224,7 @@ b||"returnDetailedScanResult"in b)?(m=b.scanRegion,c=b.qrEngine,d=b.canvas,f=b.d
24222
24224
  [d,k]=e._drawToCanvas(p,m,d,f);let q;if(c instanceof Worker){let g=c;b||e._postWorkerMessageSync(g,"inversionMode","both");q=await new Promise((l,v)=>{let w,u,r,y=-1;u=t=>{t.data.id===y&&(g.removeEventListener("message",u),g.removeEventListener("error",r),clearTimeout(w),null!==t.data.data?l({data:t.data.data,cornerPoints:e._convertPoints(t.data.cornerPoints,m)}):v(e.NO_QR_CODE_FOUND));};r=t=>{g.removeEventListener("message",u);g.removeEventListener("error",r);clearTimeout(w);v("Scanner error: "+(t?
24223
24225
  t.message||t:"Unknown Error"));};g.addEventListener("message",u);g.addEventListener("error",r);w=setTimeout(()=>r("timeout"),1E4);let x=k.getImageData(0,0,d.width,d.height);y=e._postWorkerMessageSync(g,"decode",x,[x.data.buffer]);});}else q=await Promise.race([new Promise((g,l)=>window.setTimeout(()=>l("Scanner error: timeout"),1E4)),(async()=>{try{var [g]=await c.detect(d);if(!g)throw e.NO_QR_CODE_FOUND;return {data:g.rawValue,cornerPoints:e._convertPoints(g.cornerPoints,m)}}catch(l){g=l.message||l;
24224
24226
  if(/not implemented|service unavailable/.test(g))return e._disableBarcodeDetector=!0,e.scanImage(a,{scanRegion:m,canvas:d,disallowCanvasResizing:f,alsoTryWithoutScanRegion:h});throw `Scanner error: ${g}`;}})()]);return n?q:q.data}catch(p){if(!m||!h)throw p;let k=await e.scanImage(a,{qrEngine:c,canvas:d,disallowCanvasResizing:f});return n?k:k.data}finally{b||e._postWorkerMessage(c,"close");}}setGrayscaleWeights(a,b,c,d=!0){e._postWorkerMessage(this._qrEnginePromise,"grayscaleWeights",{red:a,green:b,
24225
- blue:c,useIntegerApproximation:d});}setInversionMode(a){e._postWorkerMessage(this._qrEnginePromise,"inversionMode",a);}static async createQrEngine(a){a&&console.warn("Specifying a worker path is not required and not supported anymore.");a=()=>import('./qr-scanner-worker.min-RaSiJc_R-RaSiJc_R.js').then(c=>c.createWorker());if(!(!e._disableBarcodeDetector&&"BarcodeDetector"in window&&BarcodeDetector.getSupportedFormats&&(await BarcodeDetector.getSupportedFormats()).includes("qr_code")))return a();let b=navigator.userAgentData;
24227
+ blue:c,useIntegerApproximation:d});}setInversionMode(a){e._postWorkerMessage(this._qrEnginePromise,"inversionMode",a);}static async createQrEngine(a){a&&console.warn("Specifying a worker path is not required and not supported anymore.");a=()=>import('./qr-scanner-worker.min-RaSiJc_R-Dy0qkKA4.js').then(c=>c.createWorker());if(!(!e._disableBarcodeDetector&&"BarcodeDetector"in window&&BarcodeDetector.getSupportedFormats&&(await BarcodeDetector.getSupportedFormats()).includes("qr_code")))return a();let b=navigator.userAgentData;
24226
24228
  return b&&b.brands.some(({brand:c})=>/Chromium/i.test(c))&&/mac ?OS/i.test(b.platform)&&await b.getHighEntropyValues(["architecture","platformVersion"]).then(({architecture:c,platformVersion:d})=>/arm/i.test(c||"arm")&&13<=parseInt(d||"13")).catch(()=>!0)?a():new BarcodeDetector({formats:["qr_code"]})}_onPlay(){this._scanRegion=this._calculateScanRegion(this.$video);this._updateOverlay();this.$overlay&&(this.$overlay.style.display="");this._scanFrame();}_onLoadedMetaData(){this._scanRegion=this._calculateScanRegion(this.$video);
24227
24229
  this._updateOverlay();}_onVisibilityChange(){document.hidden?this.pause():this._active&&this.start();}_calculateScanRegion(a){let b=Math.round(2/3*Math.min(a.videoWidth,a.videoHeight));return {x:Math.round((a.videoWidth-b)/2),y:Math.round((a.videoHeight-b)/2),width:b,height:b,downScaledWidth:this._legacyCanvasSize,downScaledHeight:this._legacyCanvasSize}}_updateOverlay(){requestAnimationFrame(()=>{if(this.$overlay){var a=this.$video,b=a.videoWidth,c=a.videoHeight,d=a.offsetWidth,f=a.offsetHeight,h=a.offsetLeft,
24228
24230
  m=a.offsetTop,n=window.getComputedStyle(a),p=n.objectFit,k=b/c,q=d/f;switch(p){case "none":var g=b;var l=c;break;case "fill":g=d;l=f;break;default:("cover"===p?k>q:k<q)?(l=f,g=l*k):(g=d,l=g/k),"scale-down"===p&&(g=Math.min(g,b),l=Math.min(l,c));}var [v,w]=n.objectPosition.split(" ").map((r,y)=>{const x=parseFloat(r);return r.endsWith("%")?(y?f-l:d-g)*x/100:x});n=this._scanRegion.width||b;q=this._scanRegion.height||c;p=this._scanRegion.x||0;var u=this._scanRegion.y||0;k=this.$overlay.style;k.width=
@@ -27185,7 +27187,7 @@ class Identity {
27185
27187
  }
27186
27188
  if (!password) {
27187
27189
  // @ts-ignore
27188
- const importee = await import('./password-JCRBtU5A.js');
27190
+ const importee = await import('./password-oDixGC8h.js');
27189
27191
  password = await importee.default();
27190
27192
  }
27191
27193
  const accountExists = await globalThis.accountStore.has('public');
@@ -27196,7 +27198,7 @@ class Identity {
27196
27198
  this.selectedAccount = new TextDecoder().decode(selected);
27197
27199
  }
27198
27200
  else {
27199
- const importee = await import(/* webpackChunkName: "generate-account" */ './index-ub31QSed-EMPr2oeb.js');
27201
+ const importee = await import(/* webpackChunkName: "generate-account" */ './index-G74WLzL7-Dt2dwaXq.js');
27200
27202
  const { identity, accounts } = await importee.default(password, this.network);
27201
27203
  await globalThis.accountStore.put('public', JSON.stringify({ walletId: identity.walletId }));
27202
27204
  await globalThis.walletStore.put('version', String(1));
@@ -27388,7 +27390,7 @@ class Peernet {
27388
27390
  this.root = options.root;
27389
27391
  const { RequestMessage, ResponseMessage, PeerMessage, PeerMessageResponse, PeernetMessage, DHTMessage, DHTMessageResponse, DataMessage, DataMessageResponse, PsMessage, ChatMessage, PeernetFile
27390
27392
  // FolderMessageResponse
27391
- } = await import(/* webpackChunkName: "messages" */ './messages-guyZfse6-JeAlT5Nb.js');
27393
+ } = await import(/* webpackChunkName: "messages" */ './messages-lWRTai7t-ClhClfC1.js');
27392
27394
  /**
27393
27395
  * proto Object containing protos
27394
27396
  * @type {Object}
@@ -27482,7 +27484,7 @@ class Peernet {
27482
27484
  if (this.#starting || this.#started)
27483
27485
  return;
27484
27486
  this.#starting = true;
27485
- const importee = await import('./client-UOCjJBGl-pbv-pTHd.js');
27487
+ const importee = await import('./client-A009z8av-DQfd3vOY.js');
27486
27488
  /**
27487
27489
  * @access public
27488
27490
  * @type {PeernetClient}