protect-mcp 0.7.6 → 0.9.1
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/{chunk-6E2DHBAR.mjs → chunk-744JMCY4.mjs} +9 -1
- package/dist/chunk-AYNQIEN7.mjs +10 -0
- package/dist/{chunk-JCMDLN5I.mjs → chunk-CXW2EIRM.mjs} +2 -2
- package/dist/{chunk-LJQOALYR.mjs → chunk-FFVJL3KQ.mjs} +5 -564
- package/dist/{chunk-VTPZ4G5I.mjs → chunk-GHR65WVD.mjs} +1 -1
- package/dist/{chunk-WIPWNWMJ.mjs → chunk-IDUH2O4Q.mjs} +1 -0
- package/dist/chunk-JIDDQUSQ.mjs +568 -0
- package/dist/chunk-KMNXHGGT.mjs +94 -0
- package/dist/{chunk-WV4DKYE4.mjs → chunk-UWB5ALVO.mjs} +10 -12
- package/dist/claim-U7Q3A4WW.mjs +129 -0
- package/dist/cli.js +506 -31
- package/dist/cli.mjs +276 -24
- package/dist/{ed25519-BSHMMVNX.mjs → ed25519-SQA3S2RV.mjs} +2 -1
- package/dist/hook-server.js +428 -0
- package/dist/hook-server.mjs +6 -2
- package/dist/{http-transport-JBORN27G.mjs → http-transport-D7C64PIA.mjs} +2 -2
- package/dist/index.d.mts +16 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +107 -18
- package/dist/index.mjs +14 -9
- package/dist/{signing-committed-QXCW24RF.mjs → signing-committed-TGWXSLAO.mjs} +4 -2
- package/package.json +1 -1
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buildEnrichment
|
|
3
|
+
} from "./chunk-KMNXHGGT.mjs";
|
|
1
4
|
import {
|
|
2
5
|
ReceiptBuffer,
|
|
3
6
|
buildActionReadback,
|
|
@@ -12,7 +15,7 @@ import {
|
|
|
12
15
|
loadPolicy,
|
|
13
16
|
parseRateLimit,
|
|
14
17
|
signDecision
|
|
15
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-IDUH2O4Q.mjs";
|
|
16
19
|
|
|
17
20
|
// src/hook-server.ts
|
|
18
21
|
import { createServer } from "http";
|
|
@@ -243,6 +246,9 @@ async function handlePreToolUse(input, state) {
|
|
|
243
246
|
});
|
|
244
247
|
const payloadDigest = computePayloadDigest(input.toolInput);
|
|
245
248
|
const actionReadback = buildActionReadback(toolName, input.toolInput || {});
|
|
249
|
+
const enrichment = buildEnrichment(toolName, input.toolInput || {});
|
|
250
|
+
const inflightRec = state.inflightTools.get(requestId);
|
|
251
|
+
if (inflightRec) inflightRec.enrichment = enrichment;
|
|
246
252
|
const swarm = {
|
|
247
253
|
...state.swarmContext,
|
|
248
254
|
...input.agentId && { agent_id: input.agentId },
|
|
@@ -662,6 +668,8 @@ function emitDecisionLog(state, entry) {
|
|
|
662
668
|
...entry.sandbox_state && { sandbox_state: entry.sandbox_state },
|
|
663
669
|
...entry.plan_receipt_id && { plan_receipt_id: entry.plan_receipt_id }
|
|
664
670
|
};
|
|
671
|
+
const enr = state.inflightTools.get(log.request_id)?.enrichment;
|
|
672
|
+
if (enr) log.enrichment = enr;
|
|
665
673
|
process.stderr.write(`[PROTECT_MCP] ${JSON.stringify(log)}
|
|
666
674
|
`);
|
|
667
675
|
try {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
meetsMinTier
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-GHR65WVD.mjs";
|
|
4
4
|
import {
|
|
5
5
|
checkRateLimit,
|
|
6
6
|
getToolPolicy,
|
|
7
7
|
parseRateLimit
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-IDUH2O4Q.mjs";
|
|
9
9
|
|
|
10
10
|
// src/simulate.ts
|
|
11
11
|
import { readFileSync } from "fs";
|
|
@@ -1,573 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
sha512
|
|
3
|
+
} from "./chunk-JIDDQUSQ.mjs";
|
|
4
|
+
import {
|
|
3
5
|
abytes,
|
|
4
|
-
aexists,
|
|
5
6
|
anumber,
|
|
6
|
-
aoutput,
|
|
7
7
|
bytesToHex,
|
|
8
|
-
clean,
|
|
9
8
|
concatBytes,
|
|
10
|
-
createHasher,
|
|
11
|
-
createView,
|
|
12
9
|
hexToBytes,
|
|
13
10
|
isBytes,
|
|
14
11
|
randomBytes,
|
|
15
|
-
rotr,
|
|
16
|
-
toBytes,
|
|
17
12
|
utf8ToBytes
|
|
18
13
|
} from "./chunk-D733KAPG.mjs";
|
|
19
14
|
|
|
20
|
-
// node_modules/@noble/hashes/esm/_md.js
|
|
21
|
-
function setBigUint64(view, byteOffset, value, isLE) {
|
|
22
|
-
if (typeof view.setBigUint64 === "function")
|
|
23
|
-
return view.setBigUint64(byteOffset, value, isLE);
|
|
24
|
-
const _32n2 = BigInt(32);
|
|
25
|
-
const _u32_max = BigInt(4294967295);
|
|
26
|
-
const wh = Number(value >> _32n2 & _u32_max);
|
|
27
|
-
const wl = Number(value & _u32_max);
|
|
28
|
-
const h = isLE ? 4 : 0;
|
|
29
|
-
const l = isLE ? 0 : 4;
|
|
30
|
-
view.setUint32(byteOffset + h, wh, isLE);
|
|
31
|
-
view.setUint32(byteOffset + l, wl, isLE);
|
|
32
|
-
}
|
|
33
|
-
function Chi(a, b, c) {
|
|
34
|
-
return a & b ^ ~a & c;
|
|
35
|
-
}
|
|
36
|
-
function Maj(a, b, c) {
|
|
37
|
-
return a & b ^ a & c ^ b & c;
|
|
38
|
-
}
|
|
39
|
-
var HashMD = class extends Hash {
|
|
40
|
-
constructor(blockLen, outputLen, padOffset, isLE) {
|
|
41
|
-
super();
|
|
42
|
-
this.finished = false;
|
|
43
|
-
this.length = 0;
|
|
44
|
-
this.pos = 0;
|
|
45
|
-
this.destroyed = false;
|
|
46
|
-
this.blockLen = blockLen;
|
|
47
|
-
this.outputLen = outputLen;
|
|
48
|
-
this.padOffset = padOffset;
|
|
49
|
-
this.isLE = isLE;
|
|
50
|
-
this.buffer = new Uint8Array(blockLen);
|
|
51
|
-
this.view = createView(this.buffer);
|
|
52
|
-
}
|
|
53
|
-
update(data) {
|
|
54
|
-
aexists(this);
|
|
55
|
-
data = toBytes(data);
|
|
56
|
-
abytes(data);
|
|
57
|
-
const { view, buffer, blockLen } = this;
|
|
58
|
-
const len = data.length;
|
|
59
|
-
for (let pos = 0; pos < len; ) {
|
|
60
|
-
const take = Math.min(blockLen - this.pos, len - pos);
|
|
61
|
-
if (take === blockLen) {
|
|
62
|
-
const dataView = createView(data);
|
|
63
|
-
for (; blockLen <= len - pos; pos += blockLen)
|
|
64
|
-
this.process(dataView, pos);
|
|
65
|
-
continue;
|
|
66
|
-
}
|
|
67
|
-
buffer.set(data.subarray(pos, pos + take), this.pos);
|
|
68
|
-
this.pos += take;
|
|
69
|
-
pos += take;
|
|
70
|
-
if (this.pos === blockLen) {
|
|
71
|
-
this.process(view, 0);
|
|
72
|
-
this.pos = 0;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
this.length += data.length;
|
|
76
|
-
this.roundClean();
|
|
77
|
-
return this;
|
|
78
|
-
}
|
|
79
|
-
digestInto(out) {
|
|
80
|
-
aexists(this);
|
|
81
|
-
aoutput(out, this);
|
|
82
|
-
this.finished = true;
|
|
83
|
-
const { buffer, view, blockLen, isLE } = this;
|
|
84
|
-
let { pos } = this;
|
|
85
|
-
buffer[pos++] = 128;
|
|
86
|
-
clean(this.buffer.subarray(pos));
|
|
87
|
-
if (this.padOffset > blockLen - pos) {
|
|
88
|
-
this.process(view, 0);
|
|
89
|
-
pos = 0;
|
|
90
|
-
}
|
|
91
|
-
for (let i = pos; i < blockLen; i++)
|
|
92
|
-
buffer[i] = 0;
|
|
93
|
-
setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE);
|
|
94
|
-
this.process(view, 0);
|
|
95
|
-
const oview = createView(out);
|
|
96
|
-
const len = this.outputLen;
|
|
97
|
-
if (len % 4)
|
|
98
|
-
throw new Error("_sha2: outputLen should be aligned to 32bit");
|
|
99
|
-
const outLen = len / 4;
|
|
100
|
-
const state = this.get();
|
|
101
|
-
if (outLen > state.length)
|
|
102
|
-
throw new Error("_sha2: outputLen bigger than state");
|
|
103
|
-
for (let i = 0; i < outLen; i++)
|
|
104
|
-
oview.setUint32(4 * i, state[i], isLE);
|
|
105
|
-
}
|
|
106
|
-
digest() {
|
|
107
|
-
const { buffer, outputLen } = this;
|
|
108
|
-
this.digestInto(buffer);
|
|
109
|
-
const res = buffer.slice(0, outputLen);
|
|
110
|
-
this.destroy();
|
|
111
|
-
return res;
|
|
112
|
-
}
|
|
113
|
-
_cloneInto(to) {
|
|
114
|
-
to || (to = new this.constructor());
|
|
115
|
-
to.set(...this.get());
|
|
116
|
-
const { blockLen, buffer, length, finished, destroyed, pos } = this;
|
|
117
|
-
to.destroyed = destroyed;
|
|
118
|
-
to.finished = finished;
|
|
119
|
-
to.length = length;
|
|
120
|
-
to.pos = pos;
|
|
121
|
-
if (length % blockLen)
|
|
122
|
-
to.buffer.set(buffer);
|
|
123
|
-
return to;
|
|
124
|
-
}
|
|
125
|
-
clone() {
|
|
126
|
-
return this._cloneInto();
|
|
127
|
-
}
|
|
128
|
-
};
|
|
129
|
-
var SHA256_IV = /* @__PURE__ */ Uint32Array.from([
|
|
130
|
-
1779033703,
|
|
131
|
-
3144134277,
|
|
132
|
-
1013904242,
|
|
133
|
-
2773480762,
|
|
134
|
-
1359893119,
|
|
135
|
-
2600822924,
|
|
136
|
-
528734635,
|
|
137
|
-
1541459225
|
|
138
|
-
]);
|
|
139
|
-
var SHA384_IV = /* @__PURE__ */ Uint32Array.from([
|
|
140
|
-
3418070365,
|
|
141
|
-
3238371032,
|
|
142
|
-
1654270250,
|
|
143
|
-
914150663,
|
|
144
|
-
2438529370,
|
|
145
|
-
812702999,
|
|
146
|
-
355462360,
|
|
147
|
-
4144912697,
|
|
148
|
-
1731405415,
|
|
149
|
-
4290775857,
|
|
150
|
-
2394180231,
|
|
151
|
-
1750603025,
|
|
152
|
-
3675008525,
|
|
153
|
-
1694076839,
|
|
154
|
-
1203062813,
|
|
155
|
-
3204075428
|
|
156
|
-
]);
|
|
157
|
-
var SHA512_IV = /* @__PURE__ */ Uint32Array.from([
|
|
158
|
-
1779033703,
|
|
159
|
-
4089235720,
|
|
160
|
-
3144134277,
|
|
161
|
-
2227873595,
|
|
162
|
-
1013904242,
|
|
163
|
-
4271175723,
|
|
164
|
-
2773480762,
|
|
165
|
-
1595750129,
|
|
166
|
-
1359893119,
|
|
167
|
-
2917565137,
|
|
168
|
-
2600822924,
|
|
169
|
-
725511199,
|
|
170
|
-
528734635,
|
|
171
|
-
4215389547,
|
|
172
|
-
1541459225,
|
|
173
|
-
327033209
|
|
174
|
-
]);
|
|
175
|
-
|
|
176
|
-
// node_modules/@noble/hashes/esm/_u64.js
|
|
177
|
-
var U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
|
|
178
|
-
var _32n = /* @__PURE__ */ BigInt(32);
|
|
179
|
-
function fromBig(n, le = false) {
|
|
180
|
-
if (le)
|
|
181
|
-
return { h: Number(n & U32_MASK64), l: Number(n >> _32n & U32_MASK64) };
|
|
182
|
-
return { h: Number(n >> _32n & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };
|
|
183
|
-
}
|
|
184
|
-
function split(lst, le = false) {
|
|
185
|
-
const len = lst.length;
|
|
186
|
-
let Ah = new Uint32Array(len);
|
|
187
|
-
let Al = new Uint32Array(len);
|
|
188
|
-
for (let i = 0; i < len; i++) {
|
|
189
|
-
const { h, l } = fromBig(lst[i], le);
|
|
190
|
-
[Ah[i], Al[i]] = [h, l];
|
|
191
|
-
}
|
|
192
|
-
return [Ah, Al];
|
|
193
|
-
}
|
|
194
|
-
var shrSH = (h, _l, s) => h >>> s;
|
|
195
|
-
var shrSL = (h, l, s) => h << 32 - s | l >>> s;
|
|
196
|
-
var rotrSH = (h, l, s) => h >>> s | l << 32 - s;
|
|
197
|
-
var rotrSL = (h, l, s) => h << 32 - s | l >>> s;
|
|
198
|
-
var rotrBH = (h, l, s) => h << 64 - s | l >>> s - 32;
|
|
199
|
-
var rotrBL = (h, l, s) => h >>> s - 32 | l << 64 - s;
|
|
200
|
-
function add(Ah, Al, Bh, Bl) {
|
|
201
|
-
const l = (Al >>> 0) + (Bl >>> 0);
|
|
202
|
-
return { h: Ah + Bh + (l / 2 ** 32 | 0) | 0, l: l | 0 };
|
|
203
|
-
}
|
|
204
|
-
var add3L = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0);
|
|
205
|
-
var add3H = (low, Ah, Bh, Ch) => Ah + Bh + Ch + (low / 2 ** 32 | 0) | 0;
|
|
206
|
-
var add4L = (Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0);
|
|
207
|
-
var add4H = (low, Ah, Bh, Ch, Dh) => Ah + Bh + Ch + Dh + (low / 2 ** 32 | 0) | 0;
|
|
208
|
-
var add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0);
|
|
209
|
-
var add5H = (low, Ah, Bh, Ch, Dh, Eh) => Ah + Bh + Ch + Dh + Eh + (low / 2 ** 32 | 0) | 0;
|
|
210
|
-
|
|
211
|
-
// node_modules/@noble/hashes/esm/sha2.js
|
|
212
|
-
var SHA256_K = /* @__PURE__ */ Uint32Array.from([
|
|
213
|
-
1116352408,
|
|
214
|
-
1899447441,
|
|
215
|
-
3049323471,
|
|
216
|
-
3921009573,
|
|
217
|
-
961987163,
|
|
218
|
-
1508970993,
|
|
219
|
-
2453635748,
|
|
220
|
-
2870763221,
|
|
221
|
-
3624381080,
|
|
222
|
-
310598401,
|
|
223
|
-
607225278,
|
|
224
|
-
1426881987,
|
|
225
|
-
1925078388,
|
|
226
|
-
2162078206,
|
|
227
|
-
2614888103,
|
|
228
|
-
3248222580,
|
|
229
|
-
3835390401,
|
|
230
|
-
4022224774,
|
|
231
|
-
264347078,
|
|
232
|
-
604807628,
|
|
233
|
-
770255983,
|
|
234
|
-
1249150122,
|
|
235
|
-
1555081692,
|
|
236
|
-
1996064986,
|
|
237
|
-
2554220882,
|
|
238
|
-
2821834349,
|
|
239
|
-
2952996808,
|
|
240
|
-
3210313671,
|
|
241
|
-
3336571891,
|
|
242
|
-
3584528711,
|
|
243
|
-
113926993,
|
|
244
|
-
338241895,
|
|
245
|
-
666307205,
|
|
246
|
-
773529912,
|
|
247
|
-
1294757372,
|
|
248
|
-
1396182291,
|
|
249
|
-
1695183700,
|
|
250
|
-
1986661051,
|
|
251
|
-
2177026350,
|
|
252
|
-
2456956037,
|
|
253
|
-
2730485921,
|
|
254
|
-
2820302411,
|
|
255
|
-
3259730800,
|
|
256
|
-
3345764771,
|
|
257
|
-
3516065817,
|
|
258
|
-
3600352804,
|
|
259
|
-
4094571909,
|
|
260
|
-
275423344,
|
|
261
|
-
430227734,
|
|
262
|
-
506948616,
|
|
263
|
-
659060556,
|
|
264
|
-
883997877,
|
|
265
|
-
958139571,
|
|
266
|
-
1322822218,
|
|
267
|
-
1537002063,
|
|
268
|
-
1747873779,
|
|
269
|
-
1955562222,
|
|
270
|
-
2024104815,
|
|
271
|
-
2227730452,
|
|
272
|
-
2361852424,
|
|
273
|
-
2428436474,
|
|
274
|
-
2756734187,
|
|
275
|
-
3204031479,
|
|
276
|
-
3329325298
|
|
277
|
-
]);
|
|
278
|
-
var SHA256_W = /* @__PURE__ */ new Uint32Array(64);
|
|
279
|
-
var SHA256 = class extends HashMD {
|
|
280
|
-
constructor(outputLen = 32) {
|
|
281
|
-
super(64, outputLen, 8, false);
|
|
282
|
-
this.A = SHA256_IV[0] | 0;
|
|
283
|
-
this.B = SHA256_IV[1] | 0;
|
|
284
|
-
this.C = SHA256_IV[2] | 0;
|
|
285
|
-
this.D = SHA256_IV[3] | 0;
|
|
286
|
-
this.E = SHA256_IV[4] | 0;
|
|
287
|
-
this.F = SHA256_IV[5] | 0;
|
|
288
|
-
this.G = SHA256_IV[6] | 0;
|
|
289
|
-
this.H = SHA256_IV[7] | 0;
|
|
290
|
-
}
|
|
291
|
-
get() {
|
|
292
|
-
const { A, B, C, D, E, F, G, H } = this;
|
|
293
|
-
return [A, B, C, D, E, F, G, H];
|
|
294
|
-
}
|
|
295
|
-
// prettier-ignore
|
|
296
|
-
set(A, B, C, D, E, F, G, H) {
|
|
297
|
-
this.A = A | 0;
|
|
298
|
-
this.B = B | 0;
|
|
299
|
-
this.C = C | 0;
|
|
300
|
-
this.D = D | 0;
|
|
301
|
-
this.E = E | 0;
|
|
302
|
-
this.F = F | 0;
|
|
303
|
-
this.G = G | 0;
|
|
304
|
-
this.H = H | 0;
|
|
305
|
-
}
|
|
306
|
-
process(view, offset) {
|
|
307
|
-
for (let i = 0; i < 16; i++, offset += 4)
|
|
308
|
-
SHA256_W[i] = view.getUint32(offset, false);
|
|
309
|
-
for (let i = 16; i < 64; i++) {
|
|
310
|
-
const W15 = SHA256_W[i - 15];
|
|
311
|
-
const W2 = SHA256_W[i - 2];
|
|
312
|
-
const s0 = rotr(W15, 7) ^ rotr(W15, 18) ^ W15 >>> 3;
|
|
313
|
-
const s1 = rotr(W2, 17) ^ rotr(W2, 19) ^ W2 >>> 10;
|
|
314
|
-
SHA256_W[i] = s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16] | 0;
|
|
315
|
-
}
|
|
316
|
-
let { A, B, C, D, E, F, G, H } = this;
|
|
317
|
-
for (let i = 0; i < 64; i++) {
|
|
318
|
-
const sigma1 = rotr(E, 6) ^ rotr(E, 11) ^ rotr(E, 25);
|
|
319
|
-
const T1 = H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i] | 0;
|
|
320
|
-
const sigma0 = rotr(A, 2) ^ rotr(A, 13) ^ rotr(A, 22);
|
|
321
|
-
const T2 = sigma0 + Maj(A, B, C) | 0;
|
|
322
|
-
H = G;
|
|
323
|
-
G = F;
|
|
324
|
-
F = E;
|
|
325
|
-
E = D + T1 | 0;
|
|
326
|
-
D = C;
|
|
327
|
-
C = B;
|
|
328
|
-
B = A;
|
|
329
|
-
A = T1 + T2 | 0;
|
|
330
|
-
}
|
|
331
|
-
A = A + this.A | 0;
|
|
332
|
-
B = B + this.B | 0;
|
|
333
|
-
C = C + this.C | 0;
|
|
334
|
-
D = D + this.D | 0;
|
|
335
|
-
E = E + this.E | 0;
|
|
336
|
-
F = F + this.F | 0;
|
|
337
|
-
G = G + this.G | 0;
|
|
338
|
-
H = H + this.H | 0;
|
|
339
|
-
this.set(A, B, C, D, E, F, G, H);
|
|
340
|
-
}
|
|
341
|
-
roundClean() {
|
|
342
|
-
clean(SHA256_W);
|
|
343
|
-
}
|
|
344
|
-
destroy() {
|
|
345
|
-
this.set(0, 0, 0, 0, 0, 0, 0, 0);
|
|
346
|
-
clean(this.buffer);
|
|
347
|
-
}
|
|
348
|
-
};
|
|
349
|
-
var K512 = /* @__PURE__ */ (() => split([
|
|
350
|
-
"0x428a2f98d728ae22",
|
|
351
|
-
"0x7137449123ef65cd",
|
|
352
|
-
"0xb5c0fbcfec4d3b2f",
|
|
353
|
-
"0xe9b5dba58189dbbc",
|
|
354
|
-
"0x3956c25bf348b538",
|
|
355
|
-
"0x59f111f1b605d019",
|
|
356
|
-
"0x923f82a4af194f9b",
|
|
357
|
-
"0xab1c5ed5da6d8118",
|
|
358
|
-
"0xd807aa98a3030242",
|
|
359
|
-
"0x12835b0145706fbe",
|
|
360
|
-
"0x243185be4ee4b28c",
|
|
361
|
-
"0x550c7dc3d5ffb4e2",
|
|
362
|
-
"0x72be5d74f27b896f",
|
|
363
|
-
"0x80deb1fe3b1696b1",
|
|
364
|
-
"0x9bdc06a725c71235",
|
|
365
|
-
"0xc19bf174cf692694",
|
|
366
|
-
"0xe49b69c19ef14ad2",
|
|
367
|
-
"0xefbe4786384f25e3",
|
|
368
|
-
"0x0fc19dc68b8cd5b5",
|
|
369
|
-
"0x240ca1cc77ac9c65",
|
|
370
|
-
"0x2de92c6f592b0275",
|
|
371
|
-
"0x4a7484aa6ea6e483",
|
|
372
|
-
"0x5cb0a9dcbd41fbd4",
|
|
373
|
-
"0x76f988da831153b5",
|
|
374
|
-
"0x983e5152ee66dfab",
|
|
375
|
-
"0xa831c66d2db43210",
|
|
376
|
-
"0xb00327c898fb213f",
|
|
377
|
-
"0xbf597fc7beef0ee4",
|
|
378
|
-
"0xc6e00bf33da88fc2",
|
|
379
|
-
"0xd5a79147930aa725",
|
|
380
|
-
"0x06ca6351e003826f",
|
|
381
|
-
"0x142929670a0e6e70",
|
|
382
|
-
"0x27b70a8546d22ffc",
|
|
383
|
-
"0x2e1b21385c26c926",
|
|
384
|
-
"0x4d2c6dfc5ac42aed",
|
|
385
|
-
"0x53380d139d95b3df",
|
|
386
|
-
"0x650a73548baf63de",
|
|
387
|
-
"0x766a0abb3c77b2a8",
|
|
388
|
-
"0x81c2c92e47edaee6",
|
|
389
|
-
"0x92722c851482353b",
|
|
390
|
-
"0xa2bfe8a14cf10364",
|
|
391
|
-
"0xa81a664bbc423001",
|
|
392
|
-
"0xc24b8b70d0f89791",
|
|
393
|
-
"0xc76c51a30654be30",
|
|
394
|
-
"0xd192e819d6ef5218",
|
|
395
|
-
"0xd69906245565a910",
|
|
396
|
-
"0xf40e35855771202a",
|
|
397
|
-
"0x106aa07032bbd1b8",
|
|
398
|
-
"0x19a4c116b8d2d0c8",
|
|
399
|
-
"0x1e376c085141ab53",
|
|
400
|
-
"0x2748774cdf8eeb99",
|
|
401
|
-
"0x34b0bcb5e19b48a8",
|
|
402
|
-
"0x391c0cb3c5c95a63",
|
|
403
|
-
"0x4ed8aa4ae3418acb",
|
|
404
|
-
"0x5b9cca4f7763e373",
|
|
405
|
-
"0x682e6ff3d6b2b8a3",
|
|
406
|
-
"0x748f82ee5defb2fc",
|
|
407
|
-
"0x78a5636f43172f60",
|
|
408
|
-
"0x84c87814a1f0ab72",
|
|
409
|
-
"0x8cc702081a6439ec",
|
|
410
|
-
"0x90befffa23631e28",
|
|
411
|
-
"0xa4506cebde82bde9",
|
|
412
|
-
"0xbef9a3f7b2c67915",
|
|
413
|
-
"0xc67178f2e372532b",
|
|
414
|
-
"0xca273eceea26619c",
|
|
415
|
-
"0xd186b8c721c0c207",
|
|
416
|
-
"0xeada7dd6cde0eb1e",
|
|
417
|
-
"0xf57d4f7fee6ed178",
|
|
418
|
-
"0x06f067aa72176fba",
|
|
419
|
-
"0x0a637dc5a2c898a6",
|
|
420
|
-
"0x113f9804bef90dae",
|
|
421
|
-
"0x1b710b35131c471b",
|
|
422
|
-
"0x28db77f523047d84",
|
|
423
|
-
"0x32caab7b40c72493",
|
|
424
|
-
"0x3c9ebe0a15c9bebc",
|
|
425
|
-
"0x431d67c49c100d4c",
|
|
426
|
-
"0x4cc5d4becb3e42b6",
|
|
427
|
-
"0x597f299cfc657e2a",
|
|
428
|
-
"0x5fcb6fab3ad6faec",
|
|
429
|
-
"0x6c44198c4a475817"
|
|
430
|
-
].map((n) => BigInt(n))))();
|
|
431
|
-
var SHA512_Kh = /* @__PURE__ */ (() => K512[0])();
|
|
432
|
-
var SHA512_Kl = /* @__PURE__ */ (() => K512[1])();
|
|
433
|
-
var SHA512_W_H = /* @__PURE__ */ new Uint32Array(80);
|
|
434
|
-
var SHA512_W_L = /* @__PURE__ */ new Uint32Array(80);
|
|
435
|
-
var SHA512 = class extends HashMD {
|
|
436
|
-
constructor(outputLen = 64) {
|
|
437
|
-
super(128, outputLen, 16, false);
|
|
438
|
-
this.Ah = SHA512_IV[0] | 0;
|
|
439
|
-
this.Al = SHA512_IV[1] | 0;
|
|
440
|
-
this.Bh = SHA512_IV[2] | 0;
|
|
441
|
-
this.Bl = SHA512_IV[3] | 0;
|
|
442
|
-
this.Ch = SHA512_IV[4] | 0;
|
|
443
|
-
this.Cl = SHA512_IV[5] | 0;
|
|
444
|
-
this.Dh = SHA512_IV[6] | 0;
|
|
445
|
-
this.Dl = SHA512_IV[7] | 0;
|
|
446
|
-
this.Eh = SHA512_IV[8] | 0;
|
|
447
|
-
this.El = SHA512_IV[9] | 0;
|
|
448
|
-
this.Fh = SHA512_IV[10] | 0;
|
|
449
|
-
this.Fl = SHA512_IV[11] | 0;
|
|
450
|
-
this.Gh = SHA512_IV[12] | 0;
|
|
451
|
-
this.Gl = SHA512_IV[13] | 0;
|
|
452
|
-
this.Hh = SHA512_IV[14] | 0;
|
|
453
|
-
this.Hl = SHA512_IV[15] | 0;
|
|
454
|
-
}
|
|
455
|
-
// prettier-ignore
|
|
456
|
-
get() {
|
|
457
|
-
const { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;
|
|
458
|
-
return [Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl];
|
|
459
|
-
}
|
|
460
|
-
// prettier-ignore
|
|
461
|
-
set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl) {
|
|
462
|
-
this.Ah = Ah | 0;
|
|
463
|
-
this.Al = Al | 0;
|
|
464
|
-
this.Bh = Bh | 0;
|
|
465
|
-
this.Bl = Bl | 0;
|
|
466
|
-
this.Ch = Ch | 0;
|
|
467
|
-
this.Cl = Cl | 0;
|
|
468
|
-
this.Dh = Dh | 0;
|
|
469
|
-
this.Dl = Dl | 0;
|
|
470
|
-
this.Eh = Eh | 0;
|
|
471
|
-
this.El = El | 0;
|
|
472
|
-
this.Fh = Fh | 0;
|
|
473
|
-
this.Fl = Fl | 0;
|
|
474
|
-
this.Gh = Gh | 0;
|
|
475
|
-
this.Gl = Gl | 0;
|
|
476
|
-
this.Hh = Hh | 0;
|
|
477
|
-
this.Hl = Hl | 0;
|
|
478
|
-
}
|
|
479
|
-
process(view, offset) {
|
|
480
|
-
for (let i = 0; i < 16; i++, offset += 4) {
|
|
481
|
-
SHA512_W_H[i] = view.getUint32(offset);
|
|
482
|
-
SHA512_W_L[i] = view.getUint32(offset += 4);
|
|
483
|
-
}
|
|
484
|
-
for (let i = 16; i < 80; i++) {
|
|
485
|
-
const W15h = SHA512_W_H[i - 15] | 0;
|
|
486
|
-
const W15l = SHA512_W_L[i - 15] | 0;
|
|
487
|
-
const s0h = rotrSH(W15h, W15l, 1) ^ rotrSH(W15h, W15l, 8) ^ shrSH(W15h, W15l, 7);
|
|
488
|
-
const s0l = rotrSL(W15h, W15l, 1) ^ rotrSL(W15h, W15l, 8) ^ shrSL(W15h, W15l, 7);
|
|
489
|
-
const W2h = SHA512_W_H[i - 2] | 0;
|
|
490
|
-
const W2l = SHA512_W_L[i - 2] | 0;
|
|
491
|
-
const s1h = rotrSH(W2h, W2l, 19) ^ rotrBH(W2h, W2l, 61) ^ shrSH(W2h, W2l, 6);
|
|
492
|
-
const s1l = rotrSL(W2h, W2l, 19) ^ rotrBL(W2h, W2l, 61) ^ shrSL(W2h, W2l, 6);
|
|
493
|
-
const SUMl = add4L(s0l, s1l, SHA512_W_L[i - 7], SHA512_W_L[i - 16]);
|
|
494
|
-
const SUMh = add4H(SUMl, s0h, s1h, SHA512_W_H[i - 7], SHA512_W_H[i - 16]);
|
|
495
|
-
SHA512_W_H[i] = SUMh | 0;
|
|
496
|
-
SHA512_W_L[i] = SUMl | 0;
|
|
497
|
-
}
|
|
498
|
-
let { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;
|
|
499
|
-
for (let i = 0; i < 80; i++) {
|
|
500
|
-
const sigma1h = rotrSH(Eh, El, 14) ^ rotrSH(Eh, El, 18) ^ rotrBH(Eh, El, 41);
|
|
501
|
-
const sigma1l = rotrSL(Eh, El, 14) ^ rotrSL(Eh, El, 18) ^ rotrBL(Eh, El, 41);
|
|
502
|
-
const CHIh = Eh & Fh ^ ~Eh & Gh;
|
|
503
|
-
const CHIl = El & Fl ^ ~El & Gl;
|
|
504
|
-
const T1ll = add5L(Hl, sigma1l, CHIl, SHA512_Kl[i], SHA512_W_L[i]);
|
|
505
|
-
const T1h = add5H(T1ll, Hh, sigma1h, CHIh, SHA512_Kh[i], SHA512_W_H[i]);
|
|
506
|
-
const T1l = T1ll | 0;
|
|
507
|
-
const sigma0h = rotrSH(Ah, Al, 28) ^ rotrBH(Ah, Al, 34) ^ rotrBH(Ah, Al, 39);
|
|
508
|
-
const sigma0l = rotrSL(Ah, Al, 28) ^ rotrBL(Ah, Al, 34) ^ rotrBL(Ah, Al, 39);
|
|
509
|
-
const MAJh = Ah & Bh ^ Ah & Ch ^ Bh & Ch;
|
|
510
|
-
const MAJl = Al & Bl ^ Al & Cl ^ Bl & Cl;
|
|
511
|
-
Hh = Gh | 0;
|
|
512
|
-
Hl = Gl | 0;
|
|
513
|
-
Gh = Fh | 0;
|
|
514
|
-
Gl = Fl | 0;
|
|
515
|
-
Fh = Eh | 0;
|
|
516
|
-
Fl = El | 0;
|
|
517
|
-
({ h: Eh, l: El } = add(Dh | 0, Dl | 0, T1h | 0, T1l | 0));
|
|
518
|
-
Dh = Ch | 0;
|
|
519
|
-
Dl = Cl | 0;
|
|
520
|
-
Ch = Bh | 0;
|
|
521
|
-
Cl = Bl | 0;
|
|
522
|
-
Bh = Ah | 0;
|
|
523
|
-
Bl = Al | 0;
|
|
524
|
-
const All = add3L(T1l, sigma0l, MAJl);
|
|
525
|
-
Ah = add3H(All, T1h, sigma0h, MAJh);
|
|
526
|
-
Al = All | 0;
|
|
527
|
-
}
|
|
528
|
-
({ h: Ah, l: Al } = add(this.Ah | 0, this.Al | 0, Ah | 0, Al | 0));
|
|
529
|
-
({ h: Bh, l: Bl } = add(this.Bh | 0, this.Bl | 0, Bh | 0, Bl | 0));
|
|
530
|
-
({ h: Ch, l: Cl } = add(this.Ch | 0, this.Cl | 0, Ch | 0, Cl | 0));
|
|
531
|
-
({ h: Dh, l: Dl } = add(this.Dh | 0, this.Dl | 0, Dh | 0, Dl | 0));
|
|
532
|
-
({ h: Eh, l: El } = add(this.Eh | 0, this.El | 0, Eh | 0, El | 0));
|
|
533
|
-
({ h: Fh, l: Fl } = add(this.Fh | 0, this.Fl | 0, Fh | 0, Fl | 0));
|
|
534
|
-
({ h: Gh, l: Gl } = add(this.Gh | 0, this.Gl | 0, Gh | 0, Gl | 0));
|
|
535
|
-
({ h: Hh, l: Hl } = add(this.Hh | 0, this.Hl | 0, Hh | 0, Hl | 0));
|
|
536
|
-
this.set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl);
|
|
537
|
-
}
|
|
538
|
-
roundClean() {
|
|
539
|
-
clean(SHA512_W_H, SHA512_W_L);
|
|
540
|
-
}
|
|
541
|
-
destroy() {
|
|
542
|
-
clean(this.buffer);
|
|
543
|
-
this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
|
544
|
-
}
|
|
545
|
-
};
|
|
546
|
-
var SHA384 = class extends SHA512 {
|
|
547
|
-
constructor() {
|
|
548
|
-
super(48);
|
|
549
|
-
this.Ah = SHA384_IV[0] | 0;
|
|
550
|
-
this.Al = SHA384_IV[1] | 0;
|
|
551
|
-
this.Bh = SHA384_IV[2] | 0;
|
|
552
|
-
this.Bl = SHA384_IV[3] | 0;
|
|
553
|
-
this.Ch = SHA384_IV[4] | 0;
|
|
554
|
-
this.Cl = SHA384_IV[5] | 0;
|
|
555
|
-
this.Dh = SHA384_IV[6] | 0;
|
|
556
|
-
this.Dl = SHA384_IV[7] | 0;
|
|
557
|
-
this.Eh = SHA384_IV[8] | 0;
|
|
558
|
-
this.El = SHA384_IV[9] | 0;
|
|
559
|
-
this.Fh = SHA384_IV[10] | 0;
|
|
560
|
-
this.Fl = SHA384_IV[11] | 0;
|
|
561
|
-
this.Gh = SHA384_IV[12] | 0;
|
|
562
|
-
this.Gl = SHA384_IV[13] | 0;
|
|
563
|
-
this.Hh = SHA384_IV[14] | 0;
|
|
564
|
-
this.Hl = SHA384_IV[15] | 0;
|
|
565
|
-
}
|
|
566
|
-
};
|
|
567
|
-
var sha256 = /* @__PURE__ */ createHasher(() => new SHA256());
|
|
568
|
-
var sha512 = /* @__PURE__ */ createHasher(() => new SHA512());
|
|
569
|
-
var sha384 = /* @__PURE__ */ createHasher(() => new SHA384());
|
|
570
|
-
|
|
571
15
|
// node_modules/@noble/curves/esm/utils.js
|
|
572
16
|
var _0n = /* @__PURE__ */ BigInt(0);
|
|
573
17
|
var _1n = /* @__PURE__ */ BigInt(1);
|
|
@@ -2022,7 +1466,7 @@ function hash_to_field(msg, count, options) {
|
|
|
2022
1466
|
return u;
|
|
2023
1467
|
}
|
|
2024
1468
|
var _DST_scalar = utf8ToBytes("HashToScalar-");
|
|
2025
|
-
function
|
|
1469
|
+
function createHasher(Point, mapToCurve, defaults) {
|
|
2026
1470
|
if (typeof mapToCurve !== "function")
|
|
2027
1471
|
throw new Error("mapToCurve() must be defined");
|
|
2028
1472
|
function map(num) {
|
|
@@ -2352,7 +1796,7 @@ function map_to_curve_elligator2_edwards25519(u) {
|
|
|
2352
1796
|
const [xd_inv, yd_inv] = FpInvertBatch(Fp, [xd, yd], true);
|
|
2353
1797
|
return { x: Fp.mul(xn, xd_inv), y: Fp.mul(yn, yd_inv) };
|
|
2354
1798
|
}
|
|
2355
|
-
var ed25519_hasher = /* @__PURE__ */ (() =>
|
|
1799
|
+
var ed25519_hasher = /* @__PURE__ */ (() => createHasher(ed25519.Point, (scalars) => map_to_curve_elligator2_edwards25519(scalars[0]), {
|
|
2356
1800
|
DST: "edwards25519_XMD:SHA-512_ELL2_RO_",
|
|
2357
1801
|
encodeDST: "edwards25519_XMD:SHA-512_ELL2_NU_",
|
|
2358
1802
|
p: ed25519_CURVE_p,
|
|
@@ -2545,9 +1989,6 @@ var hashToRistretto255 = /* @__PURE__ */ (() => ristretto255_hasher.hashToCurve)
|
|
|
2545
1989
|
var hash_to_ristretto255 = /* @__PURE__ */ (() => ristretto255_hasher.hashToCurve)();
|
|
2546
1990
|
|
|
2547
1991
|
export {
|
|
2548
|
-
sha256,
|
|
2549
|
-
sha512,
|
|
2550
|
-
sha384,
|
|
2551
1992
|
_abool2,
|
|
2552
1993
|
_abytes2,
|
|
2553
1994
|
numberToHexUnpadded,
|
|
@@ -190,6 +190,7 @@ function signDecision(entry) {
|
|
|
190
190
|
if (entry.timing) payload.timing = entry.timing;
|
|
191
191
|
if (entry.swarm) payload.swarm = entry.swarm;
|
|
192
192
|
if (entry.payload_digest) payload.payload_digest = entry.payload_digest;
|
|
193
|
+
if (entry.enrichment) payload.enrichment = entry.enrichment;
|
|
193
194
|
if (entry.action_readback) payload.action_readback = entry.action_readback;
|
|
194
195
|
if (entry.deny_iteration) payload.deny_iteration = entry.deny_iteration;
|
|
195
196
|
const result = artifactsModule.createSignedArtifact(
|