@forgezero/agent 0.1.152 → 0.1.154
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/agent-heartbeat.js +2 -2
- package/dist/agent-update-helper.js +1 -1
- package/dist/bootstrap.js +1 -1
- package/dist/deploy-plan-runner.d.ts +2 -0
- package/dist/deploy-plan-runner.js +2 -0
- package/dist/deployment.d.ts +2 -0
- package/dist/fz-agent.js +244 -373
- package/dist/fz.js +3414 -3675
- package/dist/metal-bootstrap.js +1 -1
- package/dist/operator-bootstrap.js +1 -1
- package/dist/pipeline.d.ts +2 -0
- package/dist/pipeline.js +4 -2
- package/dist/platform-fleet-verification.js +2 -2
- package/dist/provision.js +2 -2
- package/dist/ssh-bootstrap.d.ts +3 -1
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
package/dist/fz-agent.js
CHANGED
|
@@ -21,7 +21,7 @@ function fromBase64Url(value) {
|
|
|
21
21
|
return Uint8Array.from(binary, (character) => character.charCodeAt(0));
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
//
|
|
24
|
+
// ../../node_modules/.bun/@noble+hashes@2.4.0/node_modules/@noble/hashes/_u64.js
|
|
25
25
|
var U32_MASK64 = /* @__PURE__ */ (() => BigInt(2 ** 32 - 1))();
|
|
26
26
|
var _32n = /* @__PURE__ */ BigInt(32);
|
|
27
27
|
function fromBig(n, le = false) {
|
|
@@ -64,7 +64,7 @@ var add4H = (low, Ah, Bh, Ch, Dh) => Ah + Bh + Ch + Dh + (low / 2 ** 32 | 0) | 0
|
|
|
64
64
|
var add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0);
|
|
65
65
|
var add5H = (low, Ah, Bh, Ch, Dh, Eh) => Ah + Bh + Ch + Dh + Eh + (low / 2 ** 32 | 0) | 0;
|
|
66
66
|
|
|
67
|
-
//
|
|
67
|
+
// ../../node_modules/.bun/@noble+hashes@2.4.0/node_modules/@noble/hashes/utils.js
|
|
68
68
|
function isBytes(a) {
|
|
69
69
|
return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array" && "BYTES_PER_ELEMENT" in a && a.BYTES_PER_ELEMENT === 1;
|
|
70
70
|
}
|
|
@@ -89,18 +89,18 @@ function abytes(value, length, title = "") {
|
|
|
89
89
|
throw new TypeError(message);
|
|
90
90
|
throw new RangeError(message);
|
|
91
91
|
}
|
|
92
|
-
function ahash(h) {
|
|
93
|
-
if (typeof h !== "function" || typeof h.create !== "function")
|
|
94
|
-
throw new TypeError("expected hash wrapped by utils.createHasher");
|
|
95
|
-
anumber(h.outputLen);
|
|
96
|
-
anumber(h.blockLen);
|
|
97
|
-
if (h.outputLen < 1 || h.blockLen < 1)
|
|
98
|
-
throw new Error("hash blockLen / outputLen must be >= 1");
|
|
99
|
-
}
|
|
100
92
|
var aobject = (value, label) => {
|
|
101
93
|
if (value === null || typeof value !== "object" || Array.isArray(value))
|
|
102
94
|
throw new TypeError((label === "object" ? "" : `"${label}" `) + "expected object, got type=" + typeof value);
|
|
103
95
|
};
|
|
96
|
+
var aopts = (value, label) => {
|
|
97
|
+
aobject(value, label);
|
|
98
|
+
const proto = Object.getPrototypeOf(value);
|
|
99
|
+
if (proto !== Object.prototype && proto !== null)
|
|
100
|
+
throw new TypeError(`"${label}" expected plain object`);
|
|
101
|
+
if (Object.hasOwn(value, "__proto__"))
|
|
102
|
+
throw new TypeError(`"${label}.__proto__" is not allowed`);
|
|
103
|
+
};
|
|
104
104
|
function aexists(instance, checkFinished = true) {
|
|
105
105
|
if (instance.destroyed)
|
|
106
106
|
throw new Error("hash was destroyed");
|
|
@@ -122,9 +122,6 @@ function clean(...arrays) {
|
|
|
122
122
|
function createView(arr) {
|
|
123
123
|
return new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
|
|
124
124
|
}
|
|
125
|
-
function rotr(word, shift) {
|
|
126
|
-
return word << 32 - shift | word >>> shift;
|
|
127
|
-
}
|
|
128
125
|
var hasHexBuiltin = /* @__PURE__ */ (() => typeof Uint8Array.from([]).toHex === "function" && typeof Uint8Array.fromHex === "function")();
|
|
129
126
|
var hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, "0"));
|
|
130
127
|
function bytesToHex(bytes) {
|
|
@@ -184,10 +181,10 @@ function concatBytes(...arrays) {
|
|
|
184
181
|
return res;
|
|
185
182
|
}
|
|
186
183
|
function checkOpts(defaults, opts, title = "opts") {
|
|
187
|
-
|
|
184
|
+
aopts(defaults, "defaults");
|
|
188
185
|
if (opts !== undefined)
|
|
189
|
-
|
|
190
|
-
const merged = Object.assign(defaults, opts);
|
|
186
|
+
aopts(opts, title);
|
|
187
|
+
const merged = Object.assign(Object.create(null), defaults, opts);
|
|
191
188
|
return merged;
|
|
192
189
|
}
|
|
193
190
|
function createHasher(hashCons, info = {}) {
|
|
@@ -216,14 +213,7 @@ var oidNist = (suffix) => ({
|
|
|
216
213
|
oid: Uint8Array.from([6, 9, 96, 134, 72, 1, 101, 3, 4, 2, suffix])
|
|
217
214
|
});
|
|
218
215
|
|
|
219
|
-
//
|
|
220
|
-
function Chi(a, b, c) {
|
|
221
|
-
return a & b ^ ~a & c;
|
|
222
|
-
}
|
|
223
|
-
function Maj(a, b, c) {
|
|
224
|
-
return a & b ^ a & c ^ b & c;
|
|
225
|
-
}
|
|
226
|
-
|
|
216
|
+
// ../../node_modules/.bun/@noble+hashes@2.4.0/node_modules/@noble/hashes/_md.js
|
|
227
217
|
class HashMD {
|
|
228
218
|
blockLen;
|
|
229
219
|
outputLen;
|
|
@@ -318,16 +308,6 @@ class HashMD {
|
|
|
318
308
|
return this._cloneInto();
|
|
319
309
|
}
|
|
320
310
|
}
|
|
321
|
-
var SHA256_IV = /* @__PURE__ */ Uint32Array.from([
|
|
322
|
-
1779033703,
|
|
323
|
-
3144134277,
|
|
324
|
-
1013904242,
|
|
325
|
-
2773480762,
|
|
326
|
-
1359893119,
|
|
327
|
-
2600822924,
|
|
328
|
-
528734635,
|
|
329
|
-
1541459225
|
|
330
|
-
]);
|
|
331
311
|
var SHA512_IV = /* @__PURE__ */ Uint32Array.from([
|
|
332
312
|
1779033703,
|
|
333
313
|
4089235720,
|
|
@@ -347,163 +327,7 @@ var SHA512_IV = /* @__PURE__ */ Uint32Array.from([
|
|
|
347
327
|
327033209
|
|
348
328
|
]);
|
|
349
329
|
|
|
350
|
-
//
|
|
351
|
-
var SHA256_K = /* @__PURE__ */ Uint32Array.from([
|
|
352
|
-
1116352408,
|
|
353
|
-
1899447441,
|
|
354
|
-
3049323471,
|
|
355
|
-
3921009573,
|
|
356
|
-
961987163,
|
|
357
|
-
1508970993,
|
|
358
|
-
2453635748,
|
|
359
|
-
2870763221,
|
|
360
|
-
3624381080,
|
|
361
|
-
310598401,
|
|
362
|
-
607225278,
|
|
363
|
-
1426881987,
|
|
364
|
-
1925078388,
|
|
365
|
-
2162078206,
|
|
366
|
-
2614888103,
|
|
367
|
-
3248222580,
|
|
368
|
-
3835390401,
|
|
369
|
-
4022224774,
|
|
370
|
-
264347078,
|
|
371
|
-
604807628,
|
|
372
|
-
770255983,
|
|
373
|
-
1249150122,
|
|
374
|
-
1555081692,
|
|
375
|
-
1996064986,
|
|
376
|
-
2554220882,
|
|
377
|
-
2821834349,
|
|
378
|
-
2952996808,
|
|
379
|
-
3210313671,
|
|
380
|
-
3336571891,
|
|
381
|
-
3584528711,
|
|
382
|
-
113926993,
|
|
383
|
-
338241895,
|
|
384
|
-
666307205,
|
|
385
|
-
773529912,
|
|
386
|
-
1294757372,
|
|
387
|
-
1396182291,
|
|
388
|
-
1695183700,
|
|
389
|
-
1986661051,
|
|
390
|
-
2177026350,
|
|
391
|
-
2456956037,
|
|
392
|
-
2730485921,
|
|
393
|
-
2820302411,
|
|
394
|
-
3259730800,
|
|
395
|
-
3345764771,
|
|
396
|
-
3516065817,
|
|
397
|
-
3600352804,
|
|
398
|
-
4094571909,
|
|
399
|
-
275423344,
|
|
400
|
-
430227734,
|
|
401
|
-
506948616,
|
|
402
|
-
659060556,
|
|
403
|
-
883997877,
|
|
404
|
-
958139571,
|
|
405
|
-
1322822218,
|
|
406
|
-
1537002063,
|
|
407
|
-
1747873779,
|
|
408
|
-
1955562222,
|
|
409
|
-
2024104815,
|
|
410
|
-
2227730452,
|
|
411
|
-
2361852424,
|
|
412
|
-
2428436474,
|
|
413
|
-
2756734187,
|
|
414
|
-
3204031479,
|
|
415
|
-
3329325298
|
|
416
|
-
]);
|
|
417
|
-
var SHA256_W = /* @__PURE__ */ new Uint32Array(64);
|
|
418
|
-
|
|
419
|
-
class SHA2_32B extends HashMD {
|
|
420
|
-
A = 0;
|
|
421
|
-
B = 0;
|
|
422
|
-
C = 0;
|
|
423
|
-
D = 0;
|
|
424
|
-
E = 0;
|
|
425
|
-
F = 0;
|
|
426
|
-
G = 0;
|
|
427
|
-
H = 0;
|
|
428
|
-
constructor(outputLen, IV) {
|
|
429
|
-
super(64, outputLen, 8, false);
|
|
430
|
-
this.A = IV[0] | 0;
|
|
431
|
-
this.B = IV[1] | 0;
|
|
432
|
-
this.C = IV[2] | 0;
|
|
433
|
-
this.D = IV[3] | 0;
|
|
434
|
-
this.E = IV[4] | 0;
|
|
435
|
-
this.F = IV[5] | 0;
|
|
436
|
-
this.G = IV[6] | 0;
|
|
437
|
-
this.H = IV[7] | 0;
|
|
438
|
-
}
|
|
439
|
-
get() {
|
|
440
|
-
const { A, B, C, D, E, F, G, H } = this;
|
|
441
|
-
return [A, B, C, D, E, F, G, H];
|
|
442
|
-
}
|
|
443
|
-
set(A, B, C, D, E, F, G, H) {
|
|
444
|
-
this.A = A | 0;
|
|
445
|
-
this.B = B | 0;
|
|
446
|
-
this.C = C | 0;
|
|
447
|
-
this.D = D | 0;
|
|
448
|
-
this.E = E | 0;
|
|
449
|
-
this.F = F | 0;
|
|
450
|
-
this.G = G | 0;
|
|
451
|
-
this.H = H | 0;
|
|
452
|
-
}
|
|
453
|
-
_cloneInto(to) {
|
|
454
|
-
(to ||= new this.constructor).set(...this.get());
|
|
455
|
-
return this._cloneIntoMeta(to);
|
|
456
|
-
}
|
|
457
|
-
process(view, offset) {
|
|
458
|
-
for (let i = 0;i < 16; i++, offset += 4)
|
|
459
|
-
SHA256_W[i] = view.getUint32(offset, false);
|
|
460
|
-
for (let i = 16;i < 64; i++) {
|
|
461
|
-
const W15 = SHA256_W[i - 15];
|
|
462
|
-
const W2 = SHA256_W[i - 2];
|
|
463
|
-
const s0 = rotr(W15, 7) ^ rotr(W15, 18) ^ W15 >>> 3;
|
|
464
|
-
const s1 = rotr(W2, 17) ^ rotr(W2, 19) ^ W2 >>> 10;
|
|
465
|
-
SHA256_W[i] = s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16] | 0;
|
|
466
|
-
}
|
|
467
|
-
let { A, B, C, D, E, F, G, H } = this;
|
|
468
|
-
for (let i = 0;i < 64; i++) {
|
|
469
|
-
const sigma1 = rotr(E, 6) ^ rotr(E, 11) ^ rotr(E, 25);
|
|
470
|
-
const T1 = H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i] | 0;
|
|
471
|
-
const sigma0 = rotr(A, 2) ^ rotr(A, 13) ^ rotr(A, 22);
|
|
472
|
-
const T2 = sigma0 + Maj(A, B, C) | 0;
|
|
473
|
-
H = G;
|
|
474
|
-
G = F;
|
|
475
|
-
F = E;
|
|
476
|
-
E = D + T1 | 0;
|
|
477
|
-
D = C;
|
|
478
|
-
C = B;
|
|
479
|
-
B = A;
|
|
480
|
-
A = T1 + T2 | 0;
|
|
481
|
-
}
|
|
482
|
-
A = A + this.A | 0;
|
|
483
|
-
B = B + this.B | 0;
|
|
484
|
-
C = C + this.C | 0;
|
|
485
|
-
D = D + this.D | 0;
|
|
486
|
-
E = E + this.E | 0;
|
|
487
|
-
F = F + this.F | 0;
|
|
488
|
-
G = G + this.G | 0;
|
|
489
|
-
H = H + this.H | 0;
|
|
490
|
-
this.set(A, B, C, D, E, F, G, H);
|
|
491
|
-
}
|
|
492
|
-
roundClean() {
|
|
493
|
-
clean(SHA256_W);
|
|
494
|
-
}
|
|
495
|
-
destroy() {
|
|
496
|
-
this.destroyed = true;
|
|
497
|
-
this.set(0, 0, 0, 0, 0, 0, 0, 0);
|
|
498
|
-
clean(this.buffer);
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
class _SHA256 extends SHA2_32B {
|
|
503
|
-
constructor() {
|
|
504
|
-
super(32, SHA256_IV);
|
|
505
|
-
}
|
|
506
|
-
}
|
|
330
|
+
// ../../node_modules/.bun/@noble+hashes@2.4.0/node_modules/@noble/hashes/sha2.js
|
|
507
331
|
var K512 = /* @__PURE__ */ (() => split([
|
|
508
332
|
"0x428a2f98d728ae22",
|
|
509
333
|
"0x7137449123ef65cd",
|
|
@@ -727,10 +551,9 @@ class _SHA512 extends SHA2_64B {
|
|
|
727
551
|
super(64, SHA512_IV);
|
|
728
552
|
}
|
|
729
553
|
}
|
|
730
|
-
var sha256 = /* @__PURE__ */ createHasher(() => new _SHA256, /* @__PURE__ */ oidNist(1));
|
|
731
554
|
var sha512 = /* @__PURE__ */ createHasher(() => new _SHA512, /* @__PURE__ */ oidNist(3));
|
|
732
555
|
|
|
733
|
-
//
|
|
556
|
+
// ../../node_modules/.bun/@noble+curves@2.4.0/node_modules/@noble/curves/utils.js
|
|
734
557
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
735
558
|
function aarray(item, title, inner = () => {}) {
|
|
736
559
|
if (!Array.isArray(item))
|
|
@@ -850,7 +673,7 @@ function validateObject(object, fields = {}, optFields = {}, title = "object") {
|
|
|
850
673
|
iter(optFields, true);
|
|
851
674
|
}
|
|
852
675
|
|
|
853
|
-
//
|
|
676
|
+
// ../../node_modules/.bun/@noble+curves@2.4.0/node_modules/@noble/curves/abstract/modular.js
|
|
854
677
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
855
678
|
var _0n2 = /* @__PURE__ */ BigInt(0);
|
|
856
679
|
var _1n2 = /* @__PURE__ */ BigInt(1);
|
|
@@ -1276,7 +1099,7 @@ function Field(ORDER, opts = {}) {
|
|
|
1276
1099
|
return new _Field(ORDER, opts);
|
|
1277
1100
|
}
|
|
1278
1101
|
|
|
1279
|
-
//
|
|
1102
|
+
// ../../node_modules/.bun/@noble+curves@2.4.0/node_modules/@noble/curves/abstract/curve.js
|
|
1280
1103
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
1281
1104
|
var _0n3 = /* @__PURE__ */ BigInt(0);
|
|
1282
1105
|
var _1n3 = /* @__PURE__ */ BigInt(1);
|
|
@@ -1616,7 +1439,7 @@ function createKeygen(randomSecretKey, getPublicKey) {
|
|
|
1616
1439
|
};
|
|
1617
1440
|
}
|
|
1618
1441
|
|
|
1619
|
-
//
|
|
1442
|
+
// ../../node_modules/.bun/@noble+curves@2.4.0/node_modules/@noble/curves/abstract/edwards.js
|
|
1620
1443
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
1621
1444
|
var _0n4 = /* @__PURE__ */ BigInt(0);
|
|
1622
1445
|
var _1n4 = /* @__PURE__ */ BigInt(1);
|
|
@@ -1945,7 +1768,7 @@ function eddsa(Point, cHash, eddsaOpts = {}) {
|
|
|
1945
1768
|
}
|
|
1946
1769
|
function sign(msg, secretKey, options = {}) {
|
|
1947
1770
|
validateObject(options, {}, {}, "options");
|
|
1948
|
-
msg = abytes2(msg, undefined, "message");
|
|
1771
|
+
msg = copyBytes(abytes2(msg, undefined, "message"));
|
|
1949
1772
|
if (prehash)
|
|
1950
1773
|
msg = prehash(msg);
|
|
1951
1774
|
const { prefix, scalar, pointBytes } = getExtendedPublicKey(secretKey);
|
|
@@ -2040,7 +1863,7 @@ function eddsa(Point, cHash, eddsaOpts = {}) {
|
|
|
2040
1863
|
});
|
|
2041
1864
|
}
|
|
2042
1865
|
|
|
2043
|
-
//
|
|
1866
|
+
// ../../node_modules/.bun/@noble+curves@2.4.0/node_modules/@noble/curves/ed25519.js
|
|
2044
1867
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
2045
1868
|
var _1n5 = /* @__PURE__ */ BigInt(1);
|
|
2046
1869
|
var _2n3 = /* @__PURE__ */ BigInt(2);
|
|
@@ -2116,7 +1939,7 @@ function ed(opts) {
|
|
|
2116
1939
|
}
|
|
2117
1940
|
var ed25519 = /* @__PURE__ */ ed({});
|
|
2118
1941
|
|
|
2119
|
-
//
|
|
1942
|
+
// ../../node_modules/.bun/@noble+hashes@2.2.0/node_modules/@noble/hashes/utils.js
|
|
2120
1943
|
function isBytes3(a) {
|
|
2121
1944
|
return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array" && "BYTES_PER_ELEMENT" in a && a.BYTES_PER_ELEMENT === 1;
|
|
2122
1945
|
}
|
|
@@ -2145,6 +1968,16 @@ function abytes3(value, length, title = "") {
|
|
|
2145
1968
|
}
|
|
2146
1969
|
return value;
|
|
2147
1970
|
}
|
|
1971
|
+
function ahash(h) {
|
|
1972
|
+
if (typeof h !== "function" || typeof h.create !== "function")
|
|
1973
|
+
throw new TypeError("Hash must wrapped by utils.createHasher");
|
|
1974
|
+
anumber3(h.outputLen);
|
|
1975
|
+
anumber3(h.blockLen);
|
|
1976
|
+
if (h.outputLen < 1)
|
|
1977
|
+
throw new Error('"outputLen" must be >= 1');
|
|
1978
|
+
if (h.blockLen < 1)
|
|
1979
|
+
throw new Error('"blockLen" must be >= 1');
|
|
1980
|
+
}
|
|
2148
1981
|
function aexists2(instance, checkFinished = true) {
|
|
2149
1982
|
if (instance.destroyed)
|
|
2150
1983
|
throw new Error("Hash instance has been destroyed");
|
|
@@ -2271,7 +2104,7 @@ var oidNist2 = (suffix) => ({
|
|
|
2271
2104
|
oid: Uint8Array.from([6, 9, 96, 134, 72, 1, 101, 3, 4, 2, suffix])
|
|
2272
2105
|
});
|
|
2273
2106
|
|
|
2274
|
-
//
|
|
2107
|
+
// ../../node_modules/.bun/@noble+curves@2.2.0/node_modules/@noble/curves/utils.js
|
|
2275
2108
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
2276
2109
|
var abytes4 = (value, length, title) => abytes3(value, length, title);
|
|
2277
2110
|
var anumber4 = anumber3;
|
|
@@ -2393,7 +2226,7 @@ var notImplemented2 = () => {
|
|
|
2393
2226
|
throw new Error("not implemented");
|
|
2394
2227
|
};
|
|
2395
2228
|
|
|
2396
|
-
//
|
|
2229
|
+
// ../../node_modules/.bun/@noble+hashes@2.2.0/node_modules/@noble/hashes/_u64.js
|
|
2397
2230
|
var U32_MASK642 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
|
|
2398
2231
|
var _32n2 = /* @__PURE__ */ BigInt(32);
|
|
2399
2232
|
function fromBig2(n, le = false) {
|
|
@@ -2432,7 +2265,7 @@ var add4H2 = (low, Ah, Bh, Ch, Dh) => Ah + Bh + Ch + Dh + (low / 2 ** 32 | 0) |
|
|
|
2432
2265
|
var add5L2 = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0);
|
|
2433
2266
|
var add5H2 = (low, Ah, Bh, Ch, Dh, Eh) => Ah + Bh + Ch + Dh + Eh + (low / 2 ** 32 | 0) | 0;
|
|
2434
2267
|
|
|
2435
|
-
//
|
|
2268
|
+
// ../../node_modules/.bun/@noble+hashes@2.2.0/node_modules/@noble/hashes/sha3.js
|
|
2436
2269
|
var _0n6 = BigInt(0);
|
|
2437
2270
|
var _1n7 = BigInt(1);
|
|
2438
2271
|
var _2n4 = BigInt(2);
|
|
@@ -2636,7 +2469,7 @@ var genShake = (suffix, blockLen, outputLen, info = {}) => createHasher2((opts =
|
|
|
2636
2469
|
var shake128 = /* @__PURE__ */ genShake(31, 168, 16, /* @__PURE__ */ oidNist2(11));
|
|
2637
2470
|
var shake256 = /* @__PURE__ */ genShake(31, 136, 32, /* @__PURE__ */ oidNist2(12));
|
|
2638
2471
|
|
|
2639
|
-
//
|
|
2472
|
+
// ../../node_modules/.bun/@noble+curves@2.2.0/node_modules/@noble/curves/abstract/fft.js
|
|
2640
2473
|
function checkU32(n) {
|
|
2641
2474
|
if (!Number.isSafeInteger(n) || n < 0 || n > 4294967295)
|
|
2642
2475
|
throw new Error("wrong u32 integer:" + n);
|
|
@@ -2720,7 +2553,7 @@ var FFTCore = (F, coreOpts) => {
|
|
|
2720
2553
|
};
|
|
2721
2554
|
};
|
|
2722
2555
|
|
|
2723
|
-
//
|
|
2556
|
+
// ../../node_modules/.bun/@noble+post-quantum@0.6.1/node_modules/@noble/post-quantum/utils.js
|
|
2724
2557
|
/*! noble-post-quantum - MIT License (c) 2024 Paul Miller (paulmillr.com) */
|
|
2725
2558
|
var abytesDoc = abytes3;
|
|
2726
2559
|
var randomBytes5 = randomBytes3;
|
|
@@ -2847,7 +2680,7 @@ function getMessagePrehash(hash, msg, ctx = EMPTY) {
|
|
|
2847
2680
|
return concatBytes3(new Uint8Array([1, ctx.length]), ctx, hash.oid, hashed);
|
|
2848
2681
|
}
|
|
2849
2682
|
|
|
2850
|
-
//
|
|
2683
|
+
// ../../node_modules/.bun/@noble+post-quantum@0.6.1/node_modules/@noble/post-quantum/_crystals.js
|
|
2851
2684
|
/*! noble-post-quantum - MIT License (c) 2024 Paul Miller (paulmillr.com) */
|
|
2852
2685
|
var genCrystals = (opts) => {
|
|
2853
2686
|
const { newPoly, N, Q, F, ROOT_OF_UNITY, brvBits, isKyber } = opts;
|
|
@@ -2968,7 +2801,7 @@ var createXofShake = (shake) => (seed, blockLen) => {
|
|
|
2968
2801
|
var XOF128 = /* @__PURE__ */ createXofShake(shake128);
|
|
2969
2802
|
var XOF256 = /* @__PURE__ */ createXofShake(shake256);
|
|
2970
2803
|
|
|
2971
|
-
//
|
|
2804
|
+
// ../../node_modules/.bun/@noble+post-quantum@0.6.1/node_modules/@noble/post-quantum/ml-dsa.js
|
|
2972
2805
|
/*! noble-post-quantum - MIT License (c) 2024 Paul Miller (paulmillr.com) */
|
|
2973
2806
|
function validateInternalOpts(opts) {
|
|
2974
2807
|
validateOpts(opts);
|
|
@@ -3483,7 +3316,7 @@ var ml_dsa65 = /* @__PURE__ */ (() => getDilithium({
|
|
|
3483
3316
|
securityLevel: 192
|
|
3484
3317
|
}))();
|
|
3485
3318
|
|
|
3486
|
-
//
|
|
3319
|
+
// ../../node_modules/.bun/@noble+curves@2.2.0/node_modules/@noble/curves/abstract/modular.js
|
|
3487
3320
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
3488
3321
|
var _0n7 = /* @__PURE__ */ BigInt(0);
|
|
3489
3322
|
var _1n8 = /* @__PURE__ */ BigInt(1);
|
|
@@ -3872,7 +3705,7 @@ function Field2(ORDER, opts = {}) {
|
|
|
3872
3705
|
return new _Field2(ORDER, opts);
|
|
3873
3706
|
}
|
|
3874
3707
|
|
|
3875
|
-
//
|
|
3708
|
+
// ../../node_modules/.bun/@noble+curves@2.2.0/node_modules/@noble/curves/abstract/curve.js
|
|
3876
3709
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
3877
3710
|
var _0n8 = /* @__PURE__ */ BigInt(0);
|
|
3878
3711
|
var _1n9 = /* @__PURE__ */ BigInt(1);
|
|
@@ -4064,7 +3897,7 @@ function createKeygen2(randomSecretKey, getPublicKey) {
|
|
|
4064
3897
|
};
|
|
4065
3898
|
}
|
|
4066
3899
|
|
|
4067
|
-
//
|
|
3900
|
+
// ../../node_modules/.bun/@noble+curves@2.2.0/node_modules/@noble/curves/abstract/edwards.js
|
|
4068
3901
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
4069
3902
|
var _0n9 = /* @__PURE__ */ BigInt(0);
|
|
4070
3903
|
var _1n10 = /* @__PURE__ */ BigInt(1);
|
|
@@ -4380,7 +4213,7 @@ class PrimeEdwardsPoint2 {
|
|
|
4380
4213
|
}
|
|
4381
4214
|
}
|
|
4382
4215
|
|
|
4383
|
-
//
|
|
4216
|
+
// ../../node_modules/.bun/@noble+curves@2.2.0/node_modules/@noble/curves/abstract/montgomery.js
|
|
4384
4217
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
4385
4218
|
var _0n10 = BigInt(0);
|
|
4386
4219
|
var _1n11 = BigInt(1);
|
|
@@ -4503,7 +4336,83 @@ function montgomery(curveDef) {
|
|
|
4503
4336
|
});
|
|
4504
4337
|
}
|
|
4505
4338
|
|
|
4506
|
-
//
|
|
4339
|
+
// ../../node_modules/.bun/@noble+hashes@2.2.0/node_modules/@noble/hashes/hmac.js
|
|
4340
|
+
class _HMAC {
|
|
4341
|
+
oHash;
|
|
4342
|
+
iHash;
|
|
4343
|
+
blockLen;
|
|
4344
|
+
outputLen;
|
|
4345
|
+
canXOF = false;
|
|
4346
|
+
finished = false;
|
|
4347
|
+
destroyed = false;
|
|
4348
|
+
constructor(hash, key) {
|
|
4349
|
+
ahash(hash);
|
|
4350
|
+
abytes3(key, undefined, "key");
|
|
4351
|
+
this.iHash = hash.create();
|
|
4352
|
+
if (typeof this.iHash.update !== "function")
|
|
4353
|
+
throw new Error("Expected instance of class which extends utils.Hash");
|
|
4354
|
+
this.blockLen = this.iHash.blockLen;
|
|
4355
|
+
this.outputLen = this.iHash.outputLen;
|
|
4356
|
+
const blockLen = this.blockLen;
|
|
4357
|
+
const pad = new Uint8Array(blockLen);
|
|
4358
|
+
pad.set(key.length > blockLen ? hash.create().update(key).digest() : key);
|
|
4359
|
+
for (let i = 0;i < pad.length; i++)
|
|
4360
|
+
pad[i] ^= 54;
|
|
4361
|
+
this.iHash.update(pad);
|
|
4362
|
+
this.oHash = hash.create();
|
|
4363
|
+
for (let i = 0;i < pad.length; i++)
|
|
4364
|
+
pad[i] ^= 54 ^ 92;
|
|
4365
|
+
this.oHash.update(pad);
|
|
4366
|
+
clean2(pad);
|
|
4367
|
+
}
|
|
4368
|
+
update(buf) {
|
|
4369
|
+
aexists2(this);
|
|
4370
|
+
this.iHash.update(buf);
|
|
4371
|
+
return this;
|
|
4372
|
+
}
|
|
4373
|
+
digestInto(out) {
|
|
4374
|
+
aexists2(this);
|
|
4375
|
+
aoutput2(out, this);
|
|
4376
|
+
this.finished = true;
|
|
4377
|
+
const buf = out.subarray(0, this.outputLen);
|
|
4378
|
+
this.iHash.digestInto(buf);
|
|
4379
|
+
this.oHash.update(buf);
|
|
4380
|
+
this.oHash.digestInto(buf);
|
|
4381
|
+
this.destroy();
|
|
4382
|
+
}
|
|
4383
|
+
digest() {
|
|
4384
|
+
const out = new Uint8Array(this.oHash.outputLen);
|
|
4385
|
+
this.digestInto(out);
|
|
4386
|
+
return out;
|
|
4387
|
+
}
|
|
4388
|
+
_cloneInto(to) {
|
|
4389
|
+
to ||= Object.create(Object.getPrototypeOf(this), {});
|
|
4390
|
+
const { oHash, iHash, finished, destroyed, blockLen, outputLen } = this;
|
|
4391
|
+
to = to;
|
|
4392
|
+
to.finished = finished;
|
|
4393
|
+
to.destroyed = destroyed;
|
|
4394
|
+
to.blockLen = blockLen;
|
|
4395
|
+
to.outputLen = outputLen;
|
|
4396
|
+
to.oHash = oHash._cloneInto(to.oHash);
|
|
4397
|
+
to.iHash = iHash._cloneInto(to.iHash);
|
|
4398
|
+
return to;
|
|
4399
|
+
}
|
|
4400
|
+
clone() {
|
|
4401
|
+
return this._cloneInto();
|
|
4402
|
+
}
|
|
4403
|
+
destroy() {
|
|
4404
|
+
this.destroyed = true;
|
|
4405
|
+
this.oHash.destroy();
|
|
4406
|
+
this.iHash.destroy();
|
|
4407
|
+
}
|
|
4408
|
+
}
|
|
4409
|
+
var hmac = /* @__PURE__ */ (() => {
|
|
4410
|
+
const hmac_ = (hash, key, message) => new _HMAC(hash, key).update(message).digest();
|
|
4411
|
+
hmac_.create = (hash, key) => new _HMAC(hash, key);
|
|
4412
|
+
return hmac_;
|
|
4413
|
+
})();
|
|
4414
|
+
|
|
4415
|
+
// ../../node_modules/.bun/@noble+hashes@2.2.0/node_modules/@noble/hashes/_md.js
|
|
4507
4416
|
function Chi2(a, b, c) {
|
|
4508
4417
|
return a & b ^ ~a & c;
|
|
4509
4418
|
}
|
|
@@ -4663,8 +4572,8 @@ var SHA512_IV2 = /* @__PURE__ */ Uint32Array.from([
|
|
|
4663
4572
|
327033209
|
|
4664
4573
|
]);
|
|
4665
4574
|
|
|
4666
|
-
//
|
|
4667
|
-
var
|
|
4575
|
+
// ../../node_modules/.bun/@noble+hashes@2.2.0/node_modules/@noble/hashes/sha2.js
|
|
4576
|
+
var SHA256_K = /* @__PURE__ */ Uint32Array.from([
|
|
4668
4577
|
1116352408,
|
|
4669
4578
|
1899447441,
|
|
4670
4579
|
3049323471,
|
|
@@ -4730,9 +4639,9 @@ var SHA256_K2 = /* @__PURE__ */ Uint32Array.from([
|
|
|
4730
4639
|
3204031479,
|
|
4731
4640
|
3329325298
|
|
4732
4641
|
]);
|
|
4733
|
-
var
|
|
4642
|
+
var SHA256_W = /* @__PURE__ */ new Uint32Array(64);
|
|
4734
4643
|
|
|
4735
|
-
class
|
|
4644
|
+
class SHA2_32B extends HashMD2 {
|
|
4736
4645
|
constructor(outputLen) {
|
|
4737
4646
|
super(64, outputLen, 8, false);
|
|
4738
4647
|
}
|
|
@@ -4752,18 +4661,18 @@ class SHA2_32B2 extends HashMD2 {
|
|
|
4752
4661
|
}
|
|
4753
4662
|
process(view, offset) {
|
|
4754
4663
|
for (let i = 0;i < 16; i++, offset += 4)
|
|
4755
|
-
|
|
4664
|
+
SHA256_W[i] = view.getUint32(offset, false);
|
|
4756
4665
|
for (let i = 16;i < 64; i++) {
|
|
4757
|
-
const W15 =
|
|
4758
|
-
const W2 =
|
|
4666
|
+
const W15 = SHA256_W[i - 15];
|
|
4667
|
+
const W2 = SHA256_W[i - 2];
|
|
4759
4668
|
const s0 = rotr2(W15, 7) ^ rotr2(W15, 18) ^ W15 >>> 3;
|
|
4760
4669
|
const s1 = rotr2(W2, 17) ^ rotr2(W2, 19) ^ W2 >>> 10;
|
|
4761
|
-
|
|
4670
|
+
SHA256_W[i] = s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16] | 0;
|
|
4762
4671
|
}
|
|
4763
4672
|
let { A, B, C, D: D2, E, F: F2, G, H } = this;
|
|
4764
4673
|
for (let i = 0;i < 64; i++) {
|
|
4765
4674
|
const sigma1 = rotr2(E, 6) ^ rotr2(E, 11) ^ rotr2(E, 25);
|
|
4766
|
-
const T1 = H + sigma1 + Chi2(E, F2, G) +
|
|
4675
|
+
const T1 = H + sigma1 + Chi2(E, F2, G) + SHA256_K[i] + SHA256_W[i] | 0;
|
|
4767
4676
|
const sigma0 = rotr2(A, 2) ^ rotr2(A, 13) ^ rotr2(A, 22);
|
|
4768
4677
|
const T2 = sigma0 + Maj2(A, B, C) | 0;
|
|
4769
4678
|
H = G;
|
|
@@ -4786,7 +4695,7 @@ class SHA2_32B2 extends HashMD2 {
|
|
|
4786
4695
|
this.set(A, B, C, D2, E, F2, G, H);
|
|
4787
4696
|
}
|
|
4788
4697
|
roundClean() {
|
|
4789
|
-
clean2(
|
|
4698
|
+
clean2(SHA256_W);
|
|
4790
4699
|
}
|
|
4791
4700
|
destroy() {
|
|
4792
4701
|
this.destroyed = true;
|
|
@@ -4795,7 +4704,7 @@ class SHA2_32B2 extends HashMD2 {
|
|
|
4795
4704
|
}
|
|
4796
4705
|
}
|
|
4797
4706
|
|
|
4798
|
-
class
|
|
4707
|
+
class _SHA256 extends SHA2_32B {
|
|
4799
4708
|
A = SHA256_IV2[0] | 0;
|
|
4800
4709
|
B = SHA256_IV2[1] | 0;
|
|
4801
4710
|
C = SHA256_IV2[2] | 0;
|
|
@@ -4809,7 +4718,7 @@ class _SHA2562 extends SHA2_32B2 {
|
|
|
4809
4718
|
}
|
|
4810
4719
|
}
|
|
4811
4720
|
|
|
4812
|
-
class _SHA224 extends
|
|
4721
|
+
class _SHA224 extends SHA2_32B {
|
|
4813
4722
|
A = SHA224_IV2[0] | 0;
|
|
4814
4723
|
B = SHA224_IV2[1] | 0;
|
|
4815
4724
|
C = SHA224_IV2[2] | 0;
|
|
@@ -5127,9 +5036,10 @@ class _SHA512_256 extends SHA2_64B2 {
|
|
|
5127
5036
|
super(32);
|
|
5128
5037
|
}
|
|
5129
5038
|
}
|
|
5039
|
+
var sha256 = /* @__PURE__ */ createHasher2(() => new _SHA256, /* @__PURE__ */ oidNist2(1));
|
|
5130
5040
|
var sha5122 = /* @__PURE__ */ createHasher2(() => new _SHA5122, /* @__PURE__ */ oidNist2(3));
|
|
5131
5041
|
|
|
5132
|
-
//
|
|
5042
|
+
// ../../node_modules/.bun/@noble+curves@2.2.0/node_modules/@noble/curves/abstract/hash-to-curve.js
|
|
5133
5043
|
function i2osp(value, length) {
|
|
5134
5044
|
asafenumber2(value);
|
|
5135
5045
|
asafenumber2(length);
|
|
@@ -5184,7 +5094,7 @@ function expand_message_xmd(msg, DST, lenInBytes, H) {
|
|
|
5184
5094
|
}
|
|
5185
5095
|
var _DST_scalar = "HashToScalar-";
|
|
5186
5096
|
|
|
5187
|
-
//
|
|
5097
|
+
// ../../node_modules/.bun/@noble+curves@2.2.0/node_modules/@noble/curves/ed25519.js
|
|
5188
5098
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
5189
5099
|
var _0n11 = /* @__PURE__ */ BigInt(0);
|
|
5190
5100
|
var _1n12 = /* @__PURE__ */ BigInt(1);
|
|
@@ -5407,7 +5317,47 @@ var ristretto255_hasher = Object.freeze({
|
|
|
5407
5317
|
}
|
|
5408
5318
|
});
|
|
5409
5319
|
|
|
5410
|
-
//
|
|
5320
|
+
// ../../node_modules/.bun/@noble+hashes@2.2.0/node_modules/@noble/hashes/hkdf.js
|
|
5321
|
+
function extract(hash, ikm, salt) {
|
|
5322
|
+
ahash(hash);
|
|
5323
|
+
if (salt === undefined)
|
|
5324
|
+
salt = new Uint8Array(hash.outputLen);
|
|
5325
|
+
return hmac(hash, salt, ikm);
|
|
5326
|
+
}
|
|
5327
|
+
var HKDF_COUNTER = /* @__PURE__ */ Uint8Array.of(0);
|
|
5328
|
+
var EMPTY_BUFFER = /* @__PURE__ */ Uint8Array.of();
|
|
5329
|
+
function expand(hash, prk, info, length = 32) {
|
|
5330
|
+
ahash(hash);
|
|
5331
|
+
anumber3(length, "length");
|
|
5332
|
+
abytes3(prk, undefined, "prk");
|
|
5333
|
+
const olen = hash.outputLen;
|
|
5334
|
+
if (prk.length < olen)
|
|
5335
|
+
throw new Error('"prk" must be at least HashLen octets');
|
|
5336
|
+
if (length > 255 * olen)
|
|
5337
|
+
throw new Error("Length must be <= 255*HashLen");
|
|
5338
|
+
const blocks = Math.ceil(length / olen);
|
|
5339
|
+
if (info === undefined)
|
|
5340
|
+
info = EMPTY_BUFFER;
|
|
5341
|
+
else
|
|
5342
|
+
abytes3(info, undefined, "info");
|
|
5343
|
+
const okm = new Uint8Array(blocks * olen);
|
|
5344
|
+
const HMAC = hmac.create(hash, prk);
|
|
5345
|
+
const HMACTmp = HMAC._cloneInto();
|
|
5346
|
+
const T = new Uint8Array(HMAC.outputLen);
|
|
5347
|
+
for (let counter = 0;counter < blocks; counter++) {
|
|
5348
|
+
HKDF_COUNTER[0] = counter + 1;
|
|
5349
|
+
HMACTmp.update(counter === 0 ? EMPTY_BUFFER : T).update(info).update(HKDF_COUNTER).digestInto(T);
|
|
5350
|
+
okm.set(T, olen * counter);
|
|
5351
|
+
HMAC._cloneInto(HMACTmp);
|
|
5352
|
+
}
|
|
5353
|
+
HMAC.destroy();
|
|
5354
|
+
HMACTmp.destroy();
|
|
5355
|
+
clean2(T, HKDF_COUNTER);
|
|
5356
|
+
return okm.slice(0, length);
|
|
5357
|
+
}
|
|
5358
|
+
var hkdf = (hash, ikm, salt, info, length) => expand(hash, extract(hash, ikm, salt), info, length);
|
|
5359
|
+
|
|
5360
|
+
// ../../node_modules/.bun/@noble+post-quantum@0.6.1/node_modules/@noble/post-quantum/ml-kem.js
|
|
5411
5361
|
/*! noble-post-quantum - MIT License (c) 2024 Paul Miller (paulmillr.com) */
|
|
5412
5362
|
var N2 = 256;
|
|
5413
5363
|
var Q2 = 3329;
|
|
@@ -5688,7 +5638,7 @@ var mk = (params) => createKyber({
|
|
|
5688
5638
|
});
|
|
5689
5639
|
var ml_kem768 = /* @__PURE__ */ (() => mk(PARAMS2[768]))();
|
|
5690
5640
|
|
|
5691
|
-
//
|
|
5641
|
+
// ../../node_modules/.bun/@noble+post-quantum@0.6.1/node_modules/@noble/post-quantum/hybrid.js
|
|
5692
5642
|
/*! noble-post-quantum - MIT License (c) 2024 Paul Miller (paulmillr.com) */
|
|
5693
5643
|
function ecKeygen(curve, allowZeroKey = false) {
|
|
5694
5644
|
const lengths = curve.lengths;
|
|
@@ -5859,144 +5809,6 @@ function combineKEMS(realSeedLen, realMsgLen, expandSeed, combiner, ...kems) {
|
|
|
5859
5809
|
var x25519kem = /* @__PURE__ */ ecdhKem(x25519);
|
|
5860
5810
|
var ml_kem768_x25519 = /* @__PURE__ */ (() => combineKEMS(32, 32, expandSeedXof(shake256), (pk, ct, ss) => sha3_256(concatBytes4(ss[0], ss[1], ct[1], pk[1], asciiToBytes("\\.//^\\"))), ml_kem768, x25519kem))();
|
|
5861
5811
|
|
|
5862
|
-
// ../node_modules/.bun/@noble+hashes@2.3.0/node_modules/@noble/hashes/hmac.js
|
|
5863
|
-
class _HMAC {
|
|
5864
|
-
oHash;
|
|
5865
|
-
iHash;
|
|
5866
|
-
blockLen;
|
|
5867
|
-
outputLen;
|
|
5868
|
-
canXOF = false;
|
|
5869
|
-
finished = false;
|
|
5870
|
-
destroyed = false;
|
|
5871
|
-
constructor(hash, key) {
|
|
5872
|
-
ahash(hash);
|
|
5873
|
-
abytes(key, undefined, "key");
|
|
5874
|
-
this.iHash = hash.create();
|
|
5875
|
-
if (typeof this.iHash.update !== "function")
|
|
5876
|
-
throw new Error("expected Hash instance");
|
|
5877
|
-
this.blockLen = this.iHash.blockLen;
|
|
5878
|
-
this.outputLen = this.iHash.outputLen;
|
|
5879
|
-
const blockLen = this.blockLen;
|
|
5880
|
-
const pad = new Uint8Array(blockLen);
|
|
5881
|
-
pad.set(key.length > blockLen ? hash.create().update(key).digest() : key);
|
|
5882
|
-
for (let i = 0;i < pad.length; i++)
|
|
5883
|
-
pad[i] ^= 54;
|
|
5884
|
-
this.iHash.update(pad);
|
|
5885
|
-
this.oHash = hash.create();
|
|
5886
|
-
for (let i = 0;i < pad.length; i++)
|
|
5887
|
-
pad[i] ^= 54 ^ 92;
|
|
5888
|
-
this.oHash.update(pad);
|
|
5889
|
-
clean(pad);
|
|
5890
|
-
}
|
|
5891
|
-
update(buf) {
|
|
5892
|
-
aexists(this);
|
|
5893
|
-
this.iHash.update(buf);
|
|
5894
|
-
return this;
|
|
5895
|
-
}
|
|
5896
|
-
digestInto(out) {
|
|
5897
|
-
aexists(this);
|
|
5898
|
-
aoutput(out, this);
|
|
5899
|
-
this.finished = true;
|
|
5900
|
-
const buf = out.subarray(0, this.outputLen);
|
|
5901
|
-
this.iHash.digestInto(buf);
|
|
5902
|
-
this.oHash.update(buf);
|
|
5903
|
-
this.oHash.digestInto(buf);
|
|
5904
|
-
this.destroy();
|
|
5905
|
-
}
|
|
5906
|
-
digest() {
|
|
5907
|
-
const out = new Uint8Array(this.oHash.outputLen);
|
|
5908
|
-
this.digestInto(out);
|
|
5909
|
-
return out;
|
|
5910
|
-
}
|
|
5911
|
-
_cloneInto(to) {
|
|
5912
|
-
to ||= Object.create(Object.getPrototypeOf(this), {});
|
|
5913
|
-
const { oHash, iHash, finished, destroyed, blockLen, outputLen, canXOF } = this;
|
|
5914
|
-
to = to;
|
|
5915
|
-
to.finished = finished;
|
|
5916
|
-
to.destroyed = destroyed;
|
|
5917
|
-
to.blockLen = blockLen;
|
|
5918
|
-
to.outputLen = outputLen;
|
|
5919
|
-
to.canXOF = canXOF;
|
|
5920
|
-
to.oHash = oHash._cloneInto(to.oHash);
|
|
5921
|
-
to.iHash = iHash._cloneInto(to.iHash);
|
|
5922
|
-
return to;
|
|
5923
|
-
}
|
|
5924
|
-
clone() {
|
|
5925
|
-
return this._cloneInto();
|
|
5926
|
-
}
|
|
5927
|
-
destroy() {
|
|
5928
|
-
this.destroyed = true;
|
|
5929
|
-
this.oHash.destroy();
|
|
5930
|
-
this.iHash.destroy();
|
|
5931
|
-
}
|
|
5932
|
-
}
|
|
5933
|
-
var hmac = /* @__PURE__ */ (() => {
|
|
5934
|
-
const hmac_ = (hash, key, message) => new _HMAC(hash, key).update(message).digest();
|
|
5935
|
-
hmac_.create = (hash, key) => new _HMAC(hash, key);
|
|
5936
|
-
return hmac_;
|
|
5937
|
-
})();
|
|
5938
|
-
|
|
5939
|
-
// ../node_modules/.bun/@noble+hashes@2.3.0/node_modules/@noble/hashes/hkdf.js
|
|
5940
|
-
var HKDF_COUNTER = /* @__PURE__ */ Uint8Array.of(0);
|
|
5941
|
-
var EMPTY_BUFFER = /* @__PURE__ */ Uint8Array.of();
|
|
5942
|
-
function expand(hash, prk, info, length = 32, _recycled) {
|
|
5943
|
-
ahash(hash);
|
|
5944
|
-
anumber(length, "length");
|
|
5945
|
-
abytes(prk, undefined, "prk");
|
|
5946
|
-
const olen = hash.outputLen;
|
|
5947
|
-
if (prk.length < olen)
|
|
5948
|
-
throw new Error('"prk" must be at least HashLen octets');
|
|
5949
|
-
if (length > 255 * olen)
|
|
5950
|
-
throw new Error("Length must be <= 255*HashLen");
|
|
5951
|
-
const blocks = Math.ceil(length / olen);
|
|
5952
|
-
if (info === undefined)
|
|
5953
|
-
info = EMPTY_BUFFER;
|
|
5954
|
-
else
|
|
5955
|
-
abytes(info, undefined, "info");
|
|
5956
|
-
if (!blocks) {
|
|
5957
|
-
if (_recycled)
|
|
5958
|
-
clean(prk);
|
|
5959
|
-
return new Uint8Array;
|
|
5960
|
-
}
|
|
5961
|
-
const okm = _recycled && blocks === 1 ? prk : new Uint8Array(blocks * olen);
|
|
5962
|
-
const { iHash, oHash } = hmac.create(hash, prk);
|
|
5963
|
-
const T = _recycled ? prk : new Uint8Array(olen);
|
|
5964
|
-
const worker = blocks > 1 ? _recycled?.iHash || hash.create() : undefined;
|
|
5965
|
-
for (let counter = 0;counter < blocks - 1; counter++) {
|
|
5966
|
-
HKDF_COUNTER[0] = counter + 1;
|
|
5967
|
-
const iWork = iHash._cloneInto(worker);
|
|
5968
|
-
if (counter)
|
|
5969
|
-
iWork.update(T);
|
|
5970
|
-
iWork.update(info).update(HKDF_COUNTER).digestInto(T);
|
|
5971
|
-
oHash._cloneInto(worker).update(T).digestInto(T);
|
|
5972
|
-
okm.set(T, olen * counter);
|
|
5973
|
-
}
|
|
5974
|
-
HKDF_COUNTER[0] = blocks;
|
|
5975
|
-
if (blocks > 1)
|
|
5976
|
-
iHash.update(T);
|
|
5977
|
-
iHash.update(info).update(HKDF_COUNTER).digestInto(T);
|
|
5978
|
-
oHash.update(T).digestInto(T);
|
|
5979
|
-
okm.set(T, olen * (blocks - 1));
|
|
5980
|
-
iHash.destroy();
|
|
5981
|
-
oHash.destroy();
|
|
5982
|
-
worker?.destroy();
|
|
5983
|
-
if (T !== okm)
|
|
5984
|
-
clean(T);
|
|
5985
|
-
clean(HKDF_COUNTER);
|
|
5986
|
-
if (length === okm.length)
|
|
5987
|
-
return okm;
|
|
5988
|
-
const res = okm.slice(0, length);
|
|
5989
|
-
clean(okm);
|
|
5990
|
-
return res;
|
|
5991
|
-
}
|
|
5992
|
-
var hkdf = (hash, ikm, salt, info, length) => {
|
|
5993
|
-
ahash(hash);
|
|
5994
|
-
if (salt === undefined)
|
|
5995
|
-
salt = new Uint8Array(hash.outputLen);
|
|
5996
|
-
const HMAC = hmac.create(hash, salt).update(ikm);
|
|
5997
|
-
return expand(hash, HMAC.digest(), info, length, HMAC);
|
|
5998
|
-
};
|
|
5999
|
-
|
|
6000
5812
|
// ../runtime/dist/identity.js
|
|
6001
5813
|
var ENCODER = new TextEncoder;
|
|
6002
5814
|
var b64 = toBase64Url;
|
|
@@ -8265,13 +8077,15 @@ async function runPipeline(options) {
|
|
|
8265
8077
|
const outcome = exitCode === 0 ? "ok" : "failed";
|
|
8266
8078
|
if (outcome === "failed")
|
|
8267
8079
|
failed = true;
|
|
8268
|
-
|
|
8080
|
+
const recorded = {
|
|
8269
8081
|
name: step.name,
|
|
8270
8082
|
outcome,
|
|
8271
8083
|
exitCode,
|
|
8272
8084
|
log: redact(output, values),
|
|
8273
8085
|
durationMs: now() - started
|
|
8274
|
-
}
|
|
8086
|
+
};
|
|
8087
|
+
steps.push(recorded);
|
|
8088
|
+
await options.onStep?.(recorded);
|
|
8275
8089
|
}
|
|
8276
8090
|
return { pipeline: pipeline.name, ok: !failed, assurance, steps };
|
|
8277
8091
|
}
|
|
@@ -9880,6 +9694,7 @@ async function runDeploymentPlan(options) {
|
|
|
9880
9694
|
const record2 = { id: step2.id, stage: stage2.id, action: step2.uses, status: "skipped", attempts: 0, outputs: {}, changed: false };
|
|
9881
9695
|
state.steps.set(step2.id, record2);
|
|
9882
9696
|
records.push(record2);
|
|
9697
|
+
await options.onStep?.(record2);
|
|
9883
9698
|
}
|
|
9884
9699
|
continue;
|
|
9885
9700
|
}
|
|
@@ -9896,6 +9711,7 @@ async function runDeploymentPlan(options) {
|
|
|
9896
9711
|
})();
|
|
9897
9712
|
records.push(...stageRecords);
|
|
9898
9713
|
for (const record2 of stageRecords) {
|
|
9714
|
+
await options.onStep?.(record2);
|
|
9899
9715
|
const step2 = stage2.steps.find((candidate) => candidate.id === record2.id);
|
|
9900
9716
|
if (record2.status === "succeeded")
|
|
9901
9717
|
successful2.push({ record: record2, step: step2, stage: stage2 });
|
|
@@ -10610,6 +10426,7 @@ function createDeploymentManager(options) {
|
|
|
10610
10426
|
return { changed: true, outputs: { activeSlot: state.activeSlot, publicPort: state.publicPort } };
|
|
10611
10427
|
}
|
|
10612
10428
|
};
|
|
10429
|
+
const livePlanSteps = [];
|
|
10613
10430
|
const run2 = await runDeploymentPlan({
|
|
10614
10431
|
plan,
|
|
10615
10432
|
workflow: "deploy",
|
|
@@ -10638,7 +10455,18 @@ function createDeploymentManager(options) {
|
|
|
10638
10455
|
memoryMiB: resolvedTargets[0].allocation.resources.memoryMiB,
|
|
10639
10456
|
storageGiB: resolvedTargets[0].allocation.resources.storageGiB
|
|
10640
10457
|
},
|
|
10641
|
-
shouldRun: (step2) => step2.scope.kind === "release-executor" || step2.scope.kind === "elected-one" ? request.releaseExecutor === true : step2.scope.kind === "topology-role" ? targetNames.has(step2.scope.target) && assigned?.topology?.role === step2.scope.role : targetNames.has(step2.scope.target)
|
|
10458
|
+
shouldRun: (step2) => step2.scope.kind === "release-executor" || step2.scope.kind === "elected-one" ? request.releaseExecutor === true : step2.scope.kind === "topology-role" ? targetNames.has(step2.scope.target) && assigned?.topology?.role === step2.scope.role : targetNames.has(step2.scope.target),
|
|
10459
|
+
onStep: async (step2) => {
|
|
10460
|
+
livePlanSteps.push({
|
|
10461
|
+
phase: `${plan.name}:deploy:${step2.stage}`.slice(0, 128),
|
|
10462
|
+
step: step2.id.slice(0, 128),
|
|
10463
|
+
outcome: step2.status === "succeeded" || step2.status === "compensated" ? "ok" : step2.status === "skipped" ? "skipped" : "failed",
|
|
10464
|
+
exitCode: step2.status === "succeeded" || step2.status === "compensated" ? 0 : step2.status === "skipped" ? null : 1,
|
|
10465
|
+
durationMs: Math.max(0, (step2.finishedAtTs ?? step2.startedAtTs ?? 0) - (step2.startedAtTs ?? 0)),
|
|
10466
|
+
...step2.error?.message ? { detail: step2.error.message.slice(0, 2000) } : {}
|
|
10467
|
+
});
|
|
10468
|
+
await request.onProgress?.({ steps: [...livePlanSteps] });
|
|
10469
|
+
}
|
|
10642
10470
|
});
|
|
10643
10471
|
const phase = {
|
|
10644
10472
|
pipeline: `${plan.name}:deploy`,
|
|
@@ -10755,6 +10583,7 @@ function createDeploymentManager(options) {
|
|
|
10755
10583
|
})
|
|
10756
10584
|
].filter((pipeline) => pipeline.steps.length > 0);
|
|
10757
10585
|
const phases = [];
|
|
10586
|
+
const liveExecutionSteps = [];
|
|
10758
10587
|
let serviceActivated = false;
|
|
10759
10588
|
const activateSelectedService = async () => {
|
|
10760
10589
|
if (!selectedProfile.service || serviceActivated)
|
|
@@ -10774,7 +10603,23 @@ function createDeploymentManager(options) {
|
|
|
10774
10603
|
for (const pipeline of pipelines) {
|
|
10775
10604
|
if (pipeline.phase === "health")
|
|
10776
10605
|
await activateSelectedService();
|
|
10777
|
-
const result = await runPipeline({
|
|
10606
|
+
const result = await runPipeline({
|
|
10607
|
+
pipeline,
|
|
10608
|
+
secret,
|
|
10609
|
+
exec: phaseExec,
|
|
10610
|
+
attest,
|
|
10611
|
+
onStep: async (step2) => {
|
|
10612
|
+
liveExecutionSteps.push({
|
|
10613
|
+
phase: pipeline.name.slice(0, 128),
|
|
10614
|
+
step: step2.name.slice(0, 128),
|
|
10615
|
+
outcome: step2.outcome,
|
|
10616
|
+
exitCode: step2.exitCode,
|
|
10617
|
+
durationMs: Math.max(0, Math.min(step2.durationMs, 86400000)),
|
|
10618
|
+
...step2.outcome === "failed" && step2.log.trim() ? { detail: step2.log.trim().slice(0, 2000) } : {}
|
|
10619
|
+
});
|
|
10620
|
+
await request.onProgress?.({ steps: [...liveExecutionSteps] });
|
|
10621
|
+
}
|
|
10622
|
+
});
|
|
10778
10623
|
phases.push(result);
|
|
10779
10624
|
if (!result.ok) {
|
|
10780
10625
|
const failedStep = result.steps.find((step2) => step2.outcome === "failed");
|
|
@@ -11081,7 +10926,15 @@ async function deployClaim(options, claim) {
|
|
|
11081
10926
|
releaseExecutor: claim.releaseExecutor,
|
|
11082
10927
|
...claim.assignment ? { assignment: claim.assignment } : {},
|
|
11083
10928
|
...claim.connectivityCapabilities ? { connectivityCapabilities: claim.connectivityCapabilities } : {},
|
|
11084
|
-
...claim.credentialBindings ? { credentialBindings: claim.credentialBindings } : {}
|
|
10929
|
+
...claim.credentialBindings ? { credentialBindings: claim.credentialBindings } : {},
|
|
10930
|
+
onProgress: async (execution) => {
|
|
10931
|
+
await postSigned(options, "progress", {
|
|
10932
|
+
runKey: claim.runKey,
|
|
10933
|
+
claimToken: claim.claimToken,
|
|
10934
|
+
execution
|
|
10935
|
+
});
|
|
10936
|
+
options.onEvent?.("deployment-progress", { runKey: claim.runKey, execution });
|
|
10937
|
+
}
|
|
11085
10938
|
}).result;
|
|
11086
10939
|
result = options.telemetry ? await options.telemetry.observe("deployment.run", run2) : await run2();
|
|
11087
10940
|
} finally {
|
|
@@ -11632,7 +11485,7 @@ async function writeAndCloseProcessInput(input, value) {
|
|
|
11632
11485
|
}
|
|
11633
11486
|
|
|
11634
11487
|
// src/version.ts
|
|
11635
|
-
var VERSION2 = "0.1.
|
|
11488
|
+
var VERSION2 = "0.1.154";
|
|
11636
11489
|
|
|
11637
11490
|
// src/ssh-bootstrap.ts
|
|
11638
11491
|
function deriveMetalAdmissionProvisioning(lscpu) {
|
|
@@ -12158,6 +12011,8 @@ var validateMetalClaim = (claim) => {
|
|
|
12158
12011
|
});
|
|
12159
12012
|
};
|
|
12160
12013
|
async function executeMetalAdmission(claim, options) {
|
|
12014
|
+
const progress = async (stage2) => options.onMetalAdmissionProgress?.(stage2);
|
|
12015
|
+
await progress("validating-target");
|
|
12161
12016
|
validateMetalClaim(claim);
|
|
12162
12017
|
const api = new URL(options.platformApiUrl);
|
|
12163
12018
|
if (api.protocol !== "https:" || api.username || api.password || api.search || api.hash) {
|
|
@@ -12187,19 +12042,23 @@ process.stdout.write(process.env.FZ_SSH_PASSWORD ?? "")
|
|
|
12187
12042
|
env: { ...command.env, DISPLAY: "forgezero:0", SSH_ASKPASS: askpass, SSH_ASKPASS_REQUIRE: "force", FZ_SSH_PASSWORD: password }
|
|
12188
12043
|
});
|
|
12189
12044
|
}
|
|
12045
|
+
await progress("resolving-host");
|
|
12190
12046
|
const sourceHost = claim.target.host.includes(":") ? `[${claim.target.host}]` : claim.target.host;
|
|
12191
12047
|
const resolved = await resolvePinnedGitTarget(`ssh://${claim.target.user}@${sourceHost}:${claim.target.port}/`, options.resolveHost);
|
|
12192
12048
|
if (!resolved || resolved.protocol !== "ssh")
|
|
12193
12049
|
throw new SshBootstrapError("TARGET_ADDRESS_REFUSED");
|
|
12194
12050
|
pinned = resolved;
|
|
12051
|
+
await progress("verifying-host-key");
|
|
12195
12052
|
const observedHost = await pinnedKnownHost(claim, pinned, directory, exec);
|
|
12196
12053
|
claim.target.hostKeySha256 = observedHost.fingerprint;
|
|
12197
12054
|
const knownHosts = observedHost.path;
|
|
12198
12055
|
const ssh = sshOptions(claim, pinned, knownHosts, sshKeyPath);
|
|
12199
12056
|
const destination = target(claim, pinned);
|
|
12057
|
+
await progress("opening-ssh");
|
|
12200
12058
|
remoteDirectory = await checked(exec, ["ssh", ...ssh, destination, "--", "mktemp", "-d", "/tmp/forgezero-metal-admission.XXXXXXXX"], "SSH_UNREACHABLE");
|
|
12201
12059
|
if (!/^\/tmp\/forgezero-metal-admission\.[A-Za-z0-9]{8}$/.test(remoteDirectory))
|
|
12202
12060
|
throw new SshBootstrapError("REMOTE_PATH_INVALID");
|
|
12061
|
+
await progress("installing-managed-key");
|
|
12203
12062
|
const passwd = await remote(exec, ssh, destination, "SSH_IDENTITY_INSTALL_FAILED", ["/usr/bin/getent", "passwd", claim.target.user]);
|
|
12204
12063
|
const home = passwd.split(":")[5] ?? "";
|
|
12205
12064
|
if (!home.startsWith("/") || /[\r\n]/.test(home))
|
|
@@ -12214,6 +12073,7 @@ process.stdout.write(process.env.FZ_SSH_PASSWORD ?? "")
|
|
|
12214
12073
|
writeFileSync5(authorizedPath, authorized, { mode: 384, flag: "wx" });
|
|
12215
12074
|
await checked(exec, ["scp", ...scpOptions(claim, pinned, knownHosts, sshKeyPath), authorizedPath, `${destination}:${remoteDirectory}/authorized_keys`], "SSH_IDENTITY_INSTALL_FAILED");
|
|
12216
12075
|
await remote(exec, ssh, destination, "SSH_IDENTITY_INSTALL_FAILED", ["/usr/bin/install", "-m", "0600", `${remoteDirectory}/authorized_keys`, `${home}/.ssh/authorized_keys`]);
|
|
12076
|
+
await progress("checking-host-policy");
|
|
12217
12077
|
await remote(exec, ssh, destination, "METAL_STORAGE_UNAVAILABLE", ["/usr/bin/sudo", "-n", "/usr/sbin/vgs", "fzvg"]);
|
|
12218
12078
|
await remote(exec, ssh, destination, "METAL_NETWORK_UNAVAILABLE", ["/usr/bin/sudo", "-n", "/usr/sbin/ip", "link", "show", "fzbr0"]);
|
|
12219
12079
|
const topology = await remote(exec, ssh, destination, "METAL_CPU_TOPOLOGY_INVALID", [
|
|
@@ -12223,6 +12083,7 @@ process.stdout.write(process.env.FZ_SSH_PASSWORD ?? "")
|
|
|
12223
12083
|
const provisioning = deriveMetalAdmissionProvisioning(topology);
|
|
12224
12084
|
const fzCliPath = options.fzCliPath ?? fileURLToPath(new URL("./fz.js", import.meta.url));
|
|
12225
12085
|
const fzAgentPath = options.fzAgentPath ?? fileURLToPath(new URL("./fz-agent.js", import.meta.url));
|
|
12086
|
+
await progress("copying-agent");
|
|
12226
12087
|
for (const [source, name] of [[fzCliPath, "fz.js"], [fzAgentPath, "fz-agent.js"]]) {
|
|
12227
12088
|
if (!readFileSync5(source).length)
|
|
12228
12089
|
throw new SshBootstrapError("PACKAGE_ARTIFACT_MISSING");
|
|
@@ -12263,6 +12124,7 @@ process.stdout.write(process.env.FZ_SSH_PASSWORD ?? "")
|
|
|
12263
12124
|
configPath,
|
|
12264
12125
|
`${destination}:${remoteDirectory}/metal.json`
|
|
12265
12126
|
], "SCP_FAILED");
|
|
12127
|
+
await progress("installing-runtime");
|
|
12266
12128
|
const bunVersion = await remote(exec, ssh, destination, "REMOTE_BUN_CHECK_FAILED", ["/usr/local/bin/bun", "--version"]).catch(() => "");
|
|
12267
12129
|
if (bunVersion !== PINNED_BUN_VERSION) {
|
|
12268
12130
|
await remote(exec, ssh, destination, "REMOTE_PREREQUISITES_FAILED", ["/usr/bin/sudo", "-n", "/usr/bin/apt-get", "update", "-qq"]);
|
|
@@ -12285,6 +12147,7 @@ process.stdout.write(process.env.FZ_SSH_PASSWORD ?? "")
|
|
|
12285
12147
|
await remote(exec, ssh, destination, "REMOTE_BUN_INSTALL_FAILED", ["/usr/bin/sudo", "-n", "/usr/bin/install", "-m", "0755", `${remoteDirectory}/bun-release/bun-linux-x64/bun`, "/usr/local/lib/forgezero/runtime/bun"]);
|
|
12286
12148
|
await remote(exec, ssh, destination, "REMOTE_BUN_INSTALL_FAILED", ["/usr/bin/sudo", "-n", "/usr/bin/ln", "-sfn", "/usr/local/lib/forgezero/runtime/bun", "/usr/local/bin/bun"]);
|
|
12287
12149
|
}
|
|
12150
|
+
await progress("bootstrapping-agent");
|
|
12288
12151
|
await remote(exec, ssh, destination, "REMOTE_METAL_BOOTSTRAP_FAILED", [
|
|
12289
12152
|
"/usr/bin/sudo",
|
|
12290
12153
|
"-n",
|
|
@@ -12296,6 +12159,7 @@ process.stdout.write(process.env.FZ_SSH_PASSWORD ?? "")
|
|
|
12296
12159
|
`${remoteDirectory}/metal.json`,
|
|
12297
12160
|
"--apply"
|
|
12298
12161
|
], true);
|
|
12162
|
+
await progress("verifying-proof");
|
|
12299
12163
|
const proofRequest = {
|
|
12300
12164
|
jobKey: claim.jobKey,
|
|
12301
12165
|
tenantKey: claim.tenantKey,
|
|
@@ -12390,7 +12254,14 @@ async function pullMetalAdmissionOnce(options) {
|
|
|
12390
12254
|
};
|
|
12391
12255
|
renew();
|
|
12392
12256
|
try {
|
|
12393
|
-
const proof = await executeMetalAdmission(claim,
|
|
12257
|
+
const proof = await executeMetalAdmission(claim, {
|
|
12258
|
+
...options,
|
|
12259
|
+
onMetalAdmissionProgress: (stage2) => metalPost(options, "progress", {
|
|
12260
|
+
jobKey: claim.jobKey,
|
|
12261
|
+
claimToken: claim.claimToken,
|
|
12262
|
+
stage: stage2
|
|
12263
|
+
})
|
|
12264
|
+
});
|
|
12394
12265
|
stopped = true;
|
|
12395
12266
|
clearTimer(timer);
|
|
12396
12267
|
await renewal;
|
|
@@ -14421,7 +14292,7 @@ function startAgentCandidateReady(ready, socketPath = DEFAULT_AGENT_CANDIDATE_RE
|
|
|
14421
14292
|
server.listen(socketPath, () => chmodSync14(socketPath, 432));
|
|
14422
14293
|
return server;
|
|
14423
14294
|
}
|
|
14424
|
-
function probeAgentCandidate(expected, socketPath = DEFAULT_AGENT_CANDIDATE_READY_SOCKET, timeoutMs =
|
|
14295
|
+
function probeAgentCandidate(expected, socketPath = DEFAULT_AGENT_CANDIDATE_READY_SOCKET, timeoutMs = 30000) {
|
|
14425
14296
|
return new Promise((resolve3) => {
|
|
14426
14297
|
let settled = false;
|
|
14427
14298
|
let socket;
|