@gardenfi/utils 2.4.1 → 2.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index10.cjs +1 -1
- package/dist/index10.js +4 -4
- package/dist/index107.cjs +1 -1
- package/dist/index107.js +1 -1
- package/dist/index110.cjs +1 -1
- package/dist/index110.js +1 -1
- package/dist/index111.cjs +1 -1
- package/dist/index111.js +4 -4
- package/dist/index113.cjs +1 -1
- package/dist/index113.js +1 -1
- package/dist/index114.cjs +1 -1
- package/dist/index114.js +1 -1
- package/dist/index115.cjs +1 -1
- package/dist/index115.js +1 -1
- package/dist/index116.cjs +1 -1
- package/dist/index116.js +1 -1
- package/dist/index16.cjs +1 -1
- package/dist/index16.js +4 -4
- package/dist/index18.cjs +1 -1
- package/dist/index18.js +2 -2
- package/dist/index23.cjs +1 -1
- package/dist/index23.js +6 -6
- package/dist/index233.cjs +1 -1
- package/dist/index233.js +25 -10
- package/dist/index234.cjs +1 -1
- package/dist/index234.js +13 -16
- package/dist/index235.cjs +1 -1
- package/dist/index235.js +14 -21
- package/dist/index236.cjs +1 -1
- package/dist/index236.js +5 -30
- package/dist/index237.cjs +1 -1
- package/dist/index237.js +14 -2
- package/dist/index238.cjs +1 -1
- package/dist/index238.js +9 -12
- package/dist/index239.cjs +1 -1
- package/dist/index239.js +16 -12
- package/dist/index24.cjs +1 -1
- package/dist/index24.js +31 -13
- package/dist/index240.cjs +1 -1
- package/dist/index240.js +10 -47
- package/dist/index241.cjs +1 -1
- package/dist/index241.js +15 -10
- package/dist/index242.cjs +1 -1
- package/dist/index242.js +22 -7
- package/dist/index243.cjs +1 -1
- package/dist/index243.js +30 -9
- package/dist/index244.cjs +1 -1
- package/dist/index244.js +2 -14
- package/dist/index245.cjs +1 -1
- package/dist/index245.js +13 -14
- package/dist/index246.cjs +1 -1
- package/dist/index246.js +12 -9
- package/dist/index247.cjs +1 -1
- package/dist/index247.js +47 -24
- package/dist/index248.cjs +1 -1
- package/dist/index248.js +11 -12
- package/dist/index249.cjs +1 -1
- package/dist/index249.js +7 -24
- package/dist/index25.cjs +1 -1
- package/dist/index25.js +32 -58
- package/dist/index250.cjs +1 -1
- package/dist/index250.js +8 -12
- package/dist/index251.cjs +1 -1
- package/dist/index251.js +13 -15
- package/dist/index252.cjs +1 -2
- package/dist/index252.js +11 -21
- package/dist/index253.cjs +1 -1
- package/dist/index253.js +9 -52
- package/dist/index254.cjs +1 -1
- package/dist/index254.js +24 -25
- package/dist/index255.cjs +1 -1
- package/dist/index255.js +12 -13
- package/dist/index256.cjs +1 -1
- package/dist/index256.js +24 -15
- package/dist/index257.cjs +1 -1
- package/dist/index257.js +13 -5
- package/dist/index258.cjs +1 -1
- package/dist/index258.js +15 -13
- package/dist/index259.cjs +2 -1
- package/dist/index259.js +24 -10
- package/dist/index26.cjs +1 -16
- package/dist/index26.js +11 -113
- package/dist/index260.cjs +1 -1
- package/dist/index260.js +52 -16
- package/dist/index27.cjs +1 -1
- package/dist/index27.js +58 -32
- package/dist/index28.cjs +1 -1
- package/dist/index28.js +12 -26
- package/dist/index280.cjs +1 -1
- package/dist/index280.js +1 -1
- package/dist/index282.cjs +1 -1
- package/dist/index282.js +1 -1
- package/dist/index287.cjs +1 -1
- package/dist/index287.js +1 -1
- package/dist/index288.cjs +1 -1
- package/dist/index288.js +139 -3
- package/dist/index289.cjs +1 -1
- package/dist/index289.js +39 -137
- package/dist/index29.cjs +16 -1
- package/dist/index29.js +113 -7
- package/dist/index290.cjs +1 -1
- package/dist/index290.js +72 -149
- package/dist/index291.cjs +1 -1
- package/dist/index291.js +2 -10
- package/dist/index292.cjs +1 -1
- package/dist/index292.js +3 -113
- package/dist/index293.cjs +1 -2
- package/dist/index293.js +128 -122
- package/dist/index294.cjs +1 -1
- package/dist/index294.js +153 -137
- package/dist/index295.cjs +1 -1
- package/dist/index295.js +9 -42
- package/dist/index296.cjs +1 -1
- package/dist/index296.js +107 -72
- package/dist/index297.cjs +2 -1
- package/dist/index297.js +135 -2
- package/dist/index30.cjs +1 -1
- package/dist/index30.js +27 -31
- package/dist/index301.cjs +1 -1
- package/dist/index301.js +2 -2
- package/dist/index302.cjs +1 -1
- package/dist/index302.js +1 -1
- package/dist/index305.cjs +1 -1
- package/dist/index305.js +1 -1
- package/dist/index306.cjs +1 -1
- package/dist/index306.js +1 -1
- package/dist/index31.cjs +1 -1
- package/dist/index31.js +8 -12
- package/dist/index310.cjs +1 -1
- package/dist/index310.js +2 -2
- package/dist/index311.cjs +1 -1
- package/dist/index311.js +1 -1
- package/dist/index33.cjs +1 -1
- package/dist/index33.js +1 -1
- package/dist/index39.cjs +1 -1
- package/dist/index39.js +1 -1
- package/dist/index56.cjs +1 -1
- package/dist/index56.js +2 -2
- package/dist/index57.cjs +1 -1
- package/dist/index57.js +1 -1
- package/dist/index58.cjs +1 -1
- package/dist/index58.js +2 -2
- package/dist/index59.cjs +1 -1
- package/dist/index59.js +1 -1
- package/dist/index60.cjs +1 -1
- package/dist/index60.js +2 -2
- package/dist/index61.cjs +1 -1
- package/dist/index61.js +6 -6
- package/dist/index62.cjs +1 -1
- package/dist/index62.js +2 -2
- package/dist/index63.cjs +1 -1
- package/dist/index63.js +1 -1
- package/dist/index64.cjs +1 -1
- package/dist/index64.js +1 -1
- package/dist/index65.cjs +1 -1
- package/dist/index65.js +1 -1
- package/dist/index67.cjs +1 -1
- package/dist/index67.js +4 -4
- package/dist/index76.cjs +1 -1
- package/dist/index76.js +1 -1
- package/dist/index77.cjs +1 -1
- package/dist/index77.js +1 -1
- package/dist/index82.cjs +1 -1
- package/dist/index82.js +1 -1
- package/dist/index88.cjs +1 -1
- package/dist/index88.js +3 -3
- package/dist/index89.cjs +1 -1
- package/dist/index89.js +2 -2
- package/dist/index91.cjs +1 -1
- package/dist/index91.js +1 -1
- package/dist/index92.cjs +1 -1
- package/dist/index92.js +1 -1
- package/dist/index98.cjs +1 -1
- package/dist/index98.js +1 -1
- package/package.json +1 -1
package/dist/index260.js
CHANGED
|
@@ -1,19 +1,55 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import { universalSignatureValidatorAbi as g } from "./index22.js";
|
|
2
|
+
import { universalSignatureValidatorByteCode as S } from "./index121.js";
|
|
3
|
+
import { CallExecutionError as h } from "./index130.js";
|
|
4
|
+
import { encodeDeployData as v } from "./index177.js";
|
|
5
|
+
import { getAddress as x } from "./index162.js";
|
|
6
|
+
import { isAddressEqual as b } from "./index184.js";
|
|
7
|
+
import { isHex as A } from "./index188.js";
|
|
8
|
+
import { bytesToHex as w } from "./index153.js";
|
|
9
|
+
import { getAction as E } from "./index32.js";
|
|
10
|
+
import { isErc6492Signature as V } from "./index198.js";
|
|
11
|
+
import { recoverAddress as D } from "./index192.js";
|
|
12
|
+
import { serializeErc6492Signature as H } from "./index199.js";
|
|
13
|
+
import { serializeSignature as z } from "./index196.js";
|
|
14
|
+
import { call as B } from "./index61.js";
|
|
15
|
+
import { encodeFunctionData as C } from "./index180.js";
|
|
16
|
+
import { hexToBool as T } from "./index185.js";
|
|
17
|
+
async function W(o, y) {
|
|
18
|
+
var u, d, p;
|
|
19
|
+
const { address: i, factory: n, factoryData: s, hash: a, signature: r, universalSignatureVerifierAddress: f = (p = (d = (u = o.chain) == null ? void 0 : u.contracts) == null ? void 0 : d.universalSignatureVerifier) == null ? void 0 : p.address, ...m } = y, t = A(r) ? r : typeof r == "object" && "r" in r && "s" in r ? z(r) : w(r), c = await (async () => !n && !s || V(t) ? t : H({
|
|
20
|
+
address: n,
|
|
21
|
+
data: s,
|
|
22
|
+
signature: t
|
|
23
|
+
}))();
|
|
24
|
+
try {
|
|
25
|
+
const e = f ? {
|
|
26
|
+
to: f,
|
|
27
|
+
data: C({
|
|
28
|
+
abi: g,
|
|
29
|
+
functionName: "isValidSig",
|
|
30
|
+
args: [i, a, c]
|
|
31
|
+
}),
|
|
32
|
+
...m
|
|
33
|
+
} : {
|
|
34
|
+
data: v({
|
|
35
|
+
abi: g,
|
|
36
|
+
args: [i, a, c],
|
|
37
|
+
bytecode: S
|
|
38
|
+
}),
|
|
39
|
+
...m
|
|
40
|
+
}, { data: l } = await E(o, B, "call")(e);
|
|
41
|
+
return T(l ?? "0x0");
|
|
42
|
+
} catch (e) {
|
|
43
|
+
try {
|
|
44
|
+
if (b(x(i), await D({ hash: a, signature: r })))
|
|
45
|
+
return !0;
|
|
46
|
+
} catch {
|
|
47
|
+
}
|
|
48
|
+
if (e instanceof h)
|
|
49
|
+
return !1;
|
|
50
|
+
throw e;
|
|
51
|
+
}
|
|
16
52
|
}
|
|
17
53
|
export {
|
|
18
|
-
|
|
54
|
+
W as verifyHash
|
|
19
55
|
};
|
package/dist/index27.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const j=require("./index50.cjs"),E=require("./index51.cjs"),F=require("./index52.cjs"),H=require("./index53.cjs"),U=require("./index54.cjs");function _(k,r={}){const{batch:o,fetchOptions:u,key:l="http",methods:h,name:q="HTTP JSON-RPC",onFetchRequest:d,onFetchResponse:y,retryDelay:R,raw:f}=r;return({chain:n,retryCount:w,timeout:S})=>{const{batchSize:m=1e3,wait:C=0}=typeof o=="object"?o:{},b=r.retryCount??w,c=S??r.timeout??1e4,e=n==null?void 0:n.rpcUrls.default.http[0];if(!e)throw new E.UrlRequiredError;const a=H.getHttpRpcClient(e,{fetchOptions:u,onRequest:d,onResponse:y,timeout:c});return U.createTransport({key:l,methods:h,name:q,async request({method:T,params:B}){const i={method:T,params:B},{schedule:O}=F.createBatchScheduler({id:e,wait:C,shouldSplitBatch(t){return t.length>m},fn:t=>a.request({body:t}),sort:(t,g)=>t.id-g.id}),P=async t=>o?O(t):[await a.request({body:t})],[{error:s,result:p}]=await P(i);if(f)return{error:s,result:p};if(s)throw new j.RpcRequestError({body:i,error:s,url:e});return p},retryCount:b,retryDelay:R,timeout:c,type:"http"},{fetchOptions:u,url:e})}}exports.http=_;
|
package/dist/index27.js
CHANGED
|
@@ -1,34 +1,60 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
})
|
|
1
|
+
import { RpcRequestError as O } from "./index50.js";
|
|
2
|
+
import { UrlRequiredError as P } from "./index51.js";
|
|
3
|
+
import { createBatchScheduler as U } from "./index52.js";
|
|
4
|
+
import { getHttpRpcClient as _ } from "./index53.js";
|
|
5
|
+
import { createTransport as j } from "./index54.js";
|
|
6
|
+
function g(k, e = {}) {
|
|
7
|
+
const { batch: o, fetchOptions: u, key: m = "http", methods: a, name: h = "HTTP JSON-RPC", onFetchRequest: f, onFetchResponse: y, retryDelay: d, raw: R } = e;
|
|
8
|
+
return ({ chain: n, retryCount: w, timeout: q }) => {
|
|
9
|
+
const { batchSize: C = 1e3, wait: S = 0 } = typeof o == "object" ? o : {}, b = e.retryCount ?? w, c = q ?? e.timeout ?? 1e4, r = n == null ? void 0 : n.rpcUrls.default.http[0];
|
|
10
|
+
if (!r)
|
|
11
|
+
throw new P();
|
|
12
|
+
const p = _(r, {
|
|
13
|
+
fetchOptions: u,
|
|
14
|
+
onRequest: f,
|
|
15
|
+
onResponse: y,
|
|
16
|
+
timeout: c
|
|
17
|
+
});
|
|
18
|
+
return j({
|
|
19
|
+
key: m,
|
|
20
|
+
methods: a,
|
|
21
|
+
name: h,
|
|
22
|
+
async request({ method: T, params: B }) {
|
|
23
|
+
const i = { method: T, params: B }, { schedule: E } = U({
|
|
24
|
+
id: r,
|
|
25
|
+
wait: S,
|
|
26
|
+
shouldSplitBatch(t) {
|
|
27
|
+
return t.length > C;
|
|
28
|
+
},
|
|
29
|
+
fn: (t) => p.request({
|
|
30
|
+
body: t
|
|
31
|
+
}),
|
|
32
|
+
sort: (t, H) => t.id - H.id
|
|
33
|
+
}), F = async (t) => o ? E(t) : [
|
|
34
|
+
await p.request({
|
|
35
|
+
body: t
|
|
36
|
+
})
|
|
37
|
+
], [{ error: s, result: l }] = await F(i);
|
|
38
|
+
if (R)
|
|
39
|
+
return { error: s, result: l };
|
|
40
|
+
if (s)
|
|
41
|
+
throw new O({
|
|
42
|
+
body: i,
|
|
43
|
+
error: s,
|
|
44
|
+
url: r
|
|
45
|
+
});
|
|
46
|
+
return l;
|
|
47
|
+
},
|
|
48
|
+
retryCount: b,
|
|
49
|
+
retryDelay: d,
|
|
50
|
+
timeout: c,
|
|
51
|
+
type: "http"
|
|
52
|
+
}, {
|
|
53
|
+
fetchOptions: u,
|
|
54
|
+
url: r
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
}
|
|
32
58
|
export {
|
|
33
|
-
|
|
59
|
+
g as http
|
|
34
60
|
};
|
package/dist/index28.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index47.cjs"),c=require("./index101.cjs");function r(e){const{key:t="wallet",name:l="Wallet Client",transport:n}=e;return i.createClient({...e,key:t,name:l,transport:n,type:"walletClient"}).extend(c.walletActions)}exports.createWalletClient=r;
|
package/dist/index28.js
CHANGED
|
@@ -1,29 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
*
|
|
13
|
-
* @param {() => Promise<T>} fn - The function to retry
|
|
14
|
-
* @return {Promise<T>} a Promise that resolves to the result of the function
|
|
15
|
-
*/
|
|
16
|
-
async retry(e) {
|
|
17
|
-
let t = 0, r;
|
|
18
|
-
for (; t < this.maxRetries + 1; )
|
|
19
|
-
try {
|
|
20
|
-
return await e();
|
|
21
|
-
} catch (a) {
|
|
22
|
-
t++, r = a, await s(this.delay * t);
|
|
23
|
-
}
|
|
24
|
-
throw r;
|
|
25
|
-
}
|
|
1
|
+
import { createClient as i } from "./index47.js";
|
|
2
|
+
import { walletActions as o } from "./index101.js";
|
|
3
|
+
function m(t) {
|
|
4
|
+
const { key: e = "wallet", name: l = "Wallet Client", transport: n } = t;
|
|
5
|
+
return i({
|
|
6
|
+
...t,
|
|
7
|
+
key: e,
|
|
8
|
+
name: l,
|
|
9
|
+
transport: n,
|
|
10
|
+
type: "walletClient"
|
|
11
|
+
}).extend(o);
|
|
26
12
|
}
|
|
27
13
|
export {
|
|
28
|
-
|
|
14
|
+
m as createWalletClient
|
|
29
15
|
};
|
package/dist/index280.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index290.cjs"),x=require("./index287.cjs"),_=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),f=new Uint32Array(64);class u extends e.HashMD{constructor(o=32){super(64,o,8,!1),this.A=e.SHA256_IV[0]|0,this.B=e.SHA256_IV[1]|0,this.C=e.SHA256_IV[2]|0,this.D=e.SHA256_IV[3]|0,this.E=e.SHA256_IV[4]|0,this.F=e.SHA256_IV[5]|0,this.G=e.SHA256_IV[6]|0,this.H=e.SHA256_IV[7]|0}get(){const{A:o,B:h,C:s,D:a,E:r,F:b,G:c,H:i}=this;return[o,h,s,a,r,b,c,i]}set(o,h,s,a,r,b,c,i){this.A=o|0,this.B=h|0,this.C=s|0,this.D=a|0,this.E=r|0,this.F=b|0,this.G=c|0,this.H=i|0}process(o,h){for(let t=0;t<16;t++,h+=4)f[t]=o.getUint32(h,!1);for(let t=16;t<64;t++){const H=f[t-15],d=f[t-2],S=x.rotr(H,7)^x.rotr(H,18)^H>>>3,l=x.rotr(d,17)^x.rotr(d,19)^d>>>10;f[t]=l+f[t-7]+S+f[t-16]|0}let{A:s,B:a,C:r,D:b,E:c,F:i,G:n,H:A}=this;for(let t=0;t<64;t++){const H=x.rotr(c,6)^x.rotr(c,11)^x.rotr(c,25),d=A+H+e.Chi(c,i,n)+_[t]+f[t]|0,l=(x.rotr(s,2)^x.rotr(s,13)^x.rotr(s,22))+e.Maj(s,a,r)|0;A=n,n=i,i=c,c=b+d|0,b=r,r=a,a=s,s=d+l|0}s=s+this.A|0,a=a+this.B|0,r=r+this.C|0,b=b+this.D|0,c=c+this.E|0,i=i+this.F|0,n=n+this.G|0,A=A+this.H|0,this.set(s,a,r,b,c,i,n,A)}roundClean(){x.clean(f)}destroy(){this.set(0,0,0,0,0,0,0,0),x.clean(this.buffer)}}const I=x.createHasher(()=>new u);exports.SHA256=u;exports.sha256=I;
|
package/dist/index280.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HashMD as D, SHA256_IV as b, Chi as g, Maj as p } from "./
|
|
1
|
+
import { HashMD as D, SHA256_IV as b, Chi as g, Maj as p } from "./index290.js";
|
|
2
2
|
import { createHasher as u, clean as C, rotr as i } from "./index287.js";
|
|
3
3
|
const B = /* @__PURE__ */ Uint32Array.from([
|
|
4
4
|
1116352408,
|
package/dist/index282.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("./index288.cjs"),V=require("./index287.cjs");/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const g=BigInt(0),d=BigInt(1),b=BigInt(2),K=BigInt(3),I=BigInt(4),T=BigInt(5),_=BigInt(8);function h(t,n){const o=t%n;return o>=g?o:n+o}function Q(t,n,o){let r=t;for(;n-- >g;)r*=r,r%=o;return r}function v(t,n){if(t===g)throw new Error("invert: expected non-zero number");if(n<=g)throw new Error("invert: expected positive modulus, got "+n);let o=h(t,n),r=n,s=g,c=d;for(;o!==g;){const u=r/o,i=r%o,a=s-c*u;r=o,o=i,s=c,c=a}if(r!==d)throw new Error("invert: does not exist");return h(s,n)}function L(t,n){const o=(t.ORDER+d)/I,r=t.pow(n,o);if(!t.eql(t.sqr(r),n))throw new Error("Cannot find square root");return r}function Y(t,n){const o=(t.ORDER-T)/_,r=t.mul(n,b),s=t.pow(r,o),c=t.mul(n,s),f=t.mul(t.mul(c,b),s),u=t.mul(c,t.sub(f,t.ONE));if(!t.eql(t.sqr(u),n))throw new Error("Cannot find square root");return u}function x(t){if(t<BigInt(3))throw new Error("sqrt is not defined for small field");let n=t-d,o=0;for(;n%b===g;)n/=b,o++;let r=b;const s=Z(t);for(;y(s,r)===1;)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(o===1)return L;let c=s.pow(r,n);const f=(n+d)/b;return function(i,a){if(i.is0(a))return a;if(y(i,a)!==1)throw new Error("Cannot find square root");let e=o,l=i.mul(i.ONE,c),q=i.pow(a,n),B=i.pow(a,f);for(;!i.eql(q,i.ONE);){if(i.is0(q))return i.ZERO;let m=1,E=i.sqr(q);for(;!i.eql(E,i.ONE);)if(m++,E=i.sqr(E),m===e)throw new Error("Cannot find square root");const H=d<<BigInt(e-m-1),S=i.pow(l,H);e=m,l=i.sqr(S),q=i.mul(q,l),B=i.mul(B,S)}return B}}function M(t){return t%I===K?L:t%_===T?Y:x(t)}const k=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function P(t){const n={ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"},o=k.reduce((r,s)=>(r[s]="function",r),n);return w._validateObject(t,o),t}function j(t,n,o){if(o<g)throw new Error("invalid exponent, negatives unsupported");if(o===g)return t.ONE;if(o===d)return n;let r=t.ONE,s=n;for(;o>g;)o&d&&(r=t.mul(r,s)),s=t.sqr(s),o>>=d;return r}function A(t,n,o=!1){const r=new Array(n.length).fill(o?t.ZERO:void 0),s=n.reduce((f,u,i)=>t.is0(u)?f:(r[i]=f,t.mul(f,u)),t.ONE),c=t.inv(s);return n.reduceRight((f,u,i)=>t.is0(u)?f:(r[i]=t.mul(f,r[i]),t.mul(f,u)),c),r}function y(t,n){const o=(t.ORDER-d)/b,r=t.pow(n,o),s=t.eql(r,t.ONE),c=t.eql(r,t.ZERO),f=t.eql(r,t.neg(t.ONE));if(!s&&!c&&!f)throw new Error("invalid Legendre symbol result");return s?1:c?0:-1}function C(t,n){n!==void 0&&V.anumber(n);const o=n!==void 0?n:t.toString(2).length,r=Math.ceil(o/8);return{nBitLength:o,nByteLength:r}}function Z(t,n,o=!1,r={}){if(t<=g)throw new Error("invalid field: expected ORDER > 0, got "+t);let s,c;if(typeof n=="object"&&n!=null){if(r.sqrt||o)throw new Error("cannot specify opts in two arguments");const e=n;e.BITS&&(s=e.BITS),e.sqrt&&(c=e.sqrt),typeof e.isLE=="boolean"&&(o=e.isLE)}else typeof n=="number"&&(s=n),r.sqrt&&(c=r.sqrt);const{nBitLength:f,nByteLength:u}=C(t,s);if(u>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let i;const a=Object.freeze({ORDER:t,isLE:o,BITS:f,BYTES:u,MASK:w.bitMask(f),ZERO:g,ONE:d,create:e=>h(e,t),isValid:e=>{if(typeof e!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof e);return g<=e&&e<t},is0:e=>e===g,isValidNot0:e=>!a.is0(e)&&a.isValid(e),isOdd:e=>(e&d)===d,neg:e=>h(-e,t),eql:(e,l)=>e===l,sqr:e=>h(e*e,t),add:(e,l)=>h(e+l,t),sub:(e,l)=>h(e-l,t),mul:(e,l)=>h(e*l,t),pow:(e,l)=>j(a,e,l),div:(e,l)=>h(e*v(l,t),t),sqrN:e=>e*e,addN:(e,l)=>e+l,subN:(e,l)=>e-l,mulN:(e,l)=>e*l,inv:e=>v(e,t),sqrt:c||(e=>(i||(i=M(t)),i(a,e))),toBytes:e=>o?w.numberToBytesLE(e,u):w.numberToBytesBE(e,u),fromBytes:e=>{if(e.length!==u)throw new Error("Field.fromBytes: expected "+u+" bytes, got "+e.length);return o?w.bytesToNumberLE(e):w.bytesToNumberBE(e)},invertBatch:e=>A(a,e),cmov:(e,l,q)=>q?l:e});return Object.freeze(a)}function N(t){if(typeof t!="bigint")throw new Error("field order must be bigint");const n=t.toString(2).length;return Math.ceil(n/8)}function z(t){const n=N(t);return n+Math.ceil(n/2)}function $(t,n,o=!1){const r=t.length,s=N(n),c=z(n);if(r<16||r<c||r>1024)throw new Error("expected "+c+"-1024 bytes of input, got "+r);const f=o?w.bytesToNumberLE(t):w.bytesToNumberBE(t),u=h(f,n-d)+d;return o?w.numberToBytesLE(u,s):w.numberToBytesBE(u,s)}exports.Field=Z;exports.FpInvertBatch=A;exports.FpLegendre=y;exports.FpPow=j;exports.FpSqrt=M;exports.getFieldBytesLength=N;exports.getMinHashLength=z;exports.invert=v;exports.mapHashToField=$;exports.mod=h;exports.nLength=C;exports.pow2=Q;exports.tonelliShanks=x;exports.validateField=P;
|
package/dist/index282.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { numberToBytesLE as y, numberToBytesBE as I, bitMask as Z, bytesToNumberLE as S, bytesToNumberBE as _, _validateObject as j } from "./
|
|
1
|
+
import { numberToBytesLE as y, numberToBytesBE as I, bitMask as Z, bytesToNumberLE as S, bytesToNumberBE as _, _validateObject as j } from "./index288.js";
|
|
2
2
|
import { anumber as z } from "./index287.js";
|
|
3
3
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
4
4
|
const g = BigInt(0), d = BigInt(1), q = /* @__PURE__ */ BigInt(2), V = /* @__PURE__ */ BigInt(3), x = /* @__PURE__ */ BigInt(4), T = /* @__PURE__ */ BigInt(5), L = /* @__PURE__ */ BigInt(8);
|
package/dist/index287.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./index291.cjs");/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function p(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function s(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, got "+t)}function c(t,...e){if(!p(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error("Uint8Array expected of length "+e+", got length="+t.length)}function m(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");s(t.outputLen),s(t.blockLen)}function B(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function E(t,e){c(t);const n=e.outputLen;if(t.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function H(t){return new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4))}function U(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}function L(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}function S(t,e){return t<<32-e|t>>>e}const h=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function w(t){return t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255}function g(t){for(let e=0;e<t.length;e++)t[e]=w(t[e]);return t}const T=h?t=>t:g,d=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",V=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function _(t){if(c(t),d)return t.toHex();let e="";for(let n=0;n<t.length;n++)e+=V[t[n]];return e}const f={_0:48,_9:57,A:65,F:70,a:97,f:102};function l(t){if(t>=f._0&&t<=f._9)return t-f._0;if(t>=f.A&&t<=f.F)return t-(f.A-10);if(t>=f.a&&t<=f.f)return t-(f.a-10)}function I(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);if(d)return Uint8Array.fromHex(t);const e=t.length,n=e/2;if(e%2)throw new Error("hex string expected, got unpadded hex of length "+e);const r=new Uint8Array(n);for(let o=0,i=0;o<n;o++,i+=2){const a=l(t.charCodeAt(i)),y=l(t.charCodeAt(i+1));if(a===void 0||y===void 0){const A=t[i]+t[i+1];throw new Error('hex string expected, got non-hex character "'+A+'" at index '+i)}r[o]=a*16+y}return r}function x(t){if(typeof t!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(t))}function b(t){return typeof t=="string"&&(t=x(t)),c(t),t}function k(...t){let e=0;for(let r=0;r<t.length;r++){const o=t[r];c(o),e+=o.length}const n=new Uint8Array(e);for(let r=0,o=0;r<t.length;r++){const i=t[r];n.set(i,o),o+=i.length}return n}class O{}function R(t){const e=r=>t().update(b(r)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}function v(t=32){if(u.crypto&&typeof u.crypto.getRandomValues=="function")return u.crypto.getRandomValues(new Uint8Array(t));if(u.crypto&&typeof u.crypto.randomBytes=="function")return Uint8Array.from(u.crypto.randomBytes(t));throw new Error("crypto.getRandomValues must be defined")}exports.Hash=O;exports.abytes=c;exports.aexists=B;exports.ahash=m;exports.anumber=s;exports.aoutput=E;exports.byteSwap=w;exports.byteSwap32=g;exports.bytesToHex=_;exports.clean=U;exports.concatBytes=k;exports.createHasher=R;exports.createView=L;exports.hexToBytes=I;exports.isBytes=p;exports.isLE=h;exports.randomBytes=v;exports.rotr=S;exports.swap32IfBE=T;exports.toBytes=b;exports.u32=H;exports.utf8ToBytes=x;
|
package/dist/index287.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { crypto as u } from "./
|
|
1
|
+
import { crypto as u } from "./index291.js";
|
|
2
2
|
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
3
3
|
function w(t) {
|
|
4
4
|
return t instanceof Uint8Array || ArrayBuffer.isView(t) && t.constructor.name === "Uint8Array";
|
package/dist/index288.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function t(e){return
|
|
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/index288.js
CHANGED
|
@@ -1,6 +1,142 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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}`);
|
|
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
|
+
};
|
|
3
117
|
}
|
|
4
118
|
export {
|
|
5
|
-
|
|
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
|
|
6
142
|
};
|
package/dist/index289.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
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;
|