@leofcoin/chain 1.10.15 → 1.10.17

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 (38) hide show
  1. package/exports/beacon-envelope.js +6 -6
  2. package/exports/beacon-epoch.js +1 -1
  3. package/exports/beacon-lifecycle.js +1 -1
  4. package/exports/beacon-round.js +1 -1
  5. package/exports/beacon.js +15 -14
  6. package/exports/browser/_commonjsHelpers-B85MJLTf.js +5 -0
  7. package/exports/browser/beacon-envelope.js +61 -150
  8. package/exports/browser/beacon-epoch.js +2 -2
  9. package/exports/browser/beacon-lifecycle.js +3 -3
  10. package/exports/browser/beacon-round.js +2 -2
  11. package/exports/browser/beacon-wire.js +3 -3
  12. package/exports/browser/beacon.js +2483 -1228
  13. package/exports/browser/{browser-DvU1xNFS-DmmNUdE-.js → browser-CCfR9KOM-CpStHgTj.js} +4 -4
  14. package/exports/browser/{browser-crypto-B9N9KlL4.js → browser-crypto-CH0ua22L.js} +284 -159
  15. package/exports/browser/chain.js +30 -16
  16. package/exports/browser/{client-DDC8C510-3uaB70KL.js → client-C_pBoi1g-_pfKzCvX.js} +256 -80
  17. package/exports/browser/{connection-monitor-GPztgSSJ.js → connection-monitor-D-krNiRH.js} +4 -4
  18. package/exports/browser/{hkdf-CnZvwpZ9.js → hkdf-BUHINPFj.js} +2 -94
  19. package/exports/browser/{index-Ccn5sExe.js → index-DmuI-29u.js} +55 -52
  20. package/exports/browser/{index-Bxr5Iztg-WbFIosyf.js → index-dTQVgkpf-BbdshWB0.js} +4 -4
  21. package/exports/browser/index.browser-CFfJpgKV.js +857 -0
  22. package/exports/browser/{messages-DH0tgNM9-C2CtyLsf.js → messages-BGHaihSi-eHZVl0y9.js} +10 -5
  23. package/exports/browser/{node-browser-BYi7D_oa.js → node-browser-BNe-en1l.js} +950 -482
  24. package/exports/browser/node-browser.js +4 -4
  25. package/exports/browser/{sha2-piimb6xL.js → sha2-BKcEJzgd.js} +144 -3
  26. package/exports/browser/weierstrass-BVfhtHbl.js +3596 -0
  27. package/exports/browser/workers/block-worker.js +5 -3
  28. package/exports/browser/workers/machine-worker.js +50 -22
  29. package/exports/{workers/worker-DMCj1e6z-CTYVa2yX.js → browser/workers/worker-BDTWOCzS-COrAszCt.js} +304 -168
  30. package/exports/chain.js +10 -5
  31. package/exports/{constants-CMYKv-Rt.js → constants-Dy9i9S_o.js} +1 -1
  32. package/exports/hash-format-state.js +17 -0
  33. package/exports/node.js +1 -1
  34. package/exports/workers/block-worker.js +5 -3
  35. package/exports/workers/machine-worker.js +50 -22
  36. package/exports/{browser/workers/worker-DMCj1e6z-CTYVa2yX.js → workers/worker-BDTWOCzS-COrAszCt.js} +304 -168
  37. package/package.json +14 -13
  38. package/exports/browser/weierstrass-Q0QND1ZT.js +0 -2156
@@ -1,4 +1,4 @@
1
- import { F as FormatInterface, o as proto$2, q as proto$3, i as index, f as index$1, r as proto$4 } from './browser-crypto-B9N9KlL4.js';
1
+ import { F as FormatInterface, o as proto$2, q as proto$3, r as encodeFrames, s as decodeFrames, t as proto$4 } from './browser-crypto-CH0ua22L.js';
2
2
 
3
3
  class ValidatorMessage extends FormatInterface {
4
4
  get messageName() {
@@ -33,13 +33,13 @@ class BlockMessage extends FormatInterface {
33
33
  }
34
34
  return super.encode({
35
35
  ...decoded,
36
- validators: index(validators)
36
+ validators: encodeFrames(validators)
37
37
  });
38
38
  }
39
39
  decode(encoded) {
40
40
  encoded = encoded || this.encoded;
41
41
  super.decode(encoded);
42
- this.decoded.validators = index$1(this.decoded.validators).map((validator) => new ValidatorMessage(validator).decoded);
42
+ this.decoded.validators = decodeFrames(this.decoded.validators, 0, { canonical: false }).map((validator) => new ValidatorMessage(validator).decoded);
43
43
  return this.decoded;
44
44
  }
45
45
  }
@@ -118,7 +118,7 @@ var networks$1 = /*#__PURE__*/Object.freeze({
118
118
  default: networks
119
119
  });
120
120
 
121
- const PROTOCOL_VERSION = "0.3.0";
121
+ const PROTOCOL_VERSION = "0.4.0";
122
122
  const REACHED_ONE_ZERO_ZERO = false;
123
123
  const DEFAULT_NODE_OPTIONS = {
124
124
  autoStart: false,
@@ -1,97 +1,5 @@
1
- import { a as ahash, b as abytes, c as clean, d as aexists, e as aoutput, f as anumber } from './sha2-piimb6xL.js';
2
-
3
- /**
4
- * HMAC: RFC2104 message authentication code.
5
- * @module
6
- */
7
- /**
8
- * Internal class for HMAC.
9
- * Accepts any byte key, although RFC 2104 §3 recommends keys at least
10
- * `HashLen` bytes long.
11
- */
12
- class _HMAC {
13
- oHash;
14
- iHash;
15
- blockLen;
16
- outputLen;
17
- canXOF = false;
18
- finished = false;
19
- destroyed = false;
20
- constructor(hash, key) {
21
- ahash(hash);
22
- abytes(key, undefined, 'key');
23
- this.iHash = hash.create();
24
- if (typeof this.iHash.update !== 'function')
25
- throw new Error('expected Hash instance');
26
- this.blockLen = this.iHash.blockLen;
27
- this.outputLen = this.iHash.outputLen;
28
- const blockLen = this.blockLen;
29
- const pad = new Uint8Array(blockLen);
30
- // blockLen can be bigger than outputLen
31
- pad.set(key.length > blockLen ? hash.create().update(key).digest() : key);
32
- for (let i = 0; i < pad.length; i++)
33
- pad[i] ^= 0x36;
34
- this.iHash.update(pad);
35
- // By doing update (processing of the first block) of the outer hash here,
36
- // we can re-use it between multiple calls via clone.
37
- this.oHash = hash.create();
38
- // Undo internal XOR && apply outer XOR
39
- for (let i = 0; i < pad.length; i++)
40
- pad[i] ^= 0x36 ^ 0x5c;
41
- this.oHash.update(pad);
42
- clean(pad);
43
- }
44
- update(buf) {
45
- aexists(this);
46
- this.iHash.update(buf);
47
- return this;
48
- }
49
- digestInto(out) {
50
- aexists(this);
51
- aoutput(out, this);
52
- this.finished = true;
53
- const buf = out.subarray(0, this.outputLen);
54
- // Reuse the first outputLen bytes for the inner digest; the outer hash consumes them before
55
- // overwriting that same prefix with the final tag, leaving any oversized tail untouched.
56
- this.iHash.digestInto(buf);
57
- this.oHash.update(buf);
58
- this.oHash.digestInto(buf);
59
- this.destroy();
60
- }
61
- digest() {
62
- const out = new Uint8Array(this.oHash.outputLen);
63
- this.digestInto(out);
64
- return out;
65
- }
66
- _cloneInto(to) {
67
- // Create new instance without calling constructor since the key
68
- // is already in state and we don't know it.
69
- to ||= Object.create(Object.getPrototypeOf(this), {});
70
- const { oHash, iHash, finished, destroyed, blockLen, outputLen, canXOF } = this;
71
- to = to;
72
- to.finished = finished;
73
- to.destroyed = destroyed;
74
- to.blockLen = blockLen;
75
- to.outputLen = outputLen;
76
- to.canXOF = canXOF;
77
- to.oHash = oHash._cloneInto(to.oHash);
78
- to.iHash = iHash._cloneInto(to.iHash);
79
- return to;
80
- }
81
- clone() {
82
- return this._cloneInto();
83
- }
84
- destroy() {
85
- this.destroyed = true;
86
- this.oHash.destroy();
87
- this.iHash.destroy();
88
- }
89
- }
90
- const hmac = /* @__PURE__ */ (() => {
91
- const hmac_ = ((hash, key, message) => new _HMAC(hash, key).update(message).digest());
92
- hmac_.create = (hash, key) => new _HMAC(hash, key);
93
- return hmac_;
94
- })();
1
+ import { h as hmac } from './weierstrass-BVfhtHbl.js';
2
+ import { a as ahash, b as anumber, c as abytes, d as clean } from './sha2-BKcEJzgd.js';
95
3
 
96
4
  /**
97
5
  * HKDF (RFC 5869): extract + expand in one step.