@gardenfi/utils 2.4.3 → 2.4.5

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 (115) hide show
  1. package/dist/index10.cjs +1 -1
  2. package/dist/index10.js +4 -4
  3. package/dist/index119.cjs +1 -1
  4. package/dist/index119.js +1 -1
  5. package/dist/index16.cjs +1 -1
  6. package/dist/index16.js +4 -4
  7. package/dist/index195.cjs +1 -1
  8. package/dist/index195.js +3 -3
  9. package/dist/index225.cjs +1 -1
  10. package/dist/index225.js +2 -2
  11. package/dist/index229.cjs +1 -1
  12. package/dist/index229.js +1 -1
  13. package/dist/index24.cjs +1 -1
  14. package/dist/index24.js +13 -31
  15. package/dist/index241.cjs +1 -1
  16. package/dist/index241.js +3 -3
  17. package/dist/index25.cjs +1 -1
  18. package/dist/index25.js +58 -32
  19. package/dist/index26.cjs +16 -1
  20. package/dist/index26.js +113 -11
  21. package/dist/index261.cjs +2 -1
  22. package/dist/index261.js +40 -102
  23. package/dist/index262.cjs +1 -1
  24. package/dist/index262.js +2 -7
  25. package/dist/index263.cjs +1 -1
  26. package/dist/index263.js +5 -224
  27. package/dist/index264.cjs +1 -1
  28. package/dist/index264.js +10 -6
  29. package/dist/index265.cjs +1 -1
  30. package/dist/index265.js +20 -7
  31. package/dist/index266.cjs +1 -1
  32. package/dist/index266.js +8 -26
  33. package/dist/index267.cjs +1 -1
  34. package/dist/index267.js +66 -5
  35. package/dist/index268.cjs +1 -2
  36. package/dist/index268.js +64 -40
  37. package/dist/index269.cjs +1 -1
  38. package/dist/index269.js +187 -2
  39. package/dist/index27.cjs +1 -1
  40. package/dist/index27.js +32 -58
  41. package/dist/index270.cjs +1 -1
  42. package/dist/index270.js +20 -8
  43. package/dist/index271.cjs +1 -1
  44. package/dist/index271.js +40 -17
  45. package/dist/index272.cjs +1 -1
  46. package/dist/index272.js +76 -8
  47. package/dist/index273.cjs +1 -1
  48. package/dist/index273.js +40 -66
  49. package/dist/index274.cjs +1 -1
  50. package/dist/index274.js +15 -64
  51. package/dist/index275.cjs +1 -1
  52. package/dist/index275.js +12 -185
  53. package/dist/index276.cjs +1 -1
  54. package/dist/index276.js +11 -21
  55. package/dist/index277.cjs +2 -1
  56. package/dist/index277.js +18 -42
  57. package/dist/index278.cjs +1 -1
  58. package/dist/index278.js +13 -75
  59. package/dist/index279.cjs +1 -1
  60. package/dist/index279.js +11 -40
  61. package/dist/index28.cjs +1 -1
  62. package/dist/index28.js +31 -13
  63. package/dist/index280.cjs +1 -1
  64. package/dist/index280.js +102 -15
  65. package/dist/index281.cjs +1 -1
  66. package/dist/index281.js +6 -13
  67. package/dist/index282.cjs +1 -1
  68. package/dist/index282.js +222 -10
  69. package/dist/index283.cjs +1 -2
  70. package/dist/index283.js +6 -18
  71. package/dist/index284.cjs +1 -1
  72. package/dist/index284.js +7 -15
  73. package/dist/index285.cjs +1 -1
  74. package/dist/index285.js +26 -11
  75. package/dist/index287.cjs +1 -1
  76. package/dist/index287.js +1 -1
  77. package/dist/index29.cjs +1 -16
  78. package/dist/index29.js +11 -113
  79. package/dist/index292.cjs +1 -1
  80. package/dist/index292.js +2 -2
  81. package/dist/index294.cjs +1 -1
  82. package/dist/index294.js +138 -10
  83. package/dist/index295.cjs +1 -1
  84. package/dist/index295.js +42 -19
  85. package/dist/index296.cjs +1 -1
  86. package/dist/index296.js +73 -134
  87. package/dist/index297.cjs +1 -1
  88. package/dist/index297.js +2 -43
  89. package/dist/index298.cjs +1 -1
  90. package/dist/index298.js +10 -77
  91. package/dist/index299.cjs +1 -1
  92. package/dist/index299.js +20 -2
  93. package/dist/index300.cjs +1 -1
  94. package/dist/index300.js +68 -698
  95. package/dist/index301.cjs +1 -1
  96. package/dist/index301.js +675 -178
  97. package/dist/index302.cjs +1 -1
  98. package/dist/index302.js +200 -67
  99. package/dist/index303.cjs +1 -1
  100. package/dist/index303.js +1 -1
  101. package/dist/index306.cjs +1 -1
  102. package/dist/index306.js +1 -1
  103. package/dist/index308.cjs +1 -1
  104. package/dist/index308.js +1 -1
  105. package/dist/index311.cjs +1 -1
  106. package/dist/index311.js +4 -63
  107. package/dist/index312.cjs +1 -1
  108. package/dist/index312.js +59 -40
  109. package/dist/index313.cjs +1 -1
  110. package/dist/index313.js +44 -4
  111. package/dist/index53.cjs +1 -1
  112. package/dist/index53.js +1 -1
  113. package/dist/index98.cjs +1 -1
  114. package/dist/index98.js +2 -2
  115. package/package.json +1 -1
package/dist/index29.js CHANGED
@@ -1,116 +1,14 @@
1
- import { SiweInvalidMessageFieldError as e } from "./index294.js";
2
- import { getAddress as S } from "./index162.js";
3
- import { isUri as $ } from "./index295.js";
4
- function C(n) {
5
- const { chainId: i, domain: s, expirationTime: u, issuedAt: g = /* @__PURE__ */ new Date(), nonce: a, notBefore: m, requestId: h, resources: w, scheme: o, uri: c, version: f } = n;
6
- {
7
- if (i !== Math.floor(i))
8
- throw new e({
9
- field: "chainId",
10
- metaMessages: [
11
- "- Chain ID must be a EIP-155 chain ID.",
12
- "- See https://eips.ethereum.org/EIPS/eip-155",
13
- "",
14
- `Provided value: ${i}`
15
- ]
16
- });
17
- if (!(p.test(s) || M.test(s) || x.test(s)))
18
- throw new e({
19
- field: "domain",
20
- metaMessages: [
21
- "- Domain must be an RFC 3986 authority.",
22
- "- See https://www.rfc-editor.org/rfc/rfc3986",
23
- "",
24
- `Provided value: ${s}`
25
- ]
26
- });
27
- if (!A.test(a))
28
- throw new e({
29
- field: "nonce",
30
- metaMessages: [
31
- "- Nonce must be at least 8 characters.",
32
- "- Nonce must be alphanumeric.",
33
- "",
34
- `Provided value: ${a}`
35
- ]
36
- });
37
- if (!$(c))
38
- throw new e({
39
- field: "uri",
40
- metaMessages: [
41
- "- URI must be a RFC 3986 URI referring to the resource that is the subject of the signing.",
42
- "- See https://www.rfc-editor.org/rfc/rfc3986",
43
- "",
44
- `Provided value: ${c}`
45
- ]
46
- });
47
- if (f !== "1")
48
- throw new e({
49
- field: "version",
50
- metaMessages: [
51
- "- Version must be '1'.",
52
- "",
53
- `Provided value: ${f}`
54
- ]
55
- });
56
- if (o && !P.test(o))
57
- throw new e({
58
- field: "scheme",
59
- metaMessages: [
60
- "- Scheme must be an RFC 3986 URI scheme.",
61
- "- See https://www.rfc-editor.org/rfc/rfc3986#section-3.1",
62
- "",
63
- `Provided value: ${o}`
64
- ]
65
- });
66
- const t = n.statement;
67
- if (t != null && t.includes(`
68
- `))
69
- throw new e({
70
- field: "statement",
71
- metaMessages: [
72
- "- Statement must not include '\\n'.",
73
- "",
74
- `Provided value: ${t}`
75
- ]
76
- });
77
- }
78
- const l = S(n.address), v = o ? `${o}://${s}` : s, I = n.statement ? `${n.statement}
79
- ` : "", R = `${v} wants you to sign in with your Ethereum account:
80
- ${l}
81
-
82
- ${I}`;
83
- let r = `URI: ${c}
84
- Version: ${f}
85
- Chain ID: ${i}
86
- Nonce: ${a}
87
- Issued At: ${g.toISOString()}`;
88
- if (u && (r += `
89
- Expiration Time: ${u.toISOString()}`), m && (r += `
90
- Not Before: ${m.toISOString()}`), h && (r += `
91
- Request ID: ${h}`), w) {
92
- let t = `
93
- Resources:`;
94
- for (const d of w) {
95
- if (!$(d))
96
- throw new e({
97
- field: "resources",
98
- metaMessages: [
99
- "- Every resource must be a RFC 3986 URI.",
100
- "- See https://www.rfc-editor.org/rfc/rfc3986",
101
- "",
102
- `Provided value: ${d}`
103
- ]
104
- });
105
- t += `
106
- - ${d}`;
107
- }
108
- r += t;
109
- }
110
- return `${R}
111
- ${r}`;
1
+ import { createClient as n } from "./index47.js";
2
+ import { publicActions as c } from "./index55.js";
3
+ function u(t) {
4
+ const { key: e = "public", name: i = "Public Client" } = t;
5
+ return n({
6
+ ...t,
7
+ key: e,
8
+ name: i,
9
+ type: "publicClient"
10
+ }).extend(c);
112
11
  }
113
- const p = /^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}(:[0-9]{1,5})?$/, M = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(:[0-9]{1,5})?$/, x = /^localhost(:[0-9]{1,5})?$/, A = /^[a-zA-Z0-9]{8,}$/, P = /^([a-zA-Z][a-zA-Z0-9+-.]*)$/;
114
12
  export {
115
- C as createSiweMessage
13
+ u as createPublicClient
116
14
  };
package/dist/index292.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("./index303.cjs"),$=require("./index306.cjs"),g=require("./index290.cjs"),c=require("./index307.cjs"),y=require("./index276.cjs"),h=require("./index267.cjs");function I(t,r={}){const{prepare:i=!0}=r,n=Array.isArray(t)||typeof t=="string"?y.parseAbiItem(t):t;return{...n,...i?{hash:o(n)}:{}}}function q(t,r,i){const{args:n=[],prepare:a=!0}=i??{},v=g.validate(r,{strict:!1}),s=t.filter(e=>v?e.type==="function"||e.type==="error"?A(e)===g.slice(r,0,4):e.type==="event"?o(e)===r:!1:"name"in e&&e.name===r);if(s.length===0)throw new l({name:r});if(s.length===1)return{...s[0],...a?{hash:o(s[0])}:{}};let u;for(const e of s){if(!("inputs"in e))continue;if(!n||n.length===0){if(!e.inputs||e.inputs.length===0)return{...e,...a?{hash:o(e)}:{}};continue}if(!e.inputs||e.inputs.length===0||e.inputs.length!==n.length)continue;if(n.every((f,E)=>{const d="inputs"in e&&e.inputs[E];return d?c.isArgOfType(f,d):!1})){if(u&&"inputs"in u&&u.inputs){const f=c.getAmbiguousTypes(e.inputs,u.inputs,n);if(f)throw new w({abiItem:e,type:f[0]},{abiItem:u,type:f[1]})}u=e}}const p=(()=>{if(u)return u;const[e,...m]=s;return{...e,overloads:m}})();if(!p)throw new l({name:r});return{...p,...a?{hash:o(p)}:{}}}function A(t){return g.slice(o(t),0,4)}function S(t){const r=typeof t=="string"?t:h.formatAbiItem(t);return c.normalizeSignature(r)}function o(t){return typeof t!="string"&&"hash"in t&&t.hash?t.hash:$.keccak256(g.fromString(S(t)))}class w extends b.BaseError{constructor(r,i){super("Found ambiguous types in overloaded ABI Items.",{metaMessages:[`\`${r.type}\` in \`${c.normalizeSignature(h.formatAbiItem(r.abiItem))}\`, and`,`\`${i.type}\` in \`${c.normalizeSignature(h.formatAbiItem(i.abiItem))}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItem.AmbiguityError"})}}class l extends b.BaseError{constructor({name:r,data:i,type:n="item"}){const a=r?` with name "${r}"`:i?` with data "${i}"`:"";super(`ABI ${n}${a} not found.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItem.NotFoundError"})}}exports.AmbiguityError=w;exports.NotFoundError=l;exports.from=I;exports.fromAbi=q;exports.getSelector=A;exports.getSignature=S;exports.getSignatureHash=o;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("./index303.cjs"),$=require("./index306.cjs"),g=require("./index290.cjs"),c=require("./index307.cjs"),y=require("./index270.cjs"),h=require("./index263.cjs");function I(t,r={}){const{prepare:i=!0}=r,n=Array.isArray(t)||typeof t=="string"?y.parseAbiItem(t):t;return{...n,...i?{hash:o(n)}:{}}}function q(t,r,i){const{args:n=[],prepare:a=!0}=i??{},v=g.validate(r,{strict:!1}),s=t.filter(e=>v?e.type==="function"||e.type==="error"?A(e)===g.slice(r,0,4):e.type==="event"?o(e)===r:!1:"name"in e&&e.name===r);if(s.length===0)throw new l({name:r});if(s.length===1)return{...s[0],...a?{hash:o(s[0])}:{}};let u;for(const e of s){if(!("inputs"in e))continue;if(!n||n.length===0){if(!e.inputs||e.inputs.length===0)return{...e,...a?{hash:o(e)}:{}};continue}if(!e.inputs||e.inputs.length===0||e.inputs.length!==n.length)continue;if(n.every((f,E)=>{const d="inputs"in e&&e.inputs[E];return d?c.isArgOfType(f,d):!1})){if(u&&"inputs"in u&&u.inputs){const f=c.getAmbiguousTypes(e.inputs,u.inputs,n);if(f)throw new w({abiItem:e,type:f[0]},{abiItem:u,type:f[1]})}u=e}}const p=(()=>{if(u)return u;const[e,...m]=s;return{...e,overloads:m}})();if(!p)throw new l({name:r});return{...p,...a?{hash:o(p)}:{}}}function A(t){return g.slice(o(t),0,4)}function S(t){const r=typeof t=="string"?t:h.formatAbiItem(t);return c.normalizeSignature(r)}function o(t){return typeof t!="string"&&"hash"in t&&t.hash?t.hash:$.keccak256(g.fromString(S(t)))}class w extends b.BaseError{constructor(r,i){super("Found ambiguous types in overloaded ABI Items.",{metaMessages:[`\`${r.type}\` in \`${c.normalizeSignature(h.formatAbiItem(r.abiItem))}\`, and`,`\`${i.type}\` in \`${c.normalizeSignature(h.formatAbiItem(i.abiItem))}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItem.AmbiguityError"})}}class l extends b.BaseError{constructor({name:r,data:i,type:n="item"}){const a=r?` with name "${r}"`:i?` with data "${i}"`:"";super(`ABI ${n}${a} not found.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItem.NotFoundError"})}}exports.AmbiguityError=w;exports.NotFoundError=l;exports.from=I;exports.fromAbi=q;exports.getSelector=A;exports.getSignature=S;exports.getSignatureHash=o;
package/dist/index292.js CHANGED
@@ -2,8 +2,8 @@ import { BaseError as y } from "./index303.js";
2
2
  import { keccak256 as v } from "./index306.js";
3
3
  import { validate as $, slice as A, fromString as S } from "./index290.js";
4
4
  import { isArgOfType as E, normalizeSignature as p, getAmbiguousTypes as B } from "./index307.js";
5
- import { parseAbiItem as l } from "./index276.js";
6
- import { formatAbiItem as h } from "./index267.js";
5
+ import { parseAbiItem as l } from "./index270.js";
6
+ import { formatAbiItem as h } from "./index263.js";
7
7
  function H(e, r = {}) {
8
8
  const { prepare: i = !0 } = r, n = Array.isArray(e) ? l(e) : typeof e == "string" ? l(e) : e;
9
9
  return {
package/dist/index294.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index41.cjs");class t extends a.BaseError{constructor(e){const{docsPath:s,field:r,metaMessages:i}=e;super(`Invalid Sign-In with Ethereum message field "${r}".`,{docsPath:s,metaMessages:i,name:"SiweInvalidMessageFieldError"})}}exports.SiweInvalidMessageFieldError=t;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index287.cjs");/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const d=BigInt(0),g=BigInt(1);function T(e,t){if(typeof t!="boolean")throw new Error(e+" boolean expected, got "+t)}function x(e){const t=e.toString(16);return t.length&1?"0"+t:t}function w(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return e===""?d:BigInt("0x"+e)}function v(e){return w(i.bytesToHex(e))}function U(e){return i.abytes(e),w(i.bytesToHex(Uint8Array.from(e).reverse()))}function h(e,t){return i.hexToBytes(e.toString(16).padStart(t*2,"0"))}function H(e,t){return h(e,t).reverse()}function A(e,t,r){let o;if(typeof t=="string")try{o=i.hexToBytes(t)}catch(n){throw new Error(e+" must be hex string or Uint8Array, cause: "+n)}else if(i.isBytes(t))o=Uint8Array.from(t);else throw new Error(e+" must be hex string or Uint8Array");const s=o.length;if(typeof r=="number"&&s!==r)throw new Error(e+" of length "+r+" expected, got "+s);return o}const m=e=>typeof e=="bigint"&&d<=e;function p(e,t,r){return m(e)&&m(t)&&m(r)&&t<=e&&e<r}function I(e,t,r,o){if(!p(t,r,o))throw new Error("expected valid "+e+": "+r+" <= n < "+o+", got "+t)}function j(e){let t;for(t=0;e>d;e>>=g,t+=1);return t}const k=e=>(g<<BigInt(e))-g;function N(e,t,r){if(typeof e!="number"||e<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof r!="function")throw new Error("hmacFn must be a function");const o=u=>new Uint8Array(u),s=u=>Uint8Array.of(u);let n=o(e),c=o(e),f=0;const a=()=>{n.fill(1),c.fill(0),f=0},b=(...u)=>r(c,n,...u),B=(u=o(0))=>{c=b(s(0),u),n=b(),u.length!==0&&(c=b(s(1),u),n=b())},E=()=>{if(f++>=1e3)throw new Error("drbg: tried 1000 values");let u=0;const y=[];for(;u<t;){n=b();const l=n.slice();y.push(l),u+=n.length}return i.concatBytes(...y)};return(u,y)=>{a(),B(u);let l;for(;!(l=y(E()));)B();return a(),l}}function O(e,t,r={}){if(!e||typeof e!="object")throw new Error("expected valid options object");function o(s,n,c){const f=e[s];if(c&&f===void 0)return;const a=typeof f;if(a!==n||f===null)throw new Error(`param "${s}" is invalid: expected ${n}, got ${a}`)}Object.entries(t).forEach(([s,n])=>o(s,n,!1)),Object.entries(r).forEach(([s,n])=>o(s,n,!0))}function S(e){const t=new WeakMap;return(r,...o)=>{const s=t.get(r);if(s!==void 0)return s;const n=e(r,...o);return t.set(r,n),n}}exports.abytes=i.abytes;exports.anumber=i.anumber;exports.bytesToHex=i.bytesToHex;exports.concatBytes=i.concatBytes;exports.hexToBytes=i.hexToBytes;exports.isBytes=i.isBytes;exports.randomBytes=i.randomBytes;exports.utf8ToBytes=i.utf8ToBytes;exports._validateObject=O;exports.aInRange=I;exports.abool=T;exports.bitLen=j;exports.bitMask=k;exports.bytesToNumberBE=v;exports.bytesToNumberLE=U;exports.createHmacDrbg=N;exports.ensureBytes=A;exports.hexToNumber=w;exports.inRange=p;exports.memoized=S;exports.numberToBytesBE=h;exports.numberToBytesLE=H;exports.numberToHexUnpadded=x;
package/dist/index294.js CHANGED
@@ -1,14 +1,142 @@
1
- import { BaseError as i } from "./index41.js";
2
- class d extends i {
3
- constructor(e) {
4
- const { docsPath: s, field: r, metaMessages: a } = e;
5
- super(`Invalid Sign-In with Ethereum message field "${r}".`, {
6
- docsPath: s,
7
- metaMessages: a,
8
- name: "SiweInvalidMessageFieldError"
9
- });
1
+ import { hexToBytes as p, isBytes as B, abytes as v, bytesToHex as d, concatBytes as U } from "./index287.js";
2
+ import { anumber as W, randomBytes as C, utf8ToBytes as G } from "./index287.js";
3
+ /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
4
+ const y = /* @__PURE__ */ BigInt(0), g = /* @__PURE__ */ BigInt(1);
5
+ function k(t, r) {
6
+ if (typeof r != "boolean")
7
+ throw new Error(t + " boolean expected, got " + r);
8
+ }
9
+ function j(t) {
10
+ const r = t.toString(16);
11
+ return r.length & 1 ? "0" + r : r;
12
+ }
13
+ function h(t) {
14
+ if (typeof t != "string")
15
+ throw new Error("hex string expected, got " + typeof t);
16
+ return t === "" ? y : BigInt("0x" + t);
17
+ }
18
+ function H(t) {
19
+ return h(d(t));
20
+ }
21
+ function O(t) {
22
+ return v(t), h(d(Uint8Array.from(t).reverse()));
23
+ }
24
+ function x(t, r) {
25
+ return p(t.toString(16).padStart(r * 2, "0"));
26
+ }
27
+ function S(t, r) {
28
+ return x(t, r).reverse();
29
+ }
30
+ function _(t, r, n) {
31
+ let o;
32
+ if (typeof r == "string")
33
+ try {
34
+ o = p(r);
35
+ } catch (e) {
36
+ throw new Error(t + " must be hex string or Uint8Array, cause: " + e);
37
+ }
38
+ else if (B(r))
39
+ o = Uint8Array.from(r);
40
+ else
41
+ throw new Error(t + " must be hex string or Uint8Array");
42
+ const i = o.length;
43
+ if (typeof n == "number" && i !== n)
44
+ throw new Error(t + " of length " + n + " expected, got " + i);
45
+ return o;
46
+ }
47
+ const w = (t) => typeof t == "bigint" && y <= t;
48
+ function T(t, r, n) {
49
+ return w(t) && w(r) && w(n) && r <= t && t < n;
50
+ }
51
+ function $(t, r, n, o) {
52
+ if (!T(r, n, o))
53
+ throw new Error("expected valid " + t + ": " + n + " <= n < " + o + ", got " + r);
54
+ }
55
+ function M(t) {
56
+ let r;
57
+ for (r = 0; t > y; t >>= g, r += 1)
58
+ ;
59
+ return r;
60
+ }
61
+ const N = (t) => (g << BigInt(t)) - g;
62
+ function R(t, r, n) {
63
+ if (typeof t != "number" || t < 2)
64
+ throw new Error("hashLen must be a number");
65
+ if (typeof r != "number" || r < 2)
66
+ throw new Error("qByteLen must be a number");
67
+ if (typeof n != "function")
68
+ throw new Error("hmacFn must be a function");
69
+ const o = (u) => new Uint8Array(u), i = (u) => Uint8Array.of(u);
70
+ let e = o(t), s = o(t), f = 0;
71
+ const c = () => {
72
+ e.fill(1), s.fill(0), f = 0;
73
+ }, l = (...u) => n(s, e, ...u), m = (u = o(0)) => {
74
+ s = l(i(0), u), e = l(), u.length !== 0 && (s = l(i(1), u), e = l());
75
+ }, E = () => {
76
+ if (f++ >= 1e3)
77
+ throw new Error("drbg: tried 1000 values");
78
+ let u = 0;
79
+ const a = [];
80
+ for (; u < r; ) {
81
+ e = l();
82
+ const b = e.slice();
83
+ a.push(b), u += e.length;
84
+ }
85
+ return U(...a);
86
+ };
87
+ return (u, a) => {
88
+ c(), m(u);
89
+ let b;
90
+ for (; !(b = a(E())); )
91
+ m();
92
+ return c(), b;
93
+ };
94
+ }
95
+ function z(t, r, n = {}) {
96
+ if (!t || typeof t != "object")
97
+ throw new Error("expected valid options object");
98
+ function o(i, e, s) {
99
+ const f = t[i];
100
+ if (s && f === void 0)
101
+ return;
102
+ const c = typeof f;
103
+ if (c !== e || f === null)
104
+ throw new Error(`param "${i}" is invalid: expected ${e}, got ${c}`);
10
105
  }
106
+ Object.entries(r).forEach(([i, e]) => o(i, e, !1)), Object.entries(n).forEach(([i, e]) => o(i, e, !0));
107
+ }
108
+ function D(t) {
109
+ const r = /* @__PURE__ */ new WeakMap();
110
+ return (n, ...o) => {
111
+ const i = r.get(n);
112
+ if (i !== void 0)
113
+ return i;
114
+ const e = t(n, ...o);
115
+ return r.set(n, e), e;
116
+ };
11
117
  }
12
118
  export {
13
- d as SiweInvalidMessageFieldError
119
+ z as _validateObject,
120
+ $ as aInRange,
121
+ k as abool,
122
+ v as abytes,
123
+ W as anumber,
124
+ M as bitLen,
125
+ N as bitMask,
126
+ d as bytesToHex,
127
+ H as bytesToNumberBE,
128
+ O as bytesToNumberLE,
129
+ U as concatBytes,
130
+ R as createHmacDrbg,
131
+ _ as ensureBytes,
132
+ p as hexToBytes,
133
+ h as hexToNumber,
134
+ T as inRange,
135
+ B as isBytes,
136
+ D as memoized,
137
+ x as numberToBytesBE,
138
+ S as numberToBytesLE,
139
+ j as numberToHexUnpadded,
140
+ C as randomBytes,
141
+ G as utf8ToBytes
14
142
  };
package/dist/index295.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function o(e){if(/[^a-z0-9\:\/\?\#\[\]\@\!\$\&\'\(\)\*\+\,\;\=\.\-\_\~\%]/i.test(e)||/%[^0-9a-f]/i.test(e)||/%[0-9a-f](:?[^0-9a-f]|$)/i.test(e))return!1;const s=a(e),f=s[1],t=s[2],i=s[3],r=s[4],l=s[5];if(!(f!=null&&f.length&&i.length>=0))return!1;if(t!=null&&t.length){if(!(i.length===0||/^\//.test(i)))return!1}else if(/^\/\//.test(i))return!1;if(!/^[a-z][a-z0-9\+\-\.]*$/.test(f.toLowerCase()))return!1;let n="";return n+=`${f}:`,t!=null&&t.length&&(n+=`//${t}`),n+=i,r!=null&&r.length&&(n+=`?${r}`),l!=null&&l.length&&(n+=`#${l}`),n}function a(e){return e.match(/(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/)}exports.isUri=o;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index287.cjs");class r extends i.Hash{constructor(t,h){super(),this.finished=!1,this.destroyed=!1,i.ahash(t);const n=i.toBytes(h);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const a=this.blockLen,e=new Uint8Array(a);e.set(n.length>a?t.create().update(n).digest():n);for(let s=0;s<e.length;s++)e[s]^=54;this.iHash.update(e),this.oHash=t.create();for(let s=0;s<e.length;s++)e[s]^=106;this.oHash.update(e),i.clean(e)}update(t){return i.aexists(this),this.iHash.update(t),this}digestInto(t){i.aexists(this),i.abytes(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:h,iHash:n,finished:a,destroyed:e,blockLen:s,outputLen:d}=this;return t=t,t.finished=a,t.destroyed=e,t.blockLen=s,t.outputLen=d,t.oHash=h._cloneInto(t.oHash),t.iHash=n._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const c=(o,t,h)=>new r(o,t).update(h).digest();c.create=(o,t)=>new r(o,t);exports.HMAC=r;exports.hmac=c;
package/dist/index295.js CHANGED
@@ -1,22 +1,45 @@
1
- function o(e) {
2
- if (/[^a-z0-9\:\/\?\#\[\]\@\!\$\&\'\(\)\*\+\,\;\=\.\-\_\~\%]/i.test(e) || /%[^0-9a-f]/i.test(e) || /%[0-9a-f](:?[^0-9a-f]|$)/i.test(e))
3
- return !1;
4
- const s = a(e), f = s[1], t = s[2], i = s[3], r = s[4], l = s[5];
5
- if (!(f != null && f.length && i.length >= 0))
6
- return !1;
7
- if (t != null && t.length) {
8
- if (!(i.length === 0 || /^\//.test(i)))
9
- return !1;
10
- } else if (/^\/\//.test(i))
11
- return !1;
12
- if (!/^[a-z][a-z0-9\+\-\.]*$/.test(f.toLowerCase()))
13
- return !1;
14
- let n = "";
15
- return n += `${f}:`, t != null && t.length && (n += `//${t}`), n += i, r != null && r.length && (n += `?${r}`), l != null && l.length && (n += `#${l}`), n;
16
- }
17
- function a(e) {
18
- return e.match(/(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/);
1
+ import { Hash as d, ahash as u, toBytes as H, clean as l, aexists as a, abytes as p } from "./index287.js";
2
+ class r extends d {
3
+ constructor(t, i) {
4
+ super(), this.finished = !1, this.destroyed = !1, u(t);
5
+ const h = H(i);
6
+ if (this.iHash = t.create(), typeof this.iHash.update != "function")
7
+ throw new Error("Expected instance of class which extends utils.Hash");
8
+ this.blockLen = this.iHash.blockLen, this.outputLen = this.iHash.outputLen;
9
+ const o = this.blockLen, e = new Uint8Array(o);
10
+ e.set(h.length > o ? t.create().update(h).digest() : h);
11
+ for (let s = 0; s < e.length; s++)
12
+ e[s] ^= 54;
13
+ this.iHash.update(e), this.oHash = t.create();
14
+ for (let s = 0; s < e.length; s++)
15
+ e[s] ^= 106;
16
+ this.oHash.update(e), l(e);
17
+ }
18
+ update(t) {
19
+ return a(this), this.iHash.update(t), this;
20
+ }
21
+ digestInto(t) {
22
+ a(this), p(t, this.outputLen), this.finished = !0, this.iHash.digestInto(t), this.oHash.update(t), this.oHash.digestInto(t), this.destroy();
23
+ }
24
+ digest() {
25
+ const t = new Uint8Array(this.oHash.outputLen);
26
+ return this.digestInto(t), t;
27
+ }
28
+ _cloneInto(t) {
29
+ t || (t = Object.create(Object.getPrototypeOf(this), {}));
30
+ const { oHash: i, iHash: h, finished: o, destroyed: e, blockLen: s, outputLen: c } = this;
31
+ return t = t, t.finished = o, t.destroyed = e, t.blockLen = s, t.outputLen = c, t.oHash = i._cloneInto(t.oHash), t.iHash = h._cloneInto(t.iHash), t;
32
+ }
33
+ clone() {
34
+ return this._cloneInto();
35
+ }
36
+ destroy() {
37
+ this.destroyed = !0, this.oHash.destroy(), this.iHash.destroy();
38
+ }
19
39
  }
40
+ const y = (n, t, i) => new r(n, t).update(i).digest();
41
+ y.create = (n, t) => new r(n, t);
20
42
  export {
21
- o as isUri
43
+ r as HMAC,
44
+ y as hmac
22
45
  };
package/dist/index296.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index287.cjs");/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const d=BigInt(0),g=BigInt(1);function T(e,t){if(typeof t!="boolean")throw new Error(e+" boolean expected, got "+t)}function x(e){const t=e.toString(16);return t.length&1?"0"+t:t}function w(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return e===""?d:BigInt("0x"+e)}function v(e){return w(i.bytesToHex(e))}function U(e){return i.abytes(e),w(i.bytesToHex(Uint8Array.from(e).reverse()))}function h(e,t){return i.hexToBytes(e.toString(16).padStart(t*2,"0"))}function H(e,t){return h(e,t).reverse()}function A(e,t,r){let o;if(typeof t=="string")try{o=i.hexToBytes(t)}catch(n){throw new Error(e+" must be hex string or Uint8Array, cause: "+n)}else if(i.isBytes(t))o=Uint8Array.from(t);else throw new Error(e+" must be hex string or Uint8Array");const s=o.length;if(typeof r=="number"&&s!==r)throw new Error(e+" of length "+r+" expected, got "+s);return o}const m=e=>typeof e=="bigint"&&d<=e;function p(e,t,r){return m(e)&&m(t)&&m(r)&&t<=e&&e<r}function I(e,t,r,o){if(!p(t,r,o))throw new Error("expected valid "+e+": "+r+" <= n < "+o+", got "+t)}function j(e){let t;for(t=0;e>d;e>>=g,t+=1);return t}const k=e=>(g<<BigInt(e))-g;function N(e,t,r){if(typeof e!="number"||e<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof r!="function")throw new Error("hmacFn must be a function");const o=u=>new Uint8Array(u),s=u=>Uint8Array.of(u);let n=o(e),c=o(e),f=0;const a=()=>{n.fill(1),c.fill(0),f=0},b=(...u)=>r(c,n,...u),B=(u=o(0))=>{c=b(s(0),u),n=b(),u.length!==0&&(c=b(s(1),u),n=b())},E=()=>{if(f++>=1e3)throw new Error("drbg: tried 1000 values");let u=0;const y=[];for(;u<t;){n=b();const l=n.slice();y.push(l),u+=n.length}return i.concatBytes(...y)};return(u,y)=>{a(),B(u);let l;for(;!(l=y(E()));)B();return a(),l}}function O(e,t,r={}){if(!e||typeof e!="object")throw new Error("expected valid options object");function o(s,n,c){const f=e[s];if(c&&f===void 0)return;const a=typeof f;if(a!==n||f===null)throw new Error(`param "${s}" is invalid: expected ${n}, got ${a}`)}Object.entries(t).forEach(([s,n])=>o(s,n,!1)),Object.entries(r).forEach(([s,n])=>o(s,n,!0))}function S(e){const t=new WeakMap;return(r,...o)=>{const s=t.get(r);if(s!==void 0)return s;const n=e(r,...o);return t.set(r,n),n}}exports.abytes=i.abytes;exports.anumber=i.anumber;exports.bytesToHex=i.bytesToHex;exports.concatBytes=i.concatBytes;exports.hexToBytes=i.hexToBytes;exports.isBytes=i.isBytes;exports.randomBytes=i.randomBytes;exports.utf8ToBytes=i.utf8ToBytes;exports._validateObject=O;exports.aInRange=I;exports.abool=T;exports.bitLen=j;exports.bitMask=k;exports.bytesToNumberBE=v;exports.bytesToNumberLE=U;exports.createHmacDrbg=N;exports.ensureBytes=A;exports.hexToNumber=w;exports.inRange=p;exports.memoized=S;exports.numberToBytesBE=h;exports.numberToBytesLE=H;exports.numberToHexUnpadded=x;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("./index287.cjs");function p(o,t,s,i){if(typeof o.setBigUint64=="function")return o.setBigUint64(t,s,i);const n=BigInt(32),r=BigInt(4294967295),e=Number(s>>n&r),h=Number(s&r),u=i?4:0,l=i?0:4;o.setUint32(t+u,e,i),o.setUint32(t+l,h,i)}function g(o,t,s){return o&t^~o&s}function b(o,t,s){return o&t^o&s^t&s}class d extends f.Hash{constructor(t,s,i,n){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=t,this.outputLen=s,this.padOffset=i,this.isLE=n,this.buffer=new Uint8Array(t),this.view=f.createView(this.buffer)}update(t){f.aexists(this),t=f.toBytes(t),f.abytes(t);const{view:s,buffer:i,blockLen:n}=this,r=t.length;for(let e=0;e<r;){const h=Math.min(n-this.pos,r-e);if(h===n){const u=f.createView(t);for(;n<=r-e;e+=n)this.process(u,e);continue}i.set(t.subarray(e,e+h),this.pos),this.pos+=h,e+=h,this.pos===n&&(this.process(s,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){f.aexists(this),f.aoutput(t,this),this.finished=!0;const{buffer:s,view:i,blockLen:n,isLE:r}=this;let{pos:e}=this;s[e++]=128,f.clean(this.buffer.subarray(e)),this.padOffset>n-e&&(this.process(i,0),e=0);for(let c=e;c<n;c++)s[c]=0;p(i,n-8,BigInt(this.length*8),r),this.process(i,0);const h=f.createView(t),u=this.outputLen;if(u%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const l=u/4,a=this.get();if(l>a.length)throw new Error("_sha2: outputLen bigger than state");for(let c=0;c<l;c++)h.setUint32(4*c,a[c],r)}digest(){const{buffer:t,outputLen:s}=this;this.digestInto(t);const i=t.slice(0,s);return this.destroy(),i}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:s,buffer:i,length:n,finished:r,destroyed:e,pos:h}=this;return t.destroyed=e,t.finished=r,t.length=n,t.pos=h,n%s&&t.buffer.set(i),t}clone(){return this._cloneInto()}}const w=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);exports.Chi=g;exports.HashMD=d;exports.Maj=b;exports.SHA256_IV=w;exports.setBigUint64=p;
package/dist/index296.js CHANGED
@@ -1,142 +1,81 @@
1
- import { hexToBytes as p, isBytes as B, abytes as v, bytesToHex as d, concatBytes as U } from "./index287.js";
2
- import { anumber as W, randomBytes as C, utf8ToBytes as G } from "./index287.js";
3
- /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
4
- const y = /* @__PURE__ */ BigInt(0), g = /* @__PURE__ */ BigInt(1);
5
- function k(t, r) {
6
- if (typeof r != "boolean")
7
- throw new Error(t + " boolean expected, got " + r);
1
+ import { Hash as g, createView as l, aexists as b, toBytes as a, abytes as d, aoutput as x, clean as w } from "./index287.js";
2
+ function y(o, t, s, n) {
3
+ if (typeof o.setBigUint64 == "function")
4
+ return o.setBigUint64(t, s, n);
5
+ const i = BigInt(32), h = BigInt(4294967295), e = Number(s >> i & h), r = Number(s & h), c = n ? 4 : 0, u = n ? 0 : 4;
6
+ o.setUint32(t + c, e, n), o.setUint32(t + u, r, n);
8
7
  }
9
- function j(t) {
10
- const r = t.toString(16);
11
- return r.length & 1 ? "0" + r : r;
8
+ function U(o, t, s) {
9
+ return o & t ^ ~o & s;
12
10
  }
13
- function h(t) {
14
- if (typeof t != "string")
15
- throw new Error("hex string expected, got " + typeof t);
16
- return t === "" ? y : BigInt("0x" + t);
11
+ function _(o, t, s) {
12
+ return o & t ^ o & s ^ t & s;
17
13
  }
18
- function H(t) {
19
- return h(d(t));
20
- }
21
- function O(t) {
22
- return v(t), h(d(Uint8Array.from(t).reverse()));
23
- }
24
- function x(t, r) {
25
- return p(t.toString(16).padStart(r * 2, "0"));
26
- }
27
- function S(t, r) {
28
- return x(t, r).reverse();
29
- }
30
- function _(t, r, n) {
31
- let o;
32
- if (typeof r == "string")
33
- try {
34
- o = p(r);
35
- } catch (e) {
36
- throw new Error(t + " must be hex string or Uint8Array, cause: " + e);
37
- }
38
- else if (B(r))
39
- o = Uint8Array.from(r);
40
- else
41
- throw new Error(t + " must be hex string or Uint8Array");
42
- const i = o.length;
43
- if (typeof n == "number" && i !== n)
44
- throw new Error(t + " of length " + n + " expected, got " + i);
45
- return o;
46
- }
47
- const w = (t) => typeof t == "bigint" && y <= t;
48
- function T(t, r, n) {
49
- return w(t) && w(r) && w(n) && r <= t && t < n;
50
- }
51
- function $(t, r, n, o) {
52
- if (!T(r, n, o))
53
- throw new Error("expected valid " + t + ": " + n + " <= n < " + o + ", got " + r);
54
- }
55
- function M(t) {
56
- let r;
57
- for (r = 0; t > y; t >>= g, r += 1)
58
- ;
59
- return r;
60
- }
61
- const N = (t) => (g << BigInt(t)) - g;
62
- function R(t, r, n) {
63
- if (typeof t != "number" || t < 2)
64
- throw new Error("hashLen must be a number");
65
- if (typeof r != "number" || r < 2)
66
- throw new Error("qByteLen must be a number");
67
- if (typeof n != "function")
68
- throw new Error("hmacFn must be a function");
69
- const o = (u) => new Uint8Array(u), i = (u) => Uint8Array.of(u);
70
- let e = o(t), s = o(t), f = 0;
71
- const c = () => {
72
- e.fill(1), s.fill(0), f = 0;
73
- }, l = (...u) => n(s, e, ...u), m = (u = o(0)) => {
74
- s = l(i(0), u), e = l(), u.length !== 0 && (s = l(i(1), u), e = l());
75
- }, E = () => {
76
- if (f++ >= 1e3)
77
- throw new Error("drbg: tried 1000 values");
78
- let u = 0;
79
- const a = [];
80
- for (; u < r; ) {
81
- e = l();
82
- const b = e.slice();
83
- a.push(b), u += e.length;
14
+ class m extends g {
15
+ constructor(t, s, n, i) {
16
+ super(), this.finished = !1, this.length = 0, this.pos = 0, this.destroyed = !1, this.blockLen = t, this.outputLen = s, this.padOffset = n, this.isLE = i, this.buffer = new Uint8Array(t), this.view = l(this.buffer);
17
+ }
18
+ update(t) {
19
+ b(this), t = a(t), d(t);
20
+ const { view: s, buffer: n, blockLen: i } = this, h = t.length;
21
+ for (let e = 0; e < h; ) {
22
+ const r = Math.min(i - this.pos, h - e);
23
+ if (r === i) {
24
+ const c = l(t);
25
+ for (; i <= h - e; e += i)
26
+ this.process(c, e);
27
+ continue;
28
+ }
29
+ n.set(t.subarray(e, e + r), this.pos), this.pos += r, e += r, this.pos === i && (this.process(s, 0), this.pos = 0);
84
30
  }
85
- return U(...a);
86
- };
87
- return (u, a) => {
88
- c(), m(u);
89
- let b;
90
- for (; !(b = a(E())); )
91
- m();
92
- return c(), b;
93
- };
94
- }
95
- function z(t, r, n = {}) {
96
- if (!t || typeof t != "object")
97
- throw new Error("expected valid options object");
98
- function o(i, e, s) {
99
- const f = t[i];
100
- if (s && f === void 0)
101
- return;
102
- const c = typeof f;
103
- if (c !== e || f === null)
104
- throw new Error(`param "${i}" is invalid: expected ${e}, got ${c}`);
31
+ return this.length += t.length, this.roundClean(), this;
32
+ }
33
+ digestInto(t) {
34
+ b(this), x(t, this), this.finished = !0;
35
+ const { buffer: s, view: n, blockLen: i, isLE: h } = this;
36
+ let { pos: e } = this;
37
+ s[e++] = 128, w(this.buffer.subarray(e)), this.padOffset > i - e && (this.process(n, 0), e = 0);
38
+ for (let f = e; f < i; f++)
39
+ s[f] = 0;
40
+ y(n, i - 8, BigInt(this.length * 8), h), this.process(n, 0);
41
+ const r = l(t), c = this.outputLen;
42
+ if (c % 4)
43
+ throw new Error("_sha2: outputLen should be aligned to 32bit");
44
+ const u = c / 4, p = this.get();
45
+ if (u > p.length)
46
+ throw new Error("_sha2: outputLen bigger than state");
47
+ for (let f = 0; f < u; f++)
48
+ r.setUint32(4 * f, p[f], h);
49
+ }
50
+ digest() {
51
+ const { buffer: t, outputLen: s } = this;
52
+ this.digestInto(t);
53
+ const n = t.slice(0, s);
54
+ return this.destroy(), n;
55
+ }
56
+ _cloneInto(t) {
57
+ t || (t = new this.constructor()), t.set(...this.get());
58
+ const { blockLen: s, buffer: n, length: i, finished: h, destroyed: e, pos: r } = this;
59
+ return t.destroyed = e, t.finished = h, t.length = i, t.pos = r, i % s && t.buffer.set(n), t;
60
+ }
61
+ clone() {
62
+ return this._cloneInto();
105
63
  }
106
- Object.entries(r).forEach(([i, e]) => o(i, e, !1)), Object.entries(n).forEach(([i, e]) => o(i, e, !0));
107
- }
108
- function D(t) {
109
- const r = /* @__PURE__ */ new WeakMap();
110
- return (n, ...o) => {
111
- const i = r.get(n);
112
- if (i !== void 0)
113
- return i;
114
- const e = t(n, ...o);
115
- return r.set(n, e), e;
116
- };
117
64
  }
65
+ const B = /* @__PURE__ */ Uint32Array.from([
66
+ 1779033703,
67
+ 3144134277,
68
+ 1013904242,
69
+ 2773480762,
70
+ 1359893119,
71
+ 2600822924,
72
+ 528734635,
73
+ 1541459225
74
+ ]);
118
75
  export {
119
- z as _validateObject,
120
- $ as aInRange,
121
- k as abool,
122
- v as abytes,
123
- W as anumber,
124
- M as bitLen,
125
- N as bitMask,
126
- d as bytesToHex,
127
- H as bytesToNumberBE,
128
- O as bytesToNumberLE,
129
- U as concatBytes,
130
- R as createHmacDrbg,
131
- _ as ensureBytes,
132
- p as hexToBytes,
133
- h as hexToNumber,
134
- T as inRange,
135
- B as isBytes,
136
- D as memoized,
137
- x as numberToBytesBE,
138
- S as numberToBytesLE,
139
- j as numberToHexUnpadded,
140
- C as randomBytes,
141
- G as utf8ToBytes
76
+ U as Chi,
77
+ m as HashMD,
78
+ _ as Maj,
79
+ B as SHA256_IV,
80
+ y as setBigUint64
142
81
  };
package/dist/index297.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index287.cjs");class r extends i.Hash{constructor(t,h){super(),this.finished=!1,this.destroyed=!1,i.ahash(t);const n=i.toBytes(h);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const a=this.blockLen,e=new Uint8Array(a);e.set(n.length>a?t.create().update(n).digest():n);for(let s=0;s<e.length;s++)e[s]^=54;this.iHash.update(e),this.oHash=t.create();for(let s=0;s<e.length;s++)e[s]^=106;this.oHash.update(e),i.clean(e)}update(t){return i.aexists(this),this.iHash.update(t),this}digestInto(t){i.aexists(this),i.abytes(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:h,iHash:n,finished:a,destroyed:e,blockLen:s,outputLen:d}=this;return t=t,t.finished=a,t.destroyed=e,t.blockLen=s,t.outputLen=d,t.oHash=h._cloneInto(t.oHash),t.iHash=n._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const c=(o,t,h)=>new r(o,t).update(h).digest();c.create=(o,t)=>new r(o,t);exports.HMAC=r;exports.hmac=c;
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;