@capxul/mcp 4.20.0-beta.41 → 4.20.0-beta.43

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.
@@ -1,8 +1,8 @@
1
- import { G as asCapxulError, V as abandonPrepared, a as prepareConfiguration, bt as noSessionError, d as verifiedPreparation, f as buildCommand, i as authorInvitation, l as preparePermission, o as verifiedConfiguration, on as CAPXUL_OPERATIONS, or as absurd, p as validateReplacementInput, sr as CapxulError, u as preparedIdentity } from "./organizations-D3Z6n79m.mjs";
1
+ import { C as preparePermission, D as validateReplacementInput, E as buildCommand, Fn as noSessionError, Qt as abandonPrepared, T as verifiedPreparation, Yn as absurd, b as proposeInvitation, in as asCapxulError, w as preparedIdentity } from "./organizations-Bg6eIN7c.mjs";
2
2
  //#region ../../packages/sdk/src/accounts/permission-approvals.ts
3
- /** Prepare a Permission write or an invitation's configuration for `signerAddress`, checked. */
3
+ /** Prepare a Permission write for `signerAddress`, checked. */
4
4
  function prepareVerifiedPermissionChange(deps, input, signerAddress, signal) {
5
- return "permission" in input ? prepareVerifiedPermissionWrite(deps, input, signerAddress, signal) : prepareVerifiedInvitation(deps, input, signerAddress, signal);
5
+ return prepareVerifiedPermissionWrite(deps, input, signerAddress, signal);
6
6
  }
7
7
  /**
8
8
  * Hand the verified identity to the caller before the approval opens. A
@@ -25,7 +25,7 @@ async function delivered(deps, executionId, deliver) {
25
25
  value: { executionId }
26
26
  } : abandonPrepared(deps, executionId, "prepared_mismatch", refused);
27
27
  }
28
- /** The command a write sends, decoded exactly as its `org(id).permissions` method decodes it. */
28
+ /** The command a write sends, decoded exactly as its `org(id).allowances` method decodes it. */
29
29
  function command(write) {
30
30
  try {
31
31
  switch (write.operation) {
@@ -78,6 +78,7 @@ async function prepareVerifiedPermissionWrite(deps, input, signerAddress, signal
78
78
  command: built.value,
79
79
  signerAddress,
80
80
  email: session.email,
81
+ safeSaltNamespace: deps.actor?.safeSaltNamespace,
81
82
  chainId: deps.chainId,
82
83
  expectedSnapshotHash
83
84
  };
@@ -92,46 +93,17 @@ async function prepareVerifiedPermissionWrite(deps, input, signerAddress, signal
92
93
  value: { executionId }
93
94
  } : delivered(deps, executionId, () => onPrepared(preparedIdentity(verified.value)));
94
95
  }
95
- async function prepareVerifiedInvitation(deps, input, signerAddress, signal) {
96
- const session = deps.actor?.authSession() ?? null;
97
- if (session === null || deps.chainId === void 0) return {
98
- ok: false,
99
- error: noSessionError(deps.actor)
100
- };
101
- const orgId = input.organizationId;
102
- const authored = await authorInvitation(deps, orgId, input.invite, signal, void 0);
103
- if (!authored.ok) return authored;
104
- const view = authored.value;
105
- if (view.phase !== "authorizing" || view.commandId === null) return {
106
- ok: false,
107
- error: new CapxulError("WRONG_STATE", "The invitation's rights are already set up, or it ended: nothing is left to sign.", { details: {
108
- method: CAPXUL_OPERATIONS.approvals.prepare,
109
- currentState: view.phase,
110
- validStates: ["authorizing"],
111
- invitationId: view.id
112
- } })
113
- };
114
- const preparation = {
115
- orgId,
116
- view,
117
- commandId: view.commandId,
118
- signerAddress,
119
- email: session.email,
120
- chainId: deps.chainId
121
- };
122
- const built = await prepareConfiguration(deps, preparation, signal, void 0);
123
- if (!built.ok) return built;
124
- const { executionId, invitationId, commandId } = built.value;
125
- const verified = verifiedConfiguration(built.value, preparation);
126
- if (!verified.ok) return abandonPrepared(deps, executionId, "prepared_mismatch", verified);
127
- const { onPrepared } = input;
128
- return onPrepared === void 0 ? {
96
+ /**
97
+ * Author the invitation and propose its configuration to the Directors (Budgets
98
+ * A), checked, then open the proposer's approval: the person signs it on the
99
+ * approval page, and their signature counts as the first.
100
+ */
101
+ async function proposeVerifiedInvitation(deps, input, signal) {
102
+ const proposed = await proposeInvitation(deps, input.organizationId, input.invite, signal, void 0, () => void 0, input.onPrepared);
103
+ return proposed.ok ? {
129
104
  ok: true,
130
- value: { executionId }
131
- } : delivered(deps, executionId, () => onPrepared({
132
- invitationId,
133
- commandId
134
- }));
105
+ value: proposed.value.approval
106
+ } : proposed;
135
107
  }
136
108
  //#endregion
137
- export { prepareVerifiedPermissionChange };
109
+ export { prepareVerifiedPermissionChange, proposeVerifiedInvitation };
@@ -0,0 +1,36 @@
1
+ import { createRequire } from "node:module";
2
+ //#region \0rolldown/runtime.js
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
10
+ var __exportAll = (all, no_symbols) => {
11
+ let target = {};
12
+ for (var name in all) __defProp(target, name, {
13
+ get: all[name],
14
+ enumerable: true
15
+ });
16
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
17
+ return target;
18
+ };
19
+ var __copyProps = (to, from, except, desc) => {
20
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
21
+ key = keys[i];
22
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
23
+ get: ((k) => from[k]).bind(null, key),
24
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
25
+ });
26
+ }
27
+ return to;
28
+ };
29
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
30
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
31
+ value: mod,
32
+ enumerable: true
33
+ }) : target, mod));
34
+ var __require = /* #__PURE__ */ (() => createRequire(import.meta.url))();
35
+ //#endregion
36
+ export { __toESM as a, __require as i, __exportAll as n, __reExport as r, __commonJSMin as t };
@@ -0,0 +1,2 @@
1
+ import { t as secp256k1 } from "./secp256k1-DUDiv39Y.mjs";
2
+ export { secp256k1 };
@@ -1,4 +1,424 @@
1
- import { a as ahash, c as clean, d as randomBytes, i as aexists, l as concatBytes$1, n as Hash, o as anumber, p as toBytes, r as abytes$1, t as sha256 } from "./sha2-D5rBHwg7.mjs";
1
+ import * as nc from "node:crypto";
2
+ //#region ../../node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/esm/cryptoNode.js
3
+ /**
4
+ * Internal webcrypto alias.
5
+ * We prefer WebCrypto aka globalThis.crypto, which exists in node.js 16+.
6
+ * Falls back to Node.js built-in crypto for Node.js <=v14.
7
+ * See utils.ts for details.
8
+ * @module
9
+ */
10
+ const crypto = nc && typeof nc === "object" && "webcrypto" in nc ? nc.webcrypto : nc && typeof nc === "object" && "randomBytes" in nc ? nc : void 0;
11
+ //#endregion
12
+ //#region ../../node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/esm/utils.js
13
+ /**
14
+ * Utilities for hex, bytes, CSPRNG.
15
+ * @module
16
+ */
17
+ /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
18
+ /** Checks if something is Uint8Array. Be careful: nodejs Buffer will return true. */
19
+ function isBytes$1(a) {
20
+ return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
21
+ }
22
+ /** Asserts something is positive integer. */
23
+ function anumber(n) {
24
+ if (!Number.isSafeInteger(n) || n < 0) throw new Error("positive integer expected, got " + n);
25
+ }
26
+ /** Asserts something is Uint8Array. */
27
+ function abytes$1(b, ...lengths) {
28
+ if (!isBytes$1(b)) throw new Error("Uint8Array expected");
29
+ if (lengths.length > 0 && !lengths.includes(b.length)) throw new Error("Uint8Array expected of length " + lengths + ", got length=" + b.length);
30
+ }
31
+ /** Asserts something is hash */
32
+ function ahash(h) {
33
+ if (typeof h !== "function" || typeof h.create !== "function") throw new Error("Hash should be wrapped by utils.createHasher");
34
+ anumber(h.outputLen);
35
+ anumber(h.blockLen);
36
+ }
37
+ /** Asserts a hash instance has not been destroyed / finished */
38
+ function aexists(instance, checkFinished = true) {
39
+ if (instance.destroyed) throw new Error("Hash instance has been destroyed");
40
+ if (checkFinished && instance.finished) throw new Error("Hash#digest() has already been called");
41
+ }
42
+ /** Asserts output is properly-sized byte array */
43
+ function aoutput(out, instance) {
44
+ abytes$1(out);
45
+ const min = instance.outputLen;
46
+ if (out.length < min) throw new Error("digestInto() expects output buffer of length at least " + min);
47
+ }
48
+ /** Cast u8 / u16 / u32 to u32. */
49
+ function u32(arr) {
50
+ return new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
51
+ }
52
+ /** Zeroize a byte array. Warning: JS provides no guarantees. */
53
+ function clean(...arrays) {
54
+ for (let i = 0; i < arrays.length; i++) arrays[i].fill(0);
55
+ }
56
+ /** Create DataView of an array for easy byte-level manipulation. */
57
+ function createView(arr) {
58
+ return new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
59
+ }
60
+ /** The rotate right (circular right shift) operation for uint32 */
61
+ function rotr(word, shift) {
62
+ return word << 32 - shift | word >>> shift;
63
+ }
64
+ /** Is current platform little-endian? Most are. Big-Endian platform: IBM */
65
+ const isLE = /* @__PURE__ */ (() => new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68)();
66
+ /** The byte swap operation for uint32 */
67
+ function byteSwap(word) {
68
+ return word << 24 & 4278190080 | word << 8 & 16711680 | word >>> 8 & 65280 | word >>> 24 & 255;
69
+ }
70
+ /** In place byte swap for Uint32Array */
71
+ function byteSwap32(arr) {
72
+ for (let i = 0; i < arr.length; i++) arr[i] = byteSwap(arr[i]);
73
+ return arr;
74
+ }
75
+ const swap32IfBE = isLE ? (u) => u : byteSwap32;
76
+ /**
77
+ * Converts string to bytes using UTF8 encoding.
78
+ * @example utf8ToBytes('abc') // Uint8Array.from([97, 98, 99])
79
+ */
80
+ function utf8ToBytes(str) {
81
+ if (typeof str !== "string") throw new Error("string expected");
82
+ return new Uint8Array(new TextEncoder().encode(str));
83
+ }
84
+ /**
85
+ * Normalizes (non-hex) string or Uint8Array to Uint8Array.
86
+ * Warning: when Uint8Array is passed, it would NOT get copied.
87
+ * Keep in mind for future mutable operations.
88
+ */
89
+ function toBytes(data) {
90
+ if (typeof data === "string") data = utf8ToBytes(data);
91
+ abytes$1(data);
92
+ return data;
93
+ }
94
+ /** Copies several Uint8Arrays into one. */
95
+ function concatBytes$1(...arrays) {
96
+ let sum = 0;
97
+ for (let i = 0; i < arrays.length; i++) {
98
+ const a = arrays[i];
99
+ abytes$1(a);
100
+ sum += a.length;
101
+ }
102
+ const res = new Uint8Array(sum);
103
+ for (let i = 0, pad = 0; i < arrays.length; i++) {
104
+ const a = arrays[i];
105
+ res.set(a, pad);
106
+ pad += a.length;
107
+ }
108
+ return res;
109
+ }
110
+ /** For runtime check if class implements interface */
111
+ var Hash = class {};
112
+ /** Wraps hash function, creating an interface on top of it */
113
+ function createHasher(hashCons) {
114
+ const hashC = (msg) => hashCons().update(toBytes(msg)).digest();
115
+ const tmp = hashCons();
116
+ hashC.outputLen = tmp.outputLen;
117
+ hashC.blockLen = tmp.blockLen;
118
+ hashC.create = () => hashCons();
119
+ return hashC;
120
+ }
121
+ /** Cryptographically secure PRNG. Uses internal OS-level `crypto.getRandomValues`. */
122
+ function randomBytes(bytesLength = 32) {
123
+ if (crypto && typeof crypto.getRandomValues === "function") return crypto.getRandomValues(new Uint8Array(bytesLength));
124
+ if (crypto && typeof crypto.randomBytes === "function") return Uint8Array.from(crypto.randomBytes(bytesLength));
125
+ throw new Error("crypto.getRandomValues must be defined");
126
+ }
127
+ //#endregion
128
+ //#region ../../node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/esm/_md.js
129
+ /**
130
+ * Internal Merkle-Damgard hash utils.
131
+ * @module
132
+ */
133
+ /** Polyfill for Safari 14. https://caniuse.com/mdn-javascript_builtins_dataview_setbiguint64 */
134
+ function setBigUint64(view, byteOffset, value, isLE) {
135
+ if (typeof view.setBigUint64 === "function") return view.setBigUint64(byteOffset, value, isLE);
136
+ const _32n = BigInt(32);
137
+ const _u32_max = BigInt(4294967295);
138
+ const wh = Number(value >> _32n & _u32_max);
139
+ const wl = Number(value & _u32_max);
140
+ const h = isLE ? 4 : 0;
141
+ const l = isLE ? 0 : 4;
142
+ view.setUint32(byteOffset + h, wh, isLE);
143
+ view.setUint32(byteOffset + l, wl, isLE);
144
+ }
145
+ /** Choice: a ? b : c */
146
+ function Chi(a, b, c) {
147
+ return a & b ^ ~a & c;
148
+ }
149
+ /** Majority function, true if any two inputs is true. */
150
+ function Maj(a, b, c) {
151
+ return a & b ^ a & c ^ b & c;
152
+ }
153
+ /**
154
+ * Merkle-Damgard hash construction base class.
155
+ * Could be used to create MD5, RIPEMD, SHA1, SHA2.
156
+ */
157
+ var HashMD = class extends Hash {
158
+ constructor(blockLen, outputLen, padOffset, isLE) {
159
+ super();
160
+ this.finished = false;
161
+ this.length = 0;
162
+ this.pos = 0;
163
+ this.destroyed = false;
164
+ this.blockLen = blockLen;
165
+ this.outputLen = outputLen;
166
+ this.padOffset = padOffset;
167
+ this.isLE = isLE;
168
+ this.buffer = new Uint8Array(blockLen);
169
+ this.view = createView(this.buffer);
170
+ }
171
+ update(data) {
172
+ aexists(this);
173
+ data = toBytes(data);
174
+ abytes$1(data);
175
+ const { view, buffer, blockLen } = this;
176
+ const len = data.length;
177
+ for (let pos = 0; pos < len;) {
178
+ const take = Math.min(blockLen - this.pos, len - pos);
179
+ if (take === blockLen) {
180
+ const dataView = createView(data);
181
+ for (; blockLen <= len - pos; pos += blockLen) this.process(dataView, pos);
182
+ continue;
183
+ }
184
+ buffer.set(data.subarray(pos, pos + take), this.pos);
185
+ this.pos += take;
186
+ pos += take;
187
+ if (this.pos === blockLen) {
188
+ this.process(view, 0);
189
+ this.pos = 0;
190
+ }
191
+ }
192
+ this.length += data.length;
193
+ this.roundClean();
194
+ return this;
195
+ }
196
+ digestInto(out) {
197
+ aexists(this);
198
+ aoutput(out, this);
199
+ this.finished = true;
200
+ const { buffer, view, blockLen, isLE } = this;
201
+ let { pos } = this;
202
+ buffer[pos++] = 128;
203
+ clean(this.buffer.subarray(pos));
204
+ if (this.padOffset > blockLen - pos) {
205
+ this.process(view, 0);
206
+ pos = 0;
207
+ }
208
+ for (let i = pos; i < blockLen; i++) buffer[i] = 0;
209
+ setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE);
210
+ this.process(view, 0);
211
+ const oview = createView(out);
212
+ const len = this.outputLen;
213
+ if (len % 4) throw new Error("_sha2: outputLen should be aligned to 32bit");
214
+ const outLen = len / 4;
215
+ const state = this.get();
216
+ if (outLen > state.length) throw new Error("_sha2: outputLen bigger than state");
217
+ for (let i = 0; i < outLen; i++) oview.setUint32(4 * i, state[i], isLE);
218
+ }
219
+ digest() {
220
+ const { buffer, outputLen } = this;
221
+ this.digestInto(buffer);
222
+ const res = buffer.slice(0, outputLen);
223
+ this.destroy();
224
+ return res;
225
+ }
226
+ _cloneInto(to) {
227
+ to || (to = new this.constructor());
228
+ to.set(...this.get());
229
+ const { blockLen, buffer, length, finished, destroyed, pos } = this;
230
+ to.destroyed = destroyed;
231
+ to.finished = finished;
232
+ to.length = length;
233
+ to.pos = pos;
234
+ if (length % blockLen) to.buffer.set(buffer);
235
+ return to;
236
+ }
237
+ clone() {
238
+ return this._cloneInto();
239
+ }
240
+ };
241
+ /**
242
+ * Initial SHA-2 state: fractional parts of square roots of first 16 primes 2..53.
243
+ * Check out `test/misc/sha2-gen-iv.js` for recomputation guide.
244
+ */
245
+ /** Initial SHA256 state. Bits 0..32 of frac part of sqrt of primes 2..19 */
246
+ const SHA256_IV = /* @__PURE__ */ Uint32Array.from([
247
+ 1779033703,
248
+ 3144134277,
249
+ 1013904242,
250
+ 2773480762,
251
+ 1359893119,
252
+ 2600822924,
253
+ 528734635,
254
+ 1541459225
255
+ ]);
256
+ //#endregion
257
+ //#region ../../node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/esm/sha2.js
258
+ /**
259
+ * SHA2 hash function. A.k.a. sha256, sha384, sha512, sha512_224, sha512_256.
260
+ * SHA256 is the fastest hash implementable in JS, even faster than Blake3.
261
+ * Check out [RFC 4634](https://datatracker.ietf.org/doc/html/rfc4634) and
262
+ * [FIPS 180-4](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf).
263
+ * @module
264
+ */
265
+ /**
266
+ * Round constants:
267
+ * First 32 bits of fractional parts of the cube roots of the first 64 primes 2..311)
268
+ */
269
+ const SHA256_K = /* @__PURE__ */ Uint32Array.from([
270
+ 1116352408,
271
+ 1899447441,
272
+ 3049323471,
273
+ 3921009573,
274
+ 961987163,
275
+ 1508970993,
276
+ 2453635748,
277
+ 2870763221,
278
+ 3624381080,
279
+ 310598401,
280
+ 607225278,
281
+ 1426881987,
282
+ 1925078388,
283
+ 2162078206,
284
+ 2614888103,
285
+ 3248222580,
286
+ 3835390401,
287
+ 4022224774,
288
+ 264347078,
289
+ 604807628,
290
+ 770255983,
291
+ 1249150122,
292
+ 1555081692,
293
+ 1996064986,
294
+ 2554220882,
295
+ 2821834349,
296
+ 2952996808,
297
+ 3210313671,
298
+ 3336571891,
299
+ 3584528711,
300
+ 113926993,
301
+ 338241895,
302
+ 666307205,
303
+ 773529912,
304
+ 1294757372,
305
+ 1396182291,
306
+ 1695183700,
307
+ 1986661051,
308
+ 2177026350,
309
+ 2456956037,
310
+ 2730485921,
311
+ 2820302411,
312
+ 3259730800,
313
+ 3345764771,
314
+ 3516065817,
315
+ 3600352804,
316
+ 4094571909,
317
+ 275423344,
318
+ 430227734,
319
+ 506948616,
320
+ 659060556,
321
+ 883997877,
322
+ 958139571,
323
+ 1322822218,
324
+ 1537002063,
325
+ 1747873779,
326
+ 1955562222,
327
+ 2024104815,
328
+ 2227730452,
329
+ 2361852424,
330
+ 2428436474,
331
+ 2756734187,
332
+ 3204031479,
333
+ 3329325298
334
+ ]);
335
+ /** Reusable temporary buffer. "W" comes straight from spec. */
336
+ const SHA256_W = /* @__PURE__ */ new Uint32Array(64);
337
+ var SHA256 = class extends HashMD {
338
+ constructor(outputLen = 32) {
339
+ super(64, outputLen, 8, false);
340
+ this.A = SHA256_IV[0] | 0;
341
+ this.B = SHA256_IV[1] | 0;
342
+ this.C = SHA256_IV[2] | 0;
343
+ this.D = SHA256_IV[3] | 0;
344
+ this.E = SHA256_IV[4] | 0;
345
+ this.F = SHA256_IV[5] | 0;
346
+ this.G = SHA256_IV[6] | 0;
347
+ this.H = SHA256_IV[7] | 0;
348
+ }
349
+ get() {
350
+ const { A, B, C, D, E, F, G, H } = this;
351
+ return [
352
+ A,
353
+ B,
354
+ C,
355
+ D,
356
+ E,
357
+ F,
358
+ G,
359
+ H
360
+ ];
361
+ }
362
+ set(A, B, C, D, E, F, G, H) {
363
+ this.A = A | 0;
364
+ this.B = B | 0;
365
+ this.C = C | 0;
366
+ this.D = D | 0;
367
+ this.E = E | 0;
368
+ this.F = F | 0;
369
+ this.G = G | 0;
370
+ this.H = H | 0;
371
+ }
372
+ process(view, offset) {
373
+ for (let i = 0; i < 16; i++, offset += 4) SHA256_W[i] = view.getUint32(offset, false);
374
+ for (let i = 16; i < 64; i++) {
375
+ const W15 = SHA256_W[i - 15];
376
+ const W2 = SHA256_W[i - 2];
377
+ const s0 = rotr(W15, 7) ^ rotr(W15, 18) ^ W15 >>> 3;
378
+ const s1 = rotr(W2, 17) ^ rotr(W2, 19) ^ W2 >>> 10;
379
+ SHA256_W[i] = s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16] | 0;
380
+ }
381
+ let { A, B, C, D, E, F, G, H } = this;
382
+ for (let i = 0; i < 64; i++) {
383
+ const sigma1 = rotr(E, 6) ^ rotr(E, 11) ^ rotr(E, 25);
384
+ const T1 = H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i] | 0;
385
+ const T2 = (rotr(A, 2) ^ rotr(A, 13) ^ rotr(A, 22)) + Maj(A, B, C) | 0;
386
+ H = G;
387
+ G = F;
388
+ F = E;
389
+ E = D + T1 | 0;
390
+ D = C;
391
+ C = B;
392
+ B = A;
393
+ A = T1 + T2 | 0;
394
+ }
395
+ A = A + this.A | 0;
396
+ B = B + this.B | 0;
397
+ C = C + this.C | 0;
398
+ D = D + this.D | 0;
399
+ E = E + this.E | 0;
400
+ F = F + this.F | 0;
401
+ G = G + this.G | 0;
402
+ H = H + this.H | 0;
403
+ this.set(A, B, C, D, E, F, G, H);
404
+ }
405
+ roundClean() {
406
+ clean(SHA256_W);
407
+ }
408
+ destroy() {
409
+ this.set(0, 0, 0, 0, 0, 0, 0, 0);
410
+ clean(this.buffer);
411
+ }
412
+ };
413
+ /**
414
+ * SHA2-256 hash function from RFC 4634.
415
+ *
416
+ * It is the fastest JS hash, even faster than Blake3.
417
+ * To break sha256 using birthday attack, attackers need to try 2^128 hashes.
418
+ * BTC network is doing 2^70 hashes/sec (2^95 hashes/year) as per 2025.
419
+ */
420
+ const sha256 = /* @__PURE__ */ createHasher(() => new SHA256());
421
+ //#endregion
2
422
  //#region ../../node_modules/.pnpm/@noble+curves@1.9.1/node_modules/@noble/curves/esm/abstract/utils.js
3
423
  /**
4
424
  * Hex, bytes and number utilities.
@@ -1920,4 +2340,4 @@ const secp256k1 = createCurve({
1920
2340
  }
1921
2341
  }, sha256);
1922
2342
  //#endregion
1923
- export { secp256k1 as t };
2343
+ export { aexists as a, clean as c, toBytes as d, u32 as f, abytes$1 as i, createHasher as l, sha256 as n, anumber as o, Hash as r, aoutput as s, secp256k1 as t, swap32IfBE as u };