@gardenfi/utils 2.0.6-beta.4 → 2.0.6-beta.6

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 (201) hide show
  1. package/dist/index100.cjs +1 -1
  2. package/dist/index100.js +35 -2
  3. package/dist/index101.cjs +1 -1
  4. package/dist/index101.js +41 -5
  5. package/dist/index102.cjs +1 -1
  6. package/dist/index102.js +643 -10
  7. package/dist/index103.cjs +1 -1
  8. package/dist/index103.js +227 -16
  9. package/dist/index104.cjs +1 -1
  10. package/dist/index104.js +172 -6
  11. package/dist/index105.cjs +1 -1
  12. package/dist/index105.js +9 -5
  13. package/dist/index106.cjs +1 -1
  14. package/dist/index106.js +9 -34
  15. package/dist/index107.cjs +2 -1
  16. package/dist/index107.js +3 -128
  17. package/dist/index108.cjs +1 -2
  18. package/dist/index108.js +128 -3
  19. package/dist/index109.cjs +1 -1
  20. package/dist/index109.js +19 -2
  21. package/dist/index110.cjs +1 -1
  22. package/dist/index110.js +2 -68
  23. package/dist/index111.cjs +1 -1
  24. package/dist/index111.js +2 -70
  25. package/dist/index112.cjs +1 -1
  26. package/dist/index112.js +38 -2
  27. package/dist/index113.cjs +1 -1
  28. package/dist/index113.js +34 -30
  29. package/dist/index114.cjs +1 -1
  30. package/dist/index114.js +5 -41
  31. package/dist/index115.cjs +1 -1
  32. package/dist/index115.js +10 -643
  33. package/dist/index116.cjs +1 -1
  34. package/dist/index116.js +16 -227
  35. package/dist/index117.cjs +1 -1
  36. package/dist/index117.js +6 -172
  37. package/dist/index118.cjs +1 -1
  38. package/dist/index118.js +5 -19
  39. package/dist/index18.cjs +1 -1
  40. package/dist/index18.js +11 -11
  41. package/dist/index19.cjs +1 -1
  42. package/dist/index19.js +9 -9
  43. package/dist/index20.cjs +1 -1
  44. package/dist/index20.js +1 -1
  45. package/dist/index21.cjs +1 -1
  46. package/dist/index21.js +1 -1
  47. package/dist/index22.cjs +1 -1
  48. package/dist/index22.js +1 -1
  49. package/dist/index23.cjs +1 -1
  50. package/dist/index23.js +41 -17
  51. package/dist/index24.cjs +1 -1
  52. package/dist/index24.js +44 -6
  53. package/dist/index25.cjs +1 -1
  54. package/dist/index25.js +24 -44
  55. package/dist/index26.cjs +1 -1
  56. package/dist/index26.js +6 -21
  57. package/dist/index27.cjs +1 -1
  58. package/dist/index27.js +13 -8
  59. package/dist/index28.cjs +1 -1
  60. package/dist/index28.js +15 -31
  61. package/dist/index29.cjs +1 -1
  62. package/dist/index29.js +5 -26
  63. package/dist/index30.cjs +1 -2
  64. package/dist/index30.js +13 -65
  65. package/dist/index31.cjs +1 -1
  66. package/dist/index31.js +10 -51
  67. package/dist/index32.cjs +1 -1
  68. package/dist/index32.js +12 -12
  69. package/dist/index33.cjs +1 -1
  70. package/dist/index33.js +11 -24
  71. package/dist/index34.cjs +1 -1
  72. package/dist/index34.js +13 -75
  73. package/dist/index35.cjs +1 -1
  74. package/dist/index35.js +2 -2
  75. package/dist/index36.cjs +1 -1
  76. package/dist/index36.js +55 -7
  77. package/dist/index37.cjs +1 -1
  78. package/dist/index37.js +16 -32
  79. package/dist/index38.cjs +1 -1
  80. package/dist/index38.js +5 -15
  81. package/dist/index39.cjs +1 -1
  82. package/dist/index39.js +9 -2
  83. package/dist/index40.cjs +1 -1
  84. package/dist/index40.js +171 -8
  85. package/dist/index41.cjs +1 -1
  86. package/dist/index41.js +102 -19
  87. package/dist/index42.cjs +1 -1
  88. package/dist/index42.js +21 -41
  89. package/dist/index43.cjs +1 -1
  90. package/dist/index43.js +17 -25
  91. package/dist/index44.cjs +1 -1
  92. package/dist/index44.js +7 -6
  93. package/dist/index45.cjs +1 -1
  94. package/dist/index45.js +20 -12
  95. package/dist/index46.cjs +1 -1
  96. package/dist/index46.js +8 -15
  97. package/dist/index47.cjs +1 -1
  98. package/dist/index47.js +31 -5
  99. package/dist/index48.cjs +1 -1
  100. package/dist/index48.js +26 -13
  101. package/dist/index49.cjs +2 -1
  102. package/dist/index49.js +65 -10
  103. package/dist/index50.cjs +1 -1
  104. package/dist/index50.js +51 -12
  105. package/dist/index51.cjs +1 -1
  106. package/dist/index51.js +12 -11
  107. package/dist/index52.cjs +1 -1
  108. package/dist/index52.js +24 -13
  109. package/dist/index53.cjs +1 -1
  110. package/dist/index53.js +75 -55
  111. package/dist/index54.cjs +1 -1
  112. package/dist/index54.js +7 -16
  113. package/dist/index55.cjs +1 -1
  114. package/dist/index55.js +32 -5
  115. package/dist/index56.cjs +1 -1
  116. package/dist/index56.js +15 -8
  117. package/dist/index57.cjs +1 -1
  118. package/dist/index57.js +2 -172
  119. package/dist/index58.cjs +1 -1
  120. package/dist/index58.js +7 -102
  121. package/dist/index59.cjs +1 -1
  122. package/dist/index59.js +20 -21
  123. package/dist/index60.cjs +1 -1
  124. package/dist/index60.js +110 -10
  125. package/dist/index61.cjs +1 -1
  126. package/dist/index61.js +15 -33
  127. package/dist/index62.cjs +1 -1
  128. package/dist/index62.js +223 -6
  129. package/dist/index63.cjs +1 -2
  130. package/dist/index63.js +10 -57
  131. package/dist/index64.cjs +1 -1
  132. package/dist/index64.js +35 -2
  133. package/dist/index65.cjs +1 -1
  134. package/dist/index65.js +4 -6
  135. package/dist/index66.cjs +2 -1
  136. package/dist/index66.js +59 -4
  137. package/dist/index67.cjs +1 -1
  138. package/dist/index67.js +3 -11
  139. package/dist/index68.cjs +1 -5
  140. package/dist/index68.js +8 -56
  141. package/dist/index69.cjs +1 -2
  142. package/dist/index69.js +19 -32
  143. package/dist/index70.cjs +1 -1
  144. package/dist/index70.js +18 -5
  145. package/dist/index71.cjs +1 -1
  146. package/dist/index71.js +42 -3
  147. package/dist/index72.cjs +1 -1
  148. package/dist/index72.js +101 -18
  149. package/dist/index73.cjs +1 -1
  150. package/dist/index73.js +2 -2
  151. package/dist/index74.cjs +1 -1
  152. package/dist/index74.js +2 -2
  153. package/dist/index75.cjs +1 -1
  154. package/dist/index75.js +1 -1
  155. package/dist/index76.cjs +1 -1
  156. package/dist/index76.js +13 -6
  157. package/dist/index77.cjs +1 -1
  158. package/dist/index77.js +6 -13
  159. package/dist/index78.cjs +1 -1
  160. package/dist/index78.js +16 -31
  161. package/dist/index79.cjs +1 -1
  162. package/dist/index79.js +78 -14
  163. package/dist/index80.cjs +1 -1
  164. package/dist/index80.js +14 -64
  165. package/dist/index81.cjs +1 -1
  166. package/dist/index81.js +17 -26
  167. package/dist/index82.cjs +1 -1
  168. package/dist/index82.js +192 -3
  169. package/dist/index83.cjs +1 -1
  170. package/dist/index83.js +64 -8
  171. package/dist/index84.cjs +1 -1
  172. package/dist/index84.js +2 -192
  173. package/dist/index85.cjs +1 -1
  174. package/dist/index85.js +6 -18
  175. package/dist/index86.cjs +1 -1
  176. package/dist/index86.js +11 -3
  177. package/dist/index87.cjs +5 -1
  178. package/dist/index87.js +50 -106
  179. package/dist/index88.cjs +2 -1
  180. package/dist/index88.js +33 -15
  181. package/dist/index89.cjs +1 -1
  182. package/dist/index89.js +5 -223
  183. package/dist/index90.cjs +1 -1
  184. package/dist/index90.js +3 -42
  185. package/dist/index91.cjs +1 -1
  186. package/dist/index91.js +6 -104
  187. package/dist/index92.cjs +1 -1
  188. package/dist/index92.js +31 -16
  189. package/dist/index93.cjs +1 -1
  190. package/dist/index93.js +24 -75
  191. package/dist/index94.cjs +1 -1
  192. package/dist/index94.js +3 -19
  193. package/dist/index95.cjs +1 -1
  194. package/dist/index95.js +1 -1
  195. package/dist/index97.cjs +1 -1
  196. package/dist/index97.js +64 -35
  197. package/dist/index98.cjs +1 -1
  198. package/dist/index98.js +66 -9
  199. package/dist/index99.cjs +1 -1
  200. package/dist/index99.js +2 -9
  201. package/package.json +1 -1
package/dist/index97.js CHANGED
@@ -1,41 +1,70 @@
1
- import { SliceOffsetOutOfBoundsError as t } from "./index98.js";
2
- import { isHex as p } from "./index86.js";
3
- import { size as r } from "./index66.js";
4
- function w(e, f, i, { strict: o } = {}) {
5
- return p(e, { strict: !1 }) ? u(e, f, i, {
6
- strict: o
7
- }) : m(e, f, i, {
8
- strict: o
9
- });
1
+ import { aexists as g, aoutput as d } from "./index100.js";
2
+ import { Hash as b, createView as p, toBytes as a } from "./index98.js";
3
+ function w(o, t, s, i) {
4
+ if (typeof o.setBigUint64 == "function")
5
+ return o.setBigUint64(t, s, i);
6
+ const n = BigInt(32), h = BigInt(4294967295), e = Number(s >> n & h), r = Number(s & h), u = i ? 4 : 0, c = i ? 0 : 4;
7
+ o.setUint32(t + u, e, i), o.setUint32(t + c, r, i);
10
8
  }
11
- function s(e, f) {
12
- if (typeof f == "number" && f > 0 && f > r(e) - 1)
13
- throw new t({
14
- offset: f,
15
- position: "start",
16
- size: r(e)
17
- });
9
+ function B(o, t, s) {
10
+ return o & t ^ ~o & s;
18
11
  }
19
- function c(e, f, i) {
20
- if (typeof f == "number" && typeof i == "number" && r(e) !== i - f)
21
- throw new t({
22
- offset: i,
23
- position: "end",
24
- size: r(e)
25
- });
12
+ function L(o, t, s) {
13
+ return o & t ^ o & s ^ t & s;
26
14
  }
27
- function m(e, f, i, { strict: o } = {}) {
28
- s(e, f);
29
- const n = e.slice(f, i);
30
- return o && c(n, f, i), n;
31
- }
32
- function u(e, f, i, { strict: o } = {}) {
33
- s(e, f);
34
- const n = `0x${e.replace("0x", "").slice((f ?? 0) * 2, (i ?? e.length) * 2)}`;
35
- return o && c(n, f, i), n;
15
+ class U extends b {
16
+ constructor(t, s, i, n) {
17
+ super(), this.blockLen = t, this.outputLen = s, this.padOffset = i, this.isLE = n, this.finished = !1, this.length = 0, this.pos = 0, this.destroyed = !1, this.buffer = new Uint8Array(t), this.view = p(this.buffer);
18
+ }
19
+ update(t) {
20
+ g(this);
21
+ const { view: s, buffer: i, blockLen: n } = this;
22
+ t = a(t);
23
+ const h = t.length;
24
+ for (let e = 0; e < h; ) {
25
+ const r = Math.min(n - this.pos, h - e);
26
+ if (r === n) {
27
+ const u = p(t);
28
+ for (; n <= h - e; e += n)
29
+ this.process(u, e);
30
+ continue;
31
+ }
32
+ i.set(t.subarray(e, e + r), this.pos), this.pos += r, e += r, this.pos === n && (this.process(s, 0), this.pos = 0);
33
+ }
34
+ return this.length += t.length, this.roundClean(), this;
35
+ }
36
+ digestInto(t) {
37
+ g(this), d(t, this), this.finished = !0;
38
+ const { buffer: s, view: i, blockLen: n, isLE: h } = this;
39
+ let { pos: e } = this;
40
+ s[e++] = 128, this.buffer.subarray(e).fill(0), this.padOffset > n - e && (this.process(i, 0), e = 0);
41
+ for (let f = e; f < n; f++)
42
+ s[f] = 0;
43
+ w(i, n - 8, BigInt(this.length * 8), h), this.process(i, 0);
44
+ const r = p(t), u = this.outputLen;
45
+ if (u % 4)
46
+ throw new Error("_sha2: outputLen should be aligned to 32bit");
47
+ const c = u / 4, l = this.get();
48
+ if (c > l.length)
49
+ throw new Error("_sha2: outputLen bigger than state");
50
+ for (let f = 0; f < c; f++)
51
+ r.setUint32(4 * f, l[f], h);
52
+ }
53
+ digest() {
54
+ const { buffer: t, outputLen: s } = this;
55
+ this.digestInto(t);
56
+ const i = t.slice(0, s);
57
+ return this.destroy(), i;
58
+ }
59
+ _cloneInto(t) {
60
+ t || (t = new this.constructor()), t.set(...this.get());
61
+ const { blockLen: s, buffer: i, length: n, finished: h, destroyed: e, pos: r } = this;
62
+ return t.length = n, t.pos = r, t.finished = h, t.destroyed = e, n % s && t.buffer.set(i), t;
63
+ }
36
64
  }
37
65
  export {
38
- w as slice,
39
- m as sliceBytes,
40
- u as sliceHex
66
+ B as Chi,
67
+ U as HashMD,
68
+ L as Maj,
69
+ w as setBigUint64
41
70
  };
package/dist/index98.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index63.cjs");class i extends t.BaseError{constructor({offset:r,position:s,size:e}){super(`Slice ${s==="start"?"starting":"ending"} at offset "${r}" is out-of-bounds (size: ${e}).`,{name:"SliceOffsetOutOfBoundsError"})}}class d extends t.BaseError{constructor({size:r,targetSize:s,type:e}){super(`${e.charAt(0).toUpperCase()}${e.slice(1).toLowerCase()} size (${r}) exceeds padding size (${s}).`,{name:"SizeExceedsPaddingSizeError"})}}exports.SizeExceedsPaddingSizeError=d;exports.SliceOffsetOutOfBoundsError=i;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index99.cjs"),f=require("./index100.cjs");/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function p(t){return new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4))}function a(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}function l(t,e){return t<<32-e|t>>>e}const b=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function i(t){return t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255}function w(t){for(let e=0;e<t.length;e++)t[e]=i(t[e])}function y(t){if(typeof t!="string")throw new Error("utf8ToBytes expected string, got "+typeof t);return new Uint8Array(new TextEncoder().encode(t))}function s(t){return typeof t=="string"&&(t=y(t)),f.abytes(t),t}function g(...t){let e=0;for(let n=0;n<t.length;n++){const u=t[n];f.abytes(u),e+=u.length}const r=new Uint8Array(e);for(let n=0,u=0;n<t.length;n++){const c=t[n];r.set(c,u),u+=c.length}return r}class m{clone(){return this._cloneInto()}}function B(t){const e=n=>t().update(s(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function d(t=32){if(o.crypto&&typeof o.crypto.getRandomValues=="function")return o.crypto.getRandomValues(new Uint8Array(t));if(o.crypto&&typeof o.crypto.randomBytes=="function")return o.crypto.randomBytes(t);throw new Error("crypto.getRandomValues must be defined")}exports.Hash=m;exports.byteSwap=i;exports.byteSwap32=w;exports.concatBytes=g;exports.createView=a;exports.isLE=b;exports.randomBytes=d;exports.rotr=l;exports.toBytes=s;exports.u32=p;exports.utf8ToBytes=y;exports.wrapConstructor=B;
package/dist/index98.js CHANGED
@@ -1,15 +1,72 @@
1
- import { BaseError as o } from "./index63.js";
2
- class d extends o {
3
- constructor({ offset: r, position: s, size: e }) {
4
- super(`Slice ${s === "start" ? "starting" : "ending"} at offset "${r}" is out-of-bounds (size: ${e}).`, { name: "SliceOffsetOutOfBoundsError" });
1
+ import { crypto as o } from "./index99.js";
2
+ import { abytes as i } from "./index100.js";
3
+ /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
4
+ function g(t) {
5
+ return new Uint32Array(t.buffer, t.byteOffset, Math.floor(t.byteLength / 4));
6
+ }
7
+ function m(t) {
8
+ return new DataView(t.buffer, t.byteOffset, t.byteLength);
9
+ }
10
+ function w(t, e) {
11
+ return t << 32 - e | t >>> e;
12
+ }
13
+ const b = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
14
+ function c(t) {
15
+ return t << 24 & 4278190080 | t << 8 & 16711680 | t >>> 8 & 65280 | t >>> 24 & 255;
16
+ }
17
+ function a(t) {
18
+ for (let e = 0; e < t.length; e++)
19
+ t[e] = c(t[e]);
20
+ }
21
+ function s(t) {
22
+ if (typeof t != "string")
23
+ throw new Error("utf8ToBytes expected string, got " + typeof t);
24
+ return new Uint8Array(new TextEncoder().encode(t));
25
+ }
26
+ function y(t) {
27
+ return typeof t == "string" && (t = s(t)), i(t), t;
28
+ }
29
+ function x(...t) {
30
+ let e = 0;
31
+ for (let n = 0; n < t.length; n++) {
32
+ const r = t[n];
33
+ i(r), e += r.length;
34
+ }
35
+ const f = new Uint8Array(e);
36
+ for (let n = 0, r = 0; n < t.length; n++) {
37
+ const u = t[n];
38
+ f.set(u, r), r += u.length;
5
39
  }
40
+ return f;
6
41
  }
7
- class n extends o {
8
- constructor({ size: r, targetSize: s, type: e }) {
9
- super(`${e.charAt(0).toUpperCase()}${e.slice(1).toLowerCase()} size (${r}) exceeds padding size (${s}).`, { name: "SizeExceedsPaddingSizeError" });
42
+ class h {
43
+ // Safe version that clones internal state
44
+ clone() {
45
+ return this._cloneInto();
10
46
  }
11
47
  }
48
+ function B(t) {
49
+ const e = (n) => t().update(y(n)).digest(), f = t();
50
+ return e.outputLen = f.outputLen, e.blockLen = f.blockLen, e.create = () => t(), e;
51
+ }
52
+ function d(t = 32) {
53
+ if (o && typeof o.getRandomValues == "function")
54
+ return o.getRandomValues(new Uint8Array(t));
55
+ if (o && typeof o.randomBytes == "function")
56
+ return o.randomBytes(t);
57
+ throw new Error("crypto.getRandomValues must be defined");
58
+ }
12
59
  export {
13
- n as SizeExceedsPaddingSizeError,
14
- d as SliceOffsetOutOfBoundsError
60
+ h as Hash,
61
+ c as byteSwap,
62
+ a as byteSwap32,
63
+ x as concatBytes,
64
+ m as createView,
65
+ b as isLE,
66
+ d as randomBytes,
67
+ w as rotr,
68
+ y as toBytes,
69
+ g as u32,
70
+ s as utf8ToBytes,
71
+ B as wrapConstructor
15
72
  };
package/dist/index99.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function n(e){return{formatters:void 0,fees:void 0,serializers:void 0,...e}}exports.defineChain=n;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;exports.crypto=o;
package/dist/index99.js CHANGED
@@ -1,11 +1,4 @@
1
- function n(e) {
2
- return {
3
- formatters: void 0,
4
- fees: void 0,
5
- serializers: void 0,
6
- ...e
7
- };
8
- }
1
+ const o = typeof globalThis == "object" && "crypto" in globalThis ? globalThis.crypto : void 0;
9
2
  export {
10
- n as defineChain
3
+ o as crypto
11
4
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gardenfi/utils",
3
- "version": "2.0.6-beta.4",
3
+ "version": "2.0.6-beta.6",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "build": "vite build",