@nexart/ai-execution 0.4.2 → 0.6.0
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/README.md +79 -2
- package/dist/index.cjs +1433 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +140 -3
- package/dist/index.d.ts +140 -3
- package/dist/index.mjs +1425 -10
- package/dist/index.mjs.map +1 -1
- package/dist/providers/anthropic.cjs +1 -1
- package/dist/providers/anthropic.cjs.map +1 -1
- package/dist/providers/anthropic.d.cts +1 -1
- package/dist/providers/anthropic.d.ts +1 -1
- package/dist/providers/anthropic.mjs +1 -1
- package/dist/providers/anthropic.mjs.map +1 -1
- package/dist/providers/openai.cjs +1 -1
- package/dist/providers/openai.cjs.map +1 -1
- package/dist/providers/openai.d.cts +1 -1
- package/dist/providers/openai.d.ts +1 -1
- package/dist/providers/openai.mjs +1 -1
- package/dist/providers/openai.mjs.map +1 -1
- package/dist/providers/wrap.cjs +1 -1
- package/dist/providers/wrap.cjs.map +1 -1
- package/dist/providers/wrap.d.cts +1 -1
- package/dist/providers/wrap.d.ts +1 -1
- package/dist/providers/wrap.mjs +1 -1
- package/dist/providers/wrap.mjs.map +1 -1
- package/dist/{types-Cnm2G_rg.d.cts → types-Cgb52dTx.d.cts} +90 -1
- package/dist/{types-Cnm2G_rg.d.ts → types-Cgb52dTx.d.ts} +90 -1
- package/fixtures/attestation/keys-v1.json +18 -0
- package/fixtures/attestation/receipt-v1.json +10 -0
- package/fixtures/attestation/receipt-v1.pub +1 -0
- package/fixtures/attestation/receipt-v1.sig +1 -0
- package/fixtures/v060/legacy-attestation.json +32 -0
- package/fixtures/v060/original-meta-bundle.json +36 -0
- package/fixtures/v060/pre-v05-bundle.json +29 -0
- package/fixtures/v060/redacted-bundle.json +36 -0
- package/package.json +6 -4
package/dist/index.cjs
CHANGED
|
@@ -38,21 +38,29 @@ __export(src_exports, {
|
|
|
38
38
|
attestIfNeeded: () => attestIfNeeded,
|
|
39
39
|
certifyAndAttestDecision: () => certifyAndAttestDecision,
|
|
40
40
|
certifyDecision: () => certifyDecision,
|
|
41
|
+
certifyDecisionFromProviderCall: () => certifyDecisionFromProviderCall,
|
|
41
42
|
computeInputHash: () => computeInputHash,
|
|
42
43
|
computeOutputHash: () => computeOutputHash,
|
|
44
|
+
createClient: () => createClient,
|
|
43
45
|
createSnapshot: () => createSnapshot,
|
|
44
46
|
exportCer: () => exportCer,
|
|
47
|
+
fetchNodeKeys: () => fetchNodeKeys,
|
|
45
48
|
getAttestationReceipt: () => getAttestationReceipt,
|
|
46
49
|
hasAttestation: () => hasAttestation,
|
|
47
50
|
hashCanonicalJson: () => hashCanonicalJson,
|
|
48
51
|
hashUtf8: () => hashUtf8,
|
|
49
52
|
importCer: () => importCer,
|
|
50
53
|
sanitizeForAttestation: () => sanitizeForAttestation,
|
|
54
|
+
sanitizeForStamp: () => sanitizeForStamp,
|
|
55
|
+
sanitizeForStorage: () => sanitizeForStorage,
|
|
51
56
|
sealCer: () => sealCer,
|
|
57
|
+
selectNodeKey: () => selectNodeKey,
|
|
52
58
|
sha256Hex: () => sha256Hex,
|
|
53
59
|
toCanonicalJson: () => toCanonicalJson,
|
|
54
60
|
verify: () => verifyCer,
|
|
61
|
+
verifyBundleAttestation: () => verifyBundleAttestation,
|
|
55
62
|
verifyCer: () => verifyCer,
|
|
63
|
+
verifyNodeReceiptSignature: () => verifyNodeReceiptSignature,
|
|
56
64
|
verifySnapshot: () => verifySnapshot,
|
|
57
65
|
wrapProvider: () => wrapProvider
|
|
58
66
|
});
|
|
@@ -68,7 +76,11 @@ var CerVerifyCode = {
|
|
|
68
76
|
INVALID_SHA256_FORMAT: "INVALID_SHA256_FORMAT",
|
|
69
77
|
CANONICALIZATION_ERROR: "CANONICALIZATION_ERROR",
|
|
70
78
|
SCHEMA_ERROR: "SCHEMA_ERROR",
|
|
71
|
-
UNKNOWN_ERROR: "UNKNOWN_ERROR"
|
|
79
|
+
UNKNOWN_ERROR: "UNKNOWN_ERROR",
|
|
80
|
+
ATTESTATION_MISSING: "ATTESTATION_MISSING",
|
|
81
|
+
ATTESTATION_KEY_NOT_FOUND: "ATTESTATION_KEY_NOT_FOUND",
|
|
82
|
+
ATTESTATION_INVALID_SIGNATURE: "ATTESTATION_INVALID_SIGNATURE",
|
|
83
|
+
ATTESTATION_KEY_FORMAT_UNSUPPORTED: "ATTESTATION_KEY_FORMAT_UNSUPPORTED"
|
|
72
84
|
};
|
|
73
85
|
|
|
74
86
|
// src/errors.ts
|
|
@@ -164,7 +176,7 @@ function computeOutputHash(output) {
|
|
|
164
176
|
}
|
|
165
177
|
|
|
166
178
|
// src/snapshot.ts
|
|
167
|
-
var PACKAGE_VERSION = "0.
|
|
179
|
+
var PACKAGE_VERSION = "0.6.0";
|
|
168
180
|
function validateParameters(params) {
|
|
169
181
|
const errors = [];
|
|
170
182
|
if (typeof params.temperature !== "number" || !Number.isFinite(params.temperature)) {
|
|
@@ -350,8 +362,8 @@ function verifyCer(bundle) {
|
|
|
350
362
|
let snapshotResult = null;
|
|
351
363
|
try {
|
|
352
364
|
snapshotResult = verifySnapshot(bundle.snapshot);
|
|
353
|
-
} catch (
|
|
354
|
-
canonicalizationError =
|
|
365
|
+
} catch (err2) {
|
|
366
|
+
canonicalizationError = err2 instanceof Error ? err2.message : String(err2);
|
|
355
367
|
}
|
|
356
368
|
if (canonicalizationError !== null) {
|
|
357
369
|
const errors2 = [...schemaErrors, ...formatErrors, canonicalizationError];
|
|
@@ -370,8 +382,8 @@ function verifyCer(bundle) {
|
|
|
370
382
|
if (bundle.certificateHash !== expectedHash) {
|
|
371
383
|
certHashErrors.push(`certificateHash mismatch: expected ${expectedHash}, got ${bundle.certificateHash}`);
|
|
372
384
|
}
|
|
373
|
-
} catch (
|
|
374
|
-
const msg =
|
|
385
|
+
} catch (err2) {
|
|
386
|
+
const msg = err2 instanceof Error ? err2.message : String(err2);
|
|
375
387
|
const errors2 = [...schemaErrors, ...formatErrors, ...snapshotErrors, msg];
|
|
376
388
|
return { ok: false, errors: errors2, code: CerVerifyCode.CANONICALIZATION_ERROR, details: [msg] };
|
|
377
389
|
}
|
|
@@ -515,9 +527,45 @@ function deepRemoveUndefined(value) {
|
|
|
515
527
|
}
|
|
516
528
|
return value;
|
|
517
529
|
}
|
|
530
|
+
function redactPath(obj, path, replacement) {
|
|
531
|
+
const parts = path.split(".");
|
|
532
|
+
const clone = { ...obj };
|
|
533
|
+
let cursor = clone;
|
|
534
|
+
for (let i = 0; i < parts.length - 1; i++) {
|
|
535
|
+
const key = parts[i];
|
|
536
|
+
if (typeof cursor[key] !== "object" || cursor[key] === null) return clone;
|
|
537
|
+
cursor[key] = { ...cursor[key] };
|
|
538
|
+
cursor = cursor[key];
|
|
539
|
+
}
|
|
540
|
+
const last = parts[parts.length - 1];
|
|
541
|
+
if (last in cursor) cursor[last] = replacement;
|
|
542
|
+
return clone;
|
|
543
|
+
}
|
|
518
544
|
function sanitizeForAttestation(bundle) {
|
|
519
545
|
return deepRemoveUndefined(bundle);
|
|
520
546
|
}
|
|
547
|
+
function sanitizeForStorage(bundle, options) {
|
|
548
|
+
let cleaned = deepRemoveUndefined(bundle);
|
|
549
|
+
if (options?.redactPaths && options.redactPaths.length > 0) {
|
|
550
|
+
const replacement = options.redactWith ?? "[REDACTED]";
|
|
551
|
+
let obj = cleaned;
|
|
552
|
+
for (const path of options.redactPaths) {
|
|
553
|
+
obj = redactPath(obj, path, replacement);
|
|
554
|
+
}
|
|
555
|
+
cleaned = obj;
|
|
556
|
+
}
|
|
557
|
+
return cleaned;
|
|
558
|
+
}
|
|
559
|
+
function sanitizeForStamp(bundle) {
|
|
560
|
+
const core = {
|
|
561
|
+
bundleType: bundle.bundleType,
|
|
562
|
+
certificateHash: bundle.certificateHash,
|
|
563
|
+
createdAt: bundle.createdAt,
|
|
564
|
+
version: bundle.version,
|
|
565
|
+
snapshot: bundle.snapshot
|
|
566
|
+
};
|
|
567
|
+
return deepRemoveUndefined(core);
|
|
568
|
+
}
|
|
521
569
|
function hasAttestation(bundle) {
|
|
522
570
|
if (typeof bundle !== "object" || bundle === null) return false;
|
|
523
571
|
const b = bundle;
|
|
@@ -558,9 +606,9 @@ async function attest(bundle, options) {
|
|
|
558
606
|
body: JSON.stringify(sanitized),
|
|
559
607
|
signal: controller.signal
|
|
560
608
|
});
|
|
561
|
-
} catch (
|
|
609
|
+
} catch (err2) {
|
|
562
610
|
clearTimeout(timer);
|
|
563
|
-
const error =
|
|
611
|
+
const error = err2;
|
|
564
612
|
if (error.name === "AbortError") {
|
|
565
613
|
throw new CerAttestationError(
|
|
566
614
|
`Attestation request timed out after ${timeoutMs}ms`
|
|
@@ -630,8 +678,8 @@ function importCer(json) {
|
|
|
630
678
|
let parsed;
|
|
631
679
|
try {
|
|
632
680
|
parsed = JSON.parse(json);
|
|
633
|
-
} catch (
|
|
634
|
-
throw new CerVerificationError([`Invalid JSON: ${
|
|
681
|
+
} catch (err2) {
|
|
682
|
+
throw new CerVerificationError([`Invalid JSON: ${err2.message}`]);
|
|
635
683
|
}
|
|
636
684
|
const bundle = parsed;
|
|
637
685
|
if (!bundle || typeof bundle !== "object") {
|
|
@@ -695,6 +743,10 @@ function buildReceipt(obj) {
|
|
|
695
743
|
if (nodeId) receipt.nodeId = nodeId;
|
|
696
744
|
const attestedAt = extractStr(obj, "attestedAt");
|
|
697
745
|
if (attestedAt) receipt.attestedAt = attestedAt;
|
|
746
|
+
const attestorKeyId = extractStr(obj, "attestorKeyId");
|
|
747
|
+
if (attestorKeyId) receipt.attestorKeyId = attestorKeyId;
|
|
748
|
+
const signatureB64Url = extractStr(obj, "signature") ?? extractStr(obj, "signatureB64Url");
|
|
749
|
+
if (signatureB64Url) receipt.signatureB64Url = signatureB64Url;
|
|
698
750
|
return receipt;
|
|
699
751
|
}
|
|
700
752
|
function getAttestationReceipt(bundle) {
|
|
@@ -743,6 +795,1361 @@ async function attestIfNeeded(bundle, options) {
|
|
|
743
795
|
const receipt = receiptFromProof(proof, bundle);
|
|
744
796
|
return { bundle, receipt };
|
|
745
797
|
}
|
|
798
|
+
|
|
799
|
+
// node_modules/@noble/ed25519/index.js
|
|
800
|
+
var ed25519_CURVE = {
|
|
801
|
+
p: 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffedn,
|
|
802
|
+
n: 0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3edn,
|
|
803
|
+
h: 8n,
|
|
804
|
+
a: 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffecn,
|
|
805
|
+
d: 0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3n,
|
|
806
|
+
Gx: 0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51an,
|
|
807
|
+
Gy: 0x6666666666666666666666666666666666666666666666666666666666666658n
|
|
808
|
+
};
|
|
809
|
+
var { p: P, n: N, Gx, Gy, a: _a, d: _d, h } = ed25519_CURVE;
|
|
810
|
+
var L = 32;
|
|
811
|
+
var L2 = 64;
|
|
812
|
+
var captureTrace = (...args) => {
|
|
813
|
+
if ("captureStackTrace" in Error && typeof Error.captureStackTrace === "function") {
|
|
814
|
+
Error.captureStackTrace(...args);
|
|
815
|
+
}
|
|
816
|
+
};
|
|
817
|
+
var err = (message = "") => {
|
|
818
|
+
const e = new Error(message);
|
|
819
|
+
captureTrace(e, err);
|
|
820
|
+
throw e;
|
|
821
|
+
};
|
|
822
|
+
var isBig = (n) => typeof n === "bigint";
|
|
823
|
+
var isStr = (s) => typeof s === "string";
|
|
824
|
+
var isBytes = (a) => a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
|
|
825
|
+
var abytes = (value, length, title = "") => {
|
|
826
|
+
const bytes = isBytes(value);
|
|
827
|
+
const len = value?.length;
|
|
828
|
+
const needsLen = length !== void 0;
|
|
829
|
+
if (!bytes || needsLen && len !== length) {
|
|
830
|
+
const prefix = title && `"${title}" `;
|
|
831
|
+
const ofLen = needsLen ? ` of length ${length}` : "";
|
|
832
|
+
const got = bytes ? `length=${len}` : `type=${typeof value}`;
|
|
833
|
+
err(prefix + "expected Uint8Array" + ofLen + ", got " + got);
|
|
834
|
+
}
|
|
835
|
+
return value;
|
|
836
|
+
};
|
|
837
|
+
var u8n = (len) => new Uint8Array(len);
|
|
838
|
+
var u8fr = (buf) => Uint8Array.from(buf);
|
|
839
|
+
var padh = (n, pad) => n.toString(16).padStart(pad, "0");
|
|
840
|
+
var bytesToHex = (b) => Array.from(abytes(b)).map((e) => padh(e, 2)).join("");
|
|
841
|
+
var C = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 };
|
|
842
|
+
var _ch = (ch) => {
|
|
843
|
+
if (ch >= C._0 && ch <= C._9)
|
|
844
|
+
return ch - C._0;
|
|
845
|
+
if (ch >= C.A && ch <= C.F)
|
|
846
|
+
return ch - (C.A - 10);
|
|
847
|
+
if (ch >= C.a && ch <= C.f)
|
|
848
|
+
return ch - (C.a - 10);
|
|
849
|
+
return;
|
|
850
|
+
};
|
|
851
|
+
var hexToBytes = (hex) => {
|
|
852
|
+
const e = "hex invalid";
|
|
853
|
+
if (!isStr(hex))
|
|
854
|
+
return err(e);
|
|
855
|
+
const hl = hex.length;
|
|
856
|
+
const al = hl / 2;
|
|
857
|
+
if (hl % 2)
|
|
858
|
+
return err(e);
|
|
859
|
+
const array = u8n(al);
|
|
860
|
+
for (let ai = 0, hi = 0; ai < al; ai++, hi += 2) {
|
|
861
|
+
const n1 = _ch(hex.charCodeAt(hi));
|
|
862
|
+
const n2 = _ch(hex.charCodeAt(hi + 1));
|
|
863
|
+
if (n1 === void 0 || n2 === void 0)
|
|
864
|
+
return err(e);
|
|
865
|
+
array[ai] = n1 * 16 + n2;
|
|
866
|
+
}
|
|
867
|
+
return array;
|
|
868
|
+
};
|
|
869
|
+
var cr = () => globalThis?.crypto;
|
|
870
|
+
var subtle = () => cr()?.subtle ?? err("crypto.subtle must be defined, consider polyfill");
|
|
871
|
+
var concatBytes = (...arrs) => {
|
|
872
|
+
const r = u8n(arrs.reduce((sum, a) => sum + abytes(a).length, 0));
|
|
873
|
+
let pad = 0;
|
|
874
|
+
arrs.forEach((a) => {
|
|
875
|
+
r.set(a, pad);
|
|
876
|
+
pad += a.length;
|
|
877
|
+
});
|
|
878
|
+
return r;
|
|
879
|
+
};
|
|
880
|
+
var big = BigInt;
|
|
881
|
+
var assertRange = (n, min, max, msg = "bad number: out of range") => isBig(n) && min <= n && n < max ? n : err(msg);
|
|
882
|
+
var M = (a, b = P) => {
|
|
883
|
+
const r = a % b;
|
|
884
|
+
return r >= 0n ? r : b + r;
|
|
885
|
+
};
|
|
886
|
+
var modN = (a) => M(a, N);
|
|
887
|
+
var invert = (num2, md) => {
|
|
888
|
+
if (num2 === 0n || md <= 0n)
|
|
889
|
+
err("no inverse n=" + num2 + " mod=" + md);
|
|
890
|
+
let a = M(num2, md), b = md, x = 0n, y = 1n, u = 1n, v = 0n;
|
|
891
|
+
while (a !== 0n) {
|
|
892
|
+
const q = b / a, r = b % a;
|
|
893
|
+
const m = x - u * q, n = y - v * q;
|
|
894
|
+
b = a, a = r, x = u, y = v, u = m, v = n;
|
|
895
|
+
}
|
|
896
|
+
return b === 1n ? M(x, md) : err("no inverse");
|
|
897
|
+
};
|
|
898
|
+
var callHash = (name) => {
|
|
899
|
+
const fn = hashes[name];
|
|
900
|
+
if (typeof fn !== "function")
|
|
901
|
+
err("hashes." + name + " not set");
|
|
902
|
+
return fn;
|
|
903
|
+
};
|
|
904
|
+
var apoint = (p) => p instanceof Point ? p : err("Point expected");
|
|
905
|
+
var B256 = 2n ** 256n;
|
|
906
|
+
var Point = class _Point {
|
|
907
|
+
static BASE;
|
|
908
|
+
static ZERO;
|
|
909
|
+
X;
|
|
910
|
+
Y;
|
|
911
|
+
Z;
|
|
912
|
+
T;
|
|
913
|
+
constructor(X, Y, Z, T) {
|
|
914
|
+
const max = B256;
|
|
915
|
+
this.X = assertRange(X, 0n, max);
|
|
916
|
+
this.Y = assertRange(Y, 0n, max);
|
|
917
|
+
this.Z = assertRange(Z, 1n, max);
|
|
918
|
+
this.T = assertRange(T, 0n, max);
|
|
919
|
+
Object.freeze(this);
|
|
920
|
+
}
|
|
921
|
+
static CURVE() {
|
|
922
|
+
return ed25519_CURVE;
|
|
923
|
+
}
|
|
924
|
+
static fromAffine(p) {
|
|
925
|
+
return new _Point(p.x, p.y, 1n, M(p.x * p.y));
|
|
926
|
+
}
|
|
927
|
+
/** RFC8032 5.1.3: Uint8Array to Point. */
|
|
928
|
+
static fromBytes(hex, zip215 = false) {
|
|
929
|
+
const d = _d;
|
|
930
|
+
const normed = u8fr(abytes(hex, L));
|
|
931
|
+
const lastByte = hex[31];
|
|
932
|
+
normed[31] = lastByte & ~128;
|
|
933
|
+
const y = bytesToNumLE(normed);
|
|
934
|
+
const max = zip215 ? B256 : P;
|
|
935
|
+
assertRange(y, 0n, max);
|
|
936
|
+
const y2 = M(y * y);
|
|
937
|
+
const u = M(y2 - 1n);
|
|
938
|
+
const v = M(d * y2 + 1n);
|
|
939
|
+
let { isValid, value: x } = uvRatio(u, v);
|
|
940
|
+
if (!isValid)
|
|
941
|
+
err("bad point: y not sqrt");
|
|
942
|
+
const isXOdd = (x & 1n) === 1n;
|
|
943
|
+
const isLastByteOdd = (lastByte & 128) !== 0;
|
|
944
|
+
if (!zip215 && x === 0n && isLastByteOdd)
|
|
945
|
+
err("bad point: x==0, isLastByteOdd");
|
|
946
|
+
if (isLastByteOdd !== isXOdd)
|
|
947
|
+
x = M(-x);
|
|
948
|
+
return new _Point(x, y, 1n, M(x * y));
|
|
949
|
+
}
|
|
950
|
+
static fromHex(hex, zip215) {
|
|
951
|
+
return _Point.fromBytes(hexToBytes(hex), zip215);
|
|
952
|
+
}
|
|
953
|
+
get x() {
|
|
954
|
+
return this.toAffine().x;
|
|
955
|
+
}
|
|
956
|
+
get y() {
|
|
957
|
+
return this.toAffine().y;
|
|
958
|
+
}
|
|
959
|
+
/** Checks if the point is valid and on-curve. */
|
|
960
|
+
assertValidity() {
|
|
961
|
+
const a = _a;
|
|
962
|
+
const d = _d;
|
|
963
|
+
const p = this;
|
|
964
|
+
if (p.is0())
|
|
965
|
+
return err("bad point: ZERO");
|
|
966
|
+
const { X, Y, Z, T } = p;
|
|
967
|
+
const X2 = M(X * X);
|
|
968
|
+
const Y2 = M(Y * Y);
|
|
969
|
+
const Z2 = M(Z * Z);
|
|
970
|
+
const Z4 = M(Z2 * Z2);
|
|
971
|
+
const aX2 = M(X2 * a);
|
|
972
|
+
const left = M(Z2 * M(aX2 + Y2));
|
|
973
|
+
const right = M(Z4 + M(d * M(X2 * Y2)));
|
|
974
|
+
if (left !== right)
|
|
975
|
+
return err("bad point: equation left != right (1)");
|
|
976
|
+
const XY = M(X * Y);
|
|
977
|
+
const ZT = M(Z * T);
|
|
978
|
+
if (XY !== ZT)
|
|
979
|
+
return err("bad point: equation left != right (2)");
|
|
980
|
+
return this;
|
|
981
|
+
}
|
|
982
|
+
/** Equality check: compare points P&Q. */
|
|
983
|
+
equals(other) {
|
|
984
|
+
const { X: X1, Y: Y1, Z: Z1 } = this;
|
|
985
|
+
const { X: X2, Y: Y2, Z: Z2 } = apoint(other);
|
|
986
|
+
const X1Z2 = M(X1 * Z2);
|
|
987
|
+
const X2Z1 = M(X2 * Z1);
|
|
988
|
+
const Y1Z2 = M(Y1 * Z2);
|
|
989
|
+
const Y2Z1 = M(Y2 * Z1);
|
|
990
|
+
return X1Z2 === X2Z1 && Y1Z2 === Y2Z1;
|
|
991
|
+
}
|
|
992
|
+
is0() {
|
|
993
|
+
return this.equals(I);
|
|
994
|
+
}
|
|
995
|
+
/** Flip point over y coordinate. */
|
|
996
|
+
negate() {
|
|
997
|
+
return new _Point(M(-this.X), this.Y, this.Z, M(-this.T));
|
|
998
|
+
}
|
|
999
|
+
/** Point doubling. Complete formula. Cost: `4M + 4S + 1*a + 6add + 1*2`. */
|
|
1000
|
+
double() {
|
|
1001
|
+
const { X: X1, Y: Y1, Z: Z1 } = this;
|
|
1002
|
+
const a = _a;
|
|
1003
|
+
const A = M(X1 * X1);
|
|
1004
|
+
const B = M(Y1 * Y1);
|
|
1005
|
+
const C2 = M(2n * M(Z1 * Z1));
|
|
1006
|
+
const D = M(a * A);
|
|
1007
|
+
const x1y1 = X1 + Y1;
|
|
1008
|
+
const E = M(M(x1y1 * x1y1) - A - B);
|
|
1009
|
+
const G2 = D + B;
|
|
1010
|
+
const F = G2 - C2;
|
|
1011
|
+
const H = D - B;
|
|
1012
|
+
const X3 = M(E * F);
|
|
1013
|
+
const Y3 = M(G2 * H);
|
|
1014
|
+
const T3 = M(E * H);
|
|
1015
|
+
const Z3 = M(F * G2);
|
|
1016
|
+
return new _Point(X3, Y3, Z3, T3);
|
|
1017
|
+
}
|
|
1018
|
+
/** Point addition. Complete formula. Cost: `8M + 1*k + 8add + 1*2`. */
|
|
1019
|
+
add(other) {
|
|
1020
|
+
const { X: X1, Y: Y1, Z: Z1, T: T1 } = this;
|
|
1021
|
+
const { X: X2, Y: Y2, Z: Z2, T: T2 } = apoint(other);
|
|
1022
|
+
const a = _a;
|
|
1023
|
+
const d = _d;
|
|
1024
|
+
const A = M(X1 * X2);
|
|
1025
|
+
const B = M(Y1 * Y2);
|
|
1026
|
+
const C2 = M(T1 * d * T2);
|
|
1027
|
+
const D = M(Z1 * Z2);
|
|
1028
|
+
const E = M((X1 + Y1) * (X2 + Y2) - A - B);
|
|
1029
|
+
const F = M(D - C2);
|
|
1030
|
+
const G2 = M(D + C2);
|
|
1031
|
+
const H = M(B - a * A);
|
|
1032
|
+
const X3 = M(E * F);
|
|
1033
|
+
const Y3 = M(G2 * H);
|
|
1034
|
+
const T3 = M(E * H);
|
|
1035
|
+
const Z3 = M(F * G2);
|
|
1036
|
+
return new _Point(X3, Y3, Z3, T3);
|
|
1037
|
+
}
|
|
1038
|
+
subtract(other) {
|
|
1039
|
+
return this.add(apoint(other).negate());
|
|
1040
|
+
}
|
|
1041
|
+
/**
|
|
1042
|
+
* Point-by-scalar multiplication. Scalar must be in range 1 <= n < CURVE.n.
|
|
1043
|
+
* Uses {@link wNAF} for base point.
|
|
1044
|
+
* Uses fake point to mitigate side-channel leakage.
|
|
1045
|
+
* @param n scalar by which point is multiplied
|
|
1046
|
+
* @param safe safe mode guards against timing attacks; unsafe mode is faster
|
|
1047
|
+
*/
|
|
1048
|
+
multiply(n, safe = true) {
|
|
1049
|
+
if (!safe && (n === 0n || this.is0()))
|
|
1050
|
+
return I;
|
|
1051
|
+
assertRange(n, 1n, N);
|
|
1052
|
+
if (n === 1n)
|
|
1053
|
+
return this;
|
|
1054
|
+
if (this.equals(G))
|
|
1055
|
+
return wNAF(n).p;
|
|
1056
|
+
let p = I;
|
|
1057
|
+
let f = G;
|
|
1058
|
+
for (let d = this; n > 0n; d = d.double(), n >>= 1n) {
|
|
1059
|
+
if (n & 1n)
|
|
1060
|
+
p = p.add(d);
|
|
1061
|
+
else if (safe)
|
|
1062
|
+
f = f.add(d);
|
|
1063
|
+
}
|
|
1064
|
+
return p;
|
|
1065
|
+
}
|
|
1066
|
+
multiplyUnsafe(scalar) {
|
|
1067
|
+
return this.multiply(scalar, false);
|
|
1068
|
+
}
|
|
1069
|
+
/** Convert point to 2d xy affine point. (X, Y, Z) ∋ (x=X/Z, y=Y/Z) */
|
|
1070
|
+
toAffine() {
|
|
1071
|
+
const { X, Y, Z } = this;
|
|
1072
|
+
if (this.equals(I))
|
|
1073
|
+
return { x: 0n, y: 1n };
|
|
1074
|
+
const iz = invert(Z, P);
|
|
1075
|
+
if (M(Z * iz) !== 1n)
|
|
1076
|
+
err("invalid inverse");
|
|
1077
|
+
const x = M(X * iz);
|
|
1078
|
+
const y = M(Y * iz);
|
|
1079
|
+
return { x, y };
|
|
1080
|
+
}
|
|
1081
|
+
toBytes() {
|
|
1082
|
+
const { x, y } = this.assertValidity().toAffine();
|
|
1083
|
+
const b = numTo32bLE(y);
|
|
1084
|
+
b[31] |= x & 1n ? 128 : 0;
|
|
1085
|
+
return b;
|
|
1086
|
+
}
|
|
1087
|
+
toHex() {
|
|
1088
|
+
return bytesToHex(this.toBytes());
|
|
1089
|
+
}
|
|
1090
|
+
clearCofactor() {
|
|
1091
|
+
return this.multiply(big(h), false);
|
|
1092
|
+
}
|
|
1093
|
+
isSmallOrder() {
|
|
1094
|
+
return this.clearCofactor().is0();
|
|
1095
|
+
}
|
|
1096
|
+
isTorsionFree() {
|
|
1097
|
+
let p = this.multiply(N / 2n, false).double();
|
|
1098
|
+
if (N % 2n)
|
|
1099
|
+
p = p.add(this);
|
|
1100
|
+
return p.is0();
|
|
1101
|
+
}
|
|
1102
|
+
};
|
|
1103
|
+
var G = new Point(Gx, Gy, 1n, M(Gx * Gy));
|
|
1104
|
+
var I = new Point(0n, 1n, 1n, 0n);
|
|
1105
|
+
Point.BASE = G;
|
|
1106
|
+
Point.ZERO = I;
|
|
1107
|
+
var numTo32bLE = (num2) => hexToBytes(padh(assertRange(num2, 0n, B256), L2)).reverse();
|
|
1108
|
+
var bytesToNumLE = (b) => big("0x" + bytesToHex(u8fr(abytes(b)).reverse()));
|
|
1109
|
+
var pow2 = (x, power) => {
|
|
1110
|
+
let r = x;
|
|
1111
|
+
while (power-- > 0n) {
|
|
1112
|
+
r *= r;
|
|
1113
|
+
r %= P;
|
|
1114
|
+
}
|
|
1115
|
+
return r;
|
|
1116
|
+
};
|
|
1117
|
+
var pow_2_252_3 = (x) => {
|
|
1118
|
+
const x2 = x * x % P;
|
|
1119
|
+
const b2 = x2 * x % P;
|
|
1120
|
+
const b4 = pow2(b2, 2n) * b2 % P;
|
|
1121
|
+
const b5 = pow2(b4, 1n) * x % P;
|
|
1122
|
+
const b10 = pow2(b5, 5n) * b5 % P;
|
|
1123
|
+
const b20 = pow2(b10, 10n) * b10 % P;
|
|
1124
|
+
const b40 = pow2(b20, 20n) * b20 % P;
|
|
1125
|
+
const b80 = pow2(b40, 40n) * b40 % P;
|
|
1126
|
+
const b160 = pow2(b80, 80n) * b80 % P;
|
|
1127
|
+
const b240 = pow2(b160, 80n) * b80 % P;
|
|
1128
|
+
const b250 = pow2(b240, 10n) * b10 % P;
|
|
1129
|
+
const pow_p_5_8 = pow2(b250, 2n) * x % P;
|
|
1130
|
+
return { pow_p_5_8, b2 };
|
|
1131
|
+
};
|
|
1132
|
+
var RM1 = 0x2b8324804fc1df0b2b4d00993dfbd7a72f431806ad2fe478c4ee1b274a0ea0b0n;
|
|
1133
|
+
var uvRatio = (u, v) => {
|
|
1134
|
+
const v3 = M(v * v * v);
|
|
1135
|
+
const v7 = M(v3 * v3 * v);
|
|
1136
|
+
const pow = pow_2_252_3(u * v7).pow_p_5_8;
|
|
1137
|
+
let x = M(u * v3 * pow);
|
|
1138
|
+
const vx2 = M(v * x * x);
|
|
1139
|
+
const root1 = x;
|
|
1140
|
+
const root2 = M(x * RM1);
|
|
1141
|
+
const useRoot1 = vx2 === u;
|
|
1142
|
+
const useRoot2 = vx2 === M(-u);
|
|
1143
|
+
const noRoot = vx2 === M(-u * RM1);
|
|
1144
|
+
if (useRoot1)
|
|
1145
|
+
x = root1;
|
|
1146
|
+
if (useRoot2 || noRoot)
|
|
1147
|
+
x = root2;
|
|
1148
|
+
if ((M(x) & 1n) === 1n)
|
|
1149
|
+
x = M(-x);
|
|
1150
|
+
return { isValid: useRoot1 || useRoot2, value: x };
|
|
1151
|
+
};
|
|
1152
|
+
var modL_LE = (hash) => modN(bytesToNumLE(hash));
|
|
1153
|
+
var sha512s = (...m) => callHash("sha512")(concatBytes(...m));
|
|
1154
|
+
var hashFinishS = (res) => res.finish(sha512s(res.hashable));
|
|
1155
|
+
var defaultVerifyOpts = { zip215: true };
|
|
1156
|
+
var _verify = (sig, msg, pub, opts = defaultVerifyOpts) => {
|
|
1157
|
+
sig = abytes(sig, L2);
|
|
1158
|
+
msg = abytes(msg);
|
|
1159
|
+
pub = abytes(pub, L);
|
|
1160
|
+
const { zip215 } = opts;
|
|
1161
|
+
let A;
|
|
1162
|
+
let R;
|
|
1163
|
+
let s;
|
|
1164
|
+
let SB;
|
|
1165
|
+
let hashable = Uint8Array.of();
|
|
1166
|
+
try {
|
|
1167
|
+
A = Point.fromBytes(pub, zip215);
|
|
1168
|
+
R = Point.fromBytes(sig.slice(0, L), zip215);
|
|
1169
|
+
s = bytesToNumLE(sig.slice(L, L2));
|
|
1170
|
+
SB = G.multiply(s, false);
|
|
1171
|
+
hashable = concatBytes(R.toBytes(), A.toBytes(), msg);
|
|
1172
|
+
} catch (error) {
|
|
1173
|
+
}
|
|
1174
|
+
const finish = (hashed) => {
|
|
1175
|
+
if (SB == null)
|
|
1176
|
+
return false;
|
|
1177
|
+
if (!zip215 && A.isSmallOrder())
|
|
1178
|
+
return false;
|
|
1179
|
+
const k = modL_LE(hashed);
|
|
1180
|
+
const RkA = R.add(A.multiply(k, false));
|
|
1181
|
+
return RkA.add(SB.negate()).clearCofactor().is0();
|
|
1182
|
+
};
|
|
1183
|
+
return { hashable, finish };
|
|
1184
|
+
};
|
|
1185
|
+
var verify = (signature, message, publicKey, opts = defaultVerifyOpts) => hashFinishS(_verify(signature, message, publicKey, opts));
|
|
1186
|
+
var hashes = {
|
|
1187
|
+
sha512Async: async (message) => {
|
|
1188
|
+
const s = subtle();
|
|
1189
|
+
const m = concatBytes(message);
|
|
1190
|
+
return u8n(await s.digest("SHA-512", m.buffer));
|
|
1191
|
+
},
|
|
1192
|
+
sha512: void 0
|
|
1193
|
+
};
|
|
1194
|
+
var W = 8;
|
|
1195
|
+
var scalarBits = 256;
|
|
1196
|
+
var pwindows = Math.ceil(scalarBits / W) + 1;
|
|
1197
|
+
var pwindowSize = 2 ** (W - 1);
|
|
1198
|
+
var precompute = () => {
|
|
1199
|
+
const points = [];
|
|
1200
|
+
let p = G;
|
|
1201
|
+
let b = p;
|
|
1202
|
+
for (let w = 0; w < pwindows; w++) {
|
|
1203
|
+
b = p;
|
|
1204
|
+
points.push(b);
|
|
1205
|
+
for (let i = 1; i < pwindowSize; i++) {
|
|
1206
|
+
b = b.add(p);
|
|
1207
|
+
points.push(b);
|
|
1208
|
+
}
|
|
1209
|
+
p = b.double();
|
|
1210
|
+
}
|
|
1211
|
+
return points;
|
|
1212
|
+
};
|
|
1213
|
+
var Gpows = void 0;
|
|
1214
|
+
var ctneg = (cnd, p) => {
|
|
1215
|
+
const n = p.negate();
|
|
1216
|
+
return cnd ? n : p;
|
|
1217
|
+
};
|
|
1218
|
+
var wNAF = (n) => {
|
|
1219
|
+
const comp = Gpows || (Gpows = precompute());
|
|
1220
|
+
let p = I;
|
|
1221
|
+
let f = G;
|
|
1222
|
+
const pow_2_w = 2 ** W;
|
|
1223
|
+
const maxNum = pow_2_w;
|
|
1224
|
+
const mask = big(pow_2_w - 1);
|
|
1225
|
+
const shiftBy = big(W);
|
|
1226
|
+
for (let w = 0; w < pwindows; w++) {
|
|
1227
|
+
let wbits = Number(n & mask);
|
|
1228
|
+
n >>= shiftBy;
|
|
1229
|
+
if (wbits > pwindowSize) {
|
|
1230
|
+
wbits -= maxNum;
|
|
1231
|
+
n += 1n;
|
|
1232
|
+
}
|
|
1233
|
+
const off = w * pwindowSize;
|
|
1234
|
+
const offF = off;
|
|
1235
|
+
const offP = off + Math.abs(wbits) - 1;
|
|
1236
|
+
const isEven = w % 2 !== 0;
|
|
1237
|
+
const isNeg = wbits < 0;
|
|
1238
|
+
if (wbits === 0) {
|
|
1239
|
+
f = f.add(ctneg(isEven, comp[offF]));
|
|
1240
|
+
} else {
|
|
1241
|
+
p = p.add(ctneg(isNeg, comp[offP]));
|
|
1242
|
+
}
|
|
1243
|
+
}
|
|
1244
|
+
if (n !== 0n)
|
|
1245
|
+
err("invalid wnaf");
|
|
1246
|
+
return { p, f };
|
|
1247
|
+
};
|
|
1248
|
+
|
|
1249
|
+
// node_modules/@noble/hashes/esm/utils.js
|
|
1250
|
+
function isBytes2(a) {
|
|
1251
|
+
return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
|
|
1252
|
+
}
|
|
1253
|
+
function abytes2(b, ...lengths) {
|
|
1254
|
+
if (!isBytes2(b))
|
|
1255
|
+
throw new Error("Uint8Array expected");
|
|
1256
|
+
if (lengths.length > 0 && !lengths.includes(b.length))
|
|
1257
|
+
throw new Error("Uint8Array expected of length " + lengths + ", got length=" + b.length);
|
|
1258
|
+
}
|
|
1259
|
+
function aexists(instance, checkFinished = true) {
|
|
1260
|
+
if (instance.destroyed)
|
|
1261
|
+
throw new Error("Hash instance has been destroyed");
|
|
1262
|
+
if (checkFinished && instance.finished)
|
|
1263
|
+
throw new Error("Hash#digest() has already been called");
|
|
1264
|
+
}
|
|
1265
|
+
function aoutput(out, instance) {
|
|
1266
|
+
abytes2(out);
|
|
1267
|
+
const min = instance.outputLen;
|
|
1268
|
+
if (out.length < min) {
|
|
1269
|
+
throw new Error("digestInto() expects output buffer of length at least " + min);
|
|
1270
|
+
}
|
|
1271
|
+
}
|
|
1272
|
+
function clean(...arrays) {
|
|
1273
|
+
for (let i = 0; i < arrays.length; i++) {
|
|
1274
|
+
arrays[i].fill(0);
|
|
1275
|
+
}
|
|
1276
|
+
}
|
|
1277
|
+
function createView(arr) {
|
|
1278
|
+
return new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
|
|
1279
|
+
}
|
|
1280
|
+
function utf8ToBytes(str2) {
|
|
1281
|
+
if (typeof str2 !== "string")
|
|
1282
|
+
throw new Error("string expected");
|
|
1283
|
+
return new Uint8Array(new TextEncoder().encode(str2));
|
|
1284
|
+
}
|
|
1285
|
+
function toBytes(data) {
|
|
1286
|
+
if (typeof data === "string")
|
|
1287
|
+
data = utf8ToBytes(data);
|
|
1288
|
+
abytes2(data);
|
|
1289
|
+
return data;
|
|
1290
|
+
}
|
|
1291
|
+
var Hash = class {
|
|
1292
|
+
};
|
|
1293
|
+
function createHasher(hashCons) {
|
|
1294
|
+
const hashC = (msg) => hashCons().update(toBytes(msg)).digest();
|
|
1295
|
+
const tmp = hashCons();
|
|
1296
|
+
hashC.outputLen = tmp.outputLen;
|
|
1297
|
+
hashC.blockLen = tmp.blockLen;
|
|
1298
|
+
hashC.create = () => hashCons();
|
|
1299
|
+
return hashC;
|
|
1300
|
+
}
|
|
1301
|
+
|
|
1302
|
+
// node_modules/@noble/hashes/esm/_md.js
|
|
1303
|
+
function setBigUint64(view, byteOffset, value, isLE) {
|
|
1304
|
+
if (typeof view.setBigUint64 === "function")
|
|
1305
|
+
return view.setBigUint64(byteOffset, value, isLE);
|
|
1306
|
+
const _32n2 = BigInt(32);
|
|
1307
|
+
const _u32_max = BigInt(4294967295);
|
|
1308
|
+
const wh = Number(value >> _32n2 & _u32_max);
|
|
1309
|
+
const wl = Number(value & _u32_max);
|
|
1310
|
+
const h2 = isLE ? 4 : 0;
|
|
1311
|
+
const l = isLE ? 0 : 4;
|
|
1312
|
+
view.setUint32(byteOffset + h2, wh, isLE);
|
|
1313
|
+
view.setUint32(byteOffset + l, wl, isLE);
|
|
1314
|
+
}
|
|
1315
|
+
var HashMD = class extends Hash {
|
|
1316
|
+
constructor(blockLen, outputLen, padOffset, isLE) {
|
|
1317
|
+
super();
|
|
1318
|
+
this.finished = false;
|
|
1319
|
+
this.length = 0;
|
|
1320
|
+
this.pos = 0;
|
|
1321
|
+
this.destroyed = false;
|
|
1322
|
+
this.blockLen = blockLen;
|
|
1323
|
+
this.outputLen = outputLen;
|
|
1324
|
+
this.padOffset = padOffset;
|
|
1325
|
+
this.isLE = isLE;
|
|
1326
|
+
this.buffer = new Uint8Array(blockLen);
|
|
1327
|
+
this.view = createView(this.buffer);
|
|
1328
|
+
}
|
|
1329
|
+
update(data) {
|
|
1330
|
+
aexists(this);
|
|
1331
|
+
data = toBytes(data);
|
|
1332
|
+
abytes2(data);
|
|
1333
|
+
const { view, buffer, blockLen } = this;
|
|
1334
|
+
const len = data.length;
|
|
1335
|
+
for (let pos = 0; pos < len; ) {
|
|
1336
|
+
const take = Math.min(blockLen - this.pos, len - pos);
|
|
1337
|
+
if (take === blockLen) {
|
|
1338
|
+
const dataView = createView(data);
|
|
1339
|
+
for (; blockLen <= len - pos; pos += blockLen)
|
|
1340
|
+
this.process(dataView, pos);
|
|
1341
|
+
continue;
|
|
1342
|
+
}
|
|
1343
|
+
buffer.set(data.subarray(pos, pos + take), this.pos);
|
|
1344
|
+
this.pos += take;
|
|
1345
|
+
pos += take;
|
|
1346
|
+
if (this.pos === blockLen) {
|
|
1347
|
+
this.process(view, 0);
|
|
1348
|
+
this.pos = 0;
|
|
1349
|
+
}
|
|
1350
|
+
}
|
|
1351
|
+
this.length += data.length;
|
|
1352
|
+
this.roundClean();
|
|
1353
|
+
return this;
|
|
1354
|
+
}
|
|
1355
|
+
digestInto(out) {
|
|
1356
|
+
aexists(this);
|
|
1357
|
+
aoutput(out, this);
|
|
1358
|
+
this.finished = true;
|
|
1359
|
+
const { buffer, view, blockLen, isLE } = this;
|
|
1360
|
+
let { pos } = this;
|
|
1361
|
+
buffer[pos++] = 128;
|
|
1362
|
+
clean(this.buffer.subarray(pos));
|
|
1363
|
+
if (this.padOffset > blockLen - pos) {
|
|
1364
|
+
this.process(view, 0);
|
|
1365
|
+
pos = 0;
|
|
1366
|
+
}
|
|
1367
|
+
for (let i = pos; i < blockLen; i++)
|
|
1368
|
+
buffer[i] = 0;
|
|
1369
|
+
setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE);
|
|
1370
|
+
this.process(view, 0);
|
|
1371
|
+
const oview = createView(out);
|
|
1372
|
+
const len = this.outputLen;
|
|
1373
|
+
if (len % 4)
|
|
1374
|
+
throw new Error("_sha2: outputLen should be aligned to 32bit");
|
|
1375
|
+
const outLen = len / 4;
|
|
1376
|
+
const state = this.get();
|
|
1377
|
+
if (outLen > state.length)
|
|
1378
|
+
throw new Error("_sha2: outputLen bigger than state");
|
|
1379
|
+
for (let i = 0; i < outLen; i++)
|
|
1380
|
+
oview.setUint32(4 * i, state[i], isLE);
|
|
1381
|
+
}
|
|
1382
|
+
digest() {
|
|
1383
|
+
const { buffer, outputLen } = this;
|
|
1384
|
+
this.digestInto(buffer);
|
|
1385
|
+
const res = buffer.slice(0, outputLen);
|
|
1386
|
+
this.destroy();
|
|
1387
|
+
return res;
|
|
1388
|
+
}
|
|
1389
|
+
_cloneInto(to) {
|
|
1390
|
+
to || (to = new this.constructor());
|
|
1391
|
+
to.set(...this.get());
|
|
1392
|
+
const { blockLen, buffer, length, finished, destroyed, pos } = this;
|
|
1393
|
+
to.destroyed = destroyed;
|
|
1394
|
+
to.finished = finished;
|
|
1395
|
+
to.length = length;
|
|
1396
|
+
to.pos = pos;
|
|
1397
|
+
if (length % blockLen)
|
|
1398
|
+
to.buffer.set(buffer);
|
|
1399
|
+
return to;
|
|
1400
|
+
}
|
|
1401
|
+
clone() {
|
|
1402
|
+
return this._cloneInto();
|
|
1403
|
+
}
|
|
1404
|
+
};
|
|
1405
|
+
var SHA512_IV = /* @__PURE__ */ Uint32Array.from([
|
|
1406
|
+
1779033703,
|
|
1407
|
+
4089235720,
|
|
1408
|
+
3144134277,
|
|
1409
|
+
2227873595,
|
|
1410
|
+
1013904242,
|
|
1411
|
+
4271175723,
|
|
1412
|
+
2773480762,
|
|
1413
|
+
1595750129,
|
|
1414
|
+
1359893119,
|
|
1415
|
+
2917565137,
|
|
1416
|
+
2600822924,
|
|
1417
|
+
725511199,
|
|
1418
|
+
528734635,
|
|
1419
|
+
4215389547,
|
|
1420
|
+
1541459225,
|
|
1421
|
+
327033209
|
|
1422
|
+
]);
|
|
1423
|
+
|
|
1424
|
+
// node_modules/@noble/hashes/esm/_u64.js
|
|
1425
|
+
var U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
|
|
1426
|
+
var _32n = /* @__PURE__ */ BigInt(32);
|
|
1427
|
+
function fromBig(n, le = false) {
|
|
1428
|
+
if (le)
|
|
1429
|
+
return { h: Number(n & U32_MASK64), l: Number(n >> _32n & U32_MASK64) };
|
|
1430
|
+
return { h: Number(n >> _32n & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };
|
|
1431
|
+
}
|
|
1432
|
+
function split(lst, le = false) {
|
|
1433
|
+
const len = lst.length;
|
|
1434
|
+
let Ah = new Uint32Array(len);
|
|
1435
|
+
let Al = new Uint32Array(len);
|
|
1436
|
+
for (let i = 0; i < len; i++) {
|
|
1437
|
+
const { h: h2, l } = fromBig(lst[i], le);
|
|
1438
|
+
[Ah[i], Al[i]] = [h2, l];
|
|
1439
|
+
}
|
|
1440
|
+
return [Ah, Al];
|
|
1441
|
+
}
|
|
1442
|
+
var shrSH = (h2, _l, s) => h2 >>> s;
|
|
1443
|
+
var shrSL = (h2, l, s) => h2 << 32 - s | l >>> s;
|
|
1444
|
+
var rotrSH = (h2, l, s) => h2 >>> s | l << 32 - s;
|
|
1445
|
+
var rotrSL = (h2, l, s) => h2 << 32 - s | l >>> s;
|
|
1446
|
+
var rotrBH = (h2, l, s) => h2 << 64 - s | l >>> s - 32;
|
|
1447
|
+
var rotrBL = (h2, l, s) => h2 >>> s - 32 | l << 64 - s;
|
|
1448
|
+
function add(Ah, Al, Bh, Bl) {
|
|
1449
|
+
const l = (Al >>> 0) + (Bl >>> 0);
|
|
1450
|
+
return { h: Ah + Bh + (l / 2 ** 32 | 0) | 0, l: l | 0 };
|
|
1451
|
+
}
|
|
1452
|
+
var add3L = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0);
|
|
1453
|
+
var add3H = (low, Ah, Bh, Ch) => Ah + Bh + Ch + (low / 2 ** 32 | 0) | 0;
|
|
1454
|
+
var add4L = (Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0);
|
|
1455
|
+
var add4H = (low, Ah, Bh, Ch, Dh) => Ah + Bh + Ch + Dh + (low / 2 ** 32 | 0) | 0;
|
|
1456
|
+
var add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0);
|
|
1457
|
+
var add5H = (low, Ah, Bh, Ch, Dh, Eh) => Ah + Bh + Ch + Dh + Eh + (low / 2 ** 32 | 0) | 0;
|
|
1458
|
+
|
|
1459
|
+
// node_modules/@noble/hashes/esm/sha2.js
|
|
1460
|
+
var K512 = /* @__PURE__ */ (() => split([
|
|
1461
|
+
"0x428a2f98d728ae22",
|
|
1462
|
+
"0x7137449123ef65cd",
|
|
1463
|
+
"0xb5c0fbcfec4d3b2f",
|
|
1464
|
+
"0xe9b5dba58189dbbc",
|
|
1465
|
+
"0x3956c25bf348b538",
|
|
1466
|
+
"0x59f111f1b605d019",
|
|
1467
|
+
"0x923f82a4af194f9b",
|
|
1468
|
+
"0xab1c5ed5da6d8118",
|
|
1469
|
+
"0xd807aa98a3030242",
|
|
1470
|
+
"0x12835b0145706fbe",
|
|
1471
|
+
"0x243185be4ee4b28c",
|
|
1472
|
+
"0x550c7dc3d5ffb4e2",
|
|
1473
|
+
"0x72be5d74f27b896f",
|
|
1474
|
+
"0x80deb1fe3b1696b1",
|
|
1475
|
+
"0x9bdc06a725c71235",
|
|
1476
|
+
"0xc19bf174cf692694",
|
|
1477
|
+
"0xe49b69c19ef14ad2",
|
|
1478
|
+
"0xefbe4786384f25e3",
|
|
1479
|
+
"0x0fc19dc68b8cd5b5",
|
|
1480
|
+
"0x240ca1cc77ac9c65",
|
|
1481
|
+
"0x2de92c6f592b0275",
|
|
1482
|
+
"0x4a7484aa6ea6e483",
|
|
1483
|
+
"0x5cb0a9dcbd41fbd4",
|
|
1484
|
+
"0x76f988da831153b5",
|
|
1485
|
+
"0x983e5152ee66dfab",
|
|
1486
|
+
"0xa831c66d2db43210",
|
|
1487
|
+
"0xb00327c898fb213f",
|
|
1488
|
+
"0xbf597fc7beef0ee4",
|
|
1489
|
+
"0xc6e00bf33da88fc2",
|
|
1490
|
+
"0xd5a79147930aa725",
|
|
1491
|
+
"0x06ca6351e003826f",
|
|
1492
|
+
"0x142929670a0e6e70",
|
|
1493
|
+
"0x27b70a8546d22ffc",
|
|
1494
|
+
"0x2e1b21385c26c926",
|
|
1495
|
+
"0x4d2c6dfc5ac42aed",
|
|
1496
|
+
"0x53380d139d95b3df",
|
|
1497
|
+
"0x650a73548baf63de",
|
|
1498
|
+
"0x766a0abb3c77b2a8",
|
|
1499
|
+
"0x81c2c92e47edaee6",
|
|
1500
|
+
"0x92722c851482353b",
|
|
1501
|
+
"0xa2bfe8a14cf10364",
|
|
1502
|
+
"0xa81a664bbc423001",
|
|
1503
|
+
"0xc24b8b70d0f89791",
|
|
1504
|
+
"0xc76c51a30654be30",
|
|
1505
|
+
"0xd192e819d6ef5218",
|
|
1506
|
+
"0xd69906245565a910",
|
|
1507
|
+
"0xf40e35855771202a",
|
|
1508
|
+
"0x106aa07032bbd1b8",
|
|
1509
|
+
"0x19a4c116b8d2d0c8",
|
|
1510
|
+
"0x1e376c085141ab53",
|
|
1511
|
+
"0x2748774cdf8eeb99",
|
|
1512
|
+
"0x34b0bcb5e19b48a8",
|
|
1513
|
+
"0x391c0cb3c5c95a63",
|
|
1514
|
+
"0x4ed8aa4ae3418acb",
|
|
1515
|
+
"0x5b9cca4f7763e373",
|
|
1516
|
+
"0x682e6ff3d6b2b8a3",
|
|
1517
|
+
"0x748f82ee5defb2fc",
|
|
1518
|
+
"0x78a5636f43172f60",
|
|
1519
|
+
"0x84c87814a1f0ab72",
|
|
1520
|
+
"0x8cc702081a6439ec",
|
|
1521
|
+
"0x90befffa23631e28",
|
|
1522
|
+
"0xa4506cebde82bde9",
|
|
1523
|
+
"0xbef9a3f7b2c67915",
|
|
1524
|
+
"0xc67178f2e372532b",
|
|
1525
|
+
"0xca273eceea26619c",
|
|
1526
|
+
"0xd186b8c721c0c207",
|
|
1527
|
+
"0xeada7dd6cde0eb1e",
|
|
1528
|
+
"0xf57d4f7fee6ed178",
|
|
1529
|
+
"0x06f067aa72176fba",
|
|
1530
|
+
"0x0a637dc5a2c898a6",
|
|
1531
|
+
"0x113f9804bef90dae",
|
|
1532
|
+
"0x1b710b35131c471b",
|
|
1533
|
+
"0x28db77f523047d84",
|
|
1534
|
+
"0x32caab7b40c72493",
|
|
1535
|
+
"0x3c9ebe0a15c9bebc",
|
|
1536
|
+
"0x431d67c49c100d4c",
|
|
1537
|
+
"0x4cc5d4becb3e42b6",
|
|
1538
|
+
"0x597f299cfc657e2a",
|
|
1539
|
+
"0x5fcb6fab3ad6faec",
|
|
1540
|
+
"0x6c44198c4a475817"
|
|
1541
|
+
].map((n) => BigInt(n))))();
|
|
1542
|
+
var SHA512_Kh = /* @__PURE__ */ (() => K512[0])();
|
|
1543
|
+
var SHA512_Kl = /* @__PURE__ */ (() => K512[1])();
|
|
1544
|
+
var SHA512_W_H = /* @__PURE__ */ new Uint32Array(80);
|
|
1545
|
+
var SHA512_W_L = /* @__PURE__ */ new Uint32Array(80);
|
|
1546
|
+
var SHA512 = class extends HashMD {
|
|
1547
|
+
constructor(outputLen = 64) {
|
|
1548
|
+
super(128, outputLen, 16, false);
|
|
1549
|
+
this.Ah = SHA512_IV[0] | 0;
|
|
1550
|
+
this.Al = SHA512_IV[1] | 0;
|
|
1551
|
+
this.Bh = SHA512_IV[2] | 0;
|
|
1552
|
+
this.Bl = SHA512_IV[3] | 0;
|
|
1553
|
+
this.Ch = SHA512_IV[4] | 0;
|
|
1554
|
+
this.Cl = SHA512_IV[5] | 0;
|
|
1555
|
+
this.Dh = SHA512_IV[6] | 0;
|
|
1556
|
+
this.Dl = SHA512_IV[7] | 0;
|
|
1557
|
+
this.Eh = SHA512_IV[8] | 0;
|
|
1558
|
+
this.El = SHA512_IV[9] | 0;
|
|
1559
|
+
this.Fh = SHA512_IV[10] | 0;
|
|
1560
|
+
this.Fl = SHA512_IV[11] | 0;
|
|
1561
|
+
this.Gh = SHA512_IV[12] | 0;
|
|
1562
|
+
this.Gl = SHA512_IV[13] | 0;
|
|
1563
|
+
this.Hh = SHA512_IV[14] | 0;
|
|
1564
|
+
this.Hl = SHA512_IV[15] | 0;
|
|
1565
|
+
}
|
|
1566
|
+
// prettier-ignore
|
|
1567
|
+
get() {
|
|
1568
|
+
const { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;
|
|
1569
|
+
return [Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl];
|
|
1570
|
+
}
|
|
1571
|
+
// prettier-ignore
|
|
1572
|
+
set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl) {
|
|
1573
|
+
this.Ah = Ah | 0;
|
|
1574
|
+
this.Al = Al | 0;
|
|
1575
|
+
this.Bh = Bh | 0;
|
|
1576
|
+
this.Bl = Bl | 0;
|
|
1577
|
+
this.Ch = Ch | 0;
|
|
1578
|
+
this.Cl = Cl | 0;
|
|
1579
|
+
this.Dh = Dh | 0;
|
|
1580
|
+
this.Dl = Dl | 0;
|
|
1581
|
+
this.Eh = Eh | 0;
|
|
1582
|
+
this.El = El | 0;
|
|
1583
|
+
this.Fh = Fh | 0;
|
|
1584
|
+
this.Fl = Fl | 0;
|
|
1585
|
+
this.Gh = Gh | 0;
|
|
1586
|
+
this.Gl = Gl | 0;
|
|
1587
|
+
this.Hh = Hh | 0;
|
|
1588
|
+
this.Hl = Hl | 0;
|
|
1589
|
+
}
|
|
1590
|
+
process(view, offset) {
|
|
1591
|
+
for (let i = 0; i < 16; i++, offset += 4) {
|
|
1592
|
+
SHA512_W_H[i] = view.getUint32(offset);
|
|
1593
|
+
SHA512_W_L[i] = view.getUint32(offset += 4);
|
|
1594
|
+
}
|
|
1595
|
+
for (let i = 16; i < 80; i++) {
|
|
1596
|
+
const W15h = SHA512_W_H[i - 15] | 0;
|
|
1597
|
+
const W15l = SHA512_W_L[i - 15] | 0;
|
|
1598
|
+
const s0h = rotrSH(W15h, W15l, 1) ^ rotrSH(W15h, W15l, 8) ^ shrSH(W15h, W15l, 7);
|
|
1599
|
+
const s0l = rotrSL(W15h, W15l, 1) ^ rotrSL(W15h, W15l, 8) ^ shrSL(W15h, W15l, 7);
|
|
1600
|
+
const W2h = SHA512_W_H[i - 2] | 0;
|
|
1601
|
+
const W2l = SHA512_W_L[i - 2] | 0;
|
|
1602
|
+
const s1h = rotrSH(W2h, W2l, 19) ^ rotrBH(W2h, W2l, 61) ^ shrSH(W2h, W2l, 6);
|
|
1603
|
+
const s1l = rotrSL(W2h, W2l, 19) ^ rotrBL(W2h, W2l, 61) ^ shrSL(W2h, W2l, 6);
|
|
1604
|
+
const SUMl = add4L(s0l, s1l, SHA512_W_L[i - 7], SHA512_W_L[i - 16]);
|
|
1605
|
+
const SUMh = add4H(SUMl, s0h, s1h, SHA512_W_H[i - 7], SHA512_W_H[i - 16]);
|
|
1606
|
+
SHA512_W_H[i] = SUMh | 0;
|
|
1607
|
+
SHA512_W_L[i] = SUMl | 0;
|
|
1608
|
+
}
|
|
1609
|
+
let { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;
|
|
1610
|
+
for (let i = 0; i < 80; i++) {
|
|
1611
|
+
const sigma1h = rotrSH(Eh, El, 14) ^ rotrSH(Eh, El, 18) ^ rotrBH(Eh, El, 41);
|
|
1612
|
+
const sigma1l = rotrSL(Eh, El, 14) ^ rotrSL(Eh, El, 18) ^ rotrBL(Eh, El, 41);
|
|
1613
|
+
const CHIh = Eh & Fh ^ ~Eh & Gh;
|
|
1614
|
+
const CHIl = El & Fl ^ ~El & Gl;
|
|
1615
|
+
const T1ll = add5L(Hl, sigma1l, CHIl, SHA512_Kl[i], SHA512_W_L[i]);
|
|
1616
|
+
const T1h = add5H(T1ll, Hh, sigma1h, CHIh, SHA512_Kh[i], SHA512_W_H[i]);
|
|
1617
|
+
const T1l = T1ll | 0;
|
|
1618
|
+
const sigma0h = rotrSH(Ah, Al, 28) ^ rotrBH(Ah, Al, 34) ^ rotrBH(Ah, Al, 39);
|
|
1619
|
+
const sigma0l = rotrSL(Ah, Al, 28) ^ rotrBL(Ah, Al, 34) ^ rotrBL(Ah, Al, 39);
|
|
1620
|
+
const MAJh = Ah & Bh ^ Ah & Ch ^ Bh & Ch;
|
|
1621
|
+
const MAJl = Al & Bl ^ Al & Cl ^ Bl & Cl;
|
|
1622
|
+
Hh = Gh | 0;
|
|
1623
|
+
Hl = Gl | 0;
|
|
1624
|
+
Gh = Fh | 0;
|
|
1625
|
+
Gl = Fl | 0;
|
|
1626
|
+
Fh = Eh | 0;
|
|
1627
|
+
Fl = El | 0;
|
|
1628
|
+
({ h: Eh, l: El } = add(Dh | 0, Dl | 0, T1h | 0, T1l | 0));
|
|
1629
|
+
Dh = Ch | 0;
|
|
1630
|
+
Dl = Cl | 0;
|
|
1631
|
+
Ch = Bh | 0;
|
|
1632
|
+
Cl = Bl | 0;
|
|
1633
|
+
Bh = Ah | 0;
|
|
1634
|
+
Bl = Al | 0;
|
|
1635
|
+
const All = add3L(T1l, sigma0l, MAJl);
|
|
1636
|
+
Ah = add3H(All, T1h, sigma0h, MAJh);
|
|
1637
|
+
Al = All | 0;
|
|
1638
|
+
}
|
|
1639
|
+
({ h: Ah, l: Al } = add(this.Ah | 0, this.Al | 0, Ah | 0, Al | 0));
|
|
1640
|
+
({ h: Bh, l: Bl } = add(this.Bh | 0, this.Bl | 0, Bh | 0, Bl | 0));
|
|
1641
|
+
({ h: Ch, l: Cl } = add(this.Ch | 0, this.Cl | 0, Ch | 0, Cl | 0));
|
|
1642
|
+
({ h: Dh, l: Dl } = add(this.Dh | 0, this.Dl | 0, Dh | 0, Dl | 0));
|
|
1643
|
+
({ h: Eh, l: El } = add(this.Eh | 0, this.El | 0, Eh | 0, El | 0));
|
|
1644
|
+
({ h: Fh, l: Fl } = add(this.Fh | 0, this.Fl | 0, Fh | 0, Fl | 0));
|
|
1645
|
+
({ h: Gh, l: Gl } = add(this.Gh | 0, this.Gl | 0, Gh | 0, Gl | 0));
|
|
1646
|
+
({ h: Hh, l: Hl } = add(this.Hh | 0, this.Hl | 0, Hh | 0, Hl | 0));
|
|
1647
|
+
this.set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl);
|
|
1648
|
+
}
|
|
1649
|
+
roundClean() {
|
|
1650
|
+
clean(SHA512_W_H, SHA512_W_L);
|
|
1651
|
+
}
|
|
1652
|
+
destroy() {
|
|
1653
|
+
clean(this.buffer);
|
|
1654
|
+
this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
|
1655
|
+
}
|
|
1656
|
+
};
|
|
1657
|
+
var sha512 = /* @__PURE__ */ createHasher(() => new SHA512());
|
|
1658
|
+
|
|
1659
|
+
// src/nodeReceipt.ts
|
|
1660
|
+
hashes.sha512 = sha512;
|
|
1661
|
+
function base64urlToBytes(s) {
|
|
1662
|
+
const pad = s.length % 4;
|
|
1663
|
+
const base64 = s.replace(/-/g, "+").replace(/_/g, "/") + (pad ? "=".repeat(4 - pad) : "");
|
|
1664
|
+
if (typeof Buffer !== "undefined") {
|
|
1665
|
+
return new Uint8Array(Buffer.from(base64, "base64"));
|
|
1666
|
+
}
|
|
1667
|
+
const binary = atob(base64);
|
|
1668
|
+
return Uint8Array.from(binary, (c) => c.charCodeAt(0));
|
|
1669
|
+
}
|
|
1670
|
+
async function verifyNodeReceiptSignature(params) {
|
|
1671
|
+
try {
|
|
1672
|
+
const { receipt, signatureB64Url, key } = params;
|
|
1673
|
+
let pubKeyBytes;
|
|
1674
|
+
if (key.jwk) {
|
|
1675
|
+
if (key.jwk.kty !== "OKP" || key.jwk.crv !== "Ed25519") {
|
|
1676
|
+
return {
|
|
1677
|
+
ok: false,
|
|
1678
|
+
code: CerVerifyCode.ATTESTATION_KEY_FORMAT_UNSUPPORTED,
|
|
1679
|
+
details: [
|
|
1680
|
+
`JWK must have kty=OKP and crv=Ed25519, got kty=${key.jwk.kty} crv=${key.jwk.crv}`
|
|
1681
|
+
]
|
|
1682
|
+
};
|
|
1683
|
+
}
|
|
1684
|
+
pubKeyBytes = base64urlToBytes(key.jwk.x);
|
|
1685
|
+
} else if (key.rawB64Url) {
|
|
1686
|
+
pubKeyBytes = base64urlToBytes(key.rawB64Url);
|
|
1687
|
+
} else if (key.spkiB64) {
|
|
1688
|
+
const spkiBytes = base64urlToBytes(key.spkiB64);
|
|
1689
|
+
if (spkiBytes.length < 32) {
|
|
1690
|
+
return {
|
|
1691
|
+
ok: false,
|
|
1692
|
+
code: CerVerifyCode.ATTESTATION_KEY_FORMAT_UNSUPPORTED,
|
|
1693
|
+
details: ["SPKI key too short to extract Ed25519 public key"]
|
|
1694
|
+
};
|
|
1695
|
+
}
|
|
1696
|
+
pubKeyBytes = spkiBytes.slice(spkiBytes.length - 32);
|
|
1697
|
+
} else {
|
|
1698
|
+
return {
|
|
1699
|
+
ok: false,
|
|
1700
|
+
code: CerVerifyCode.ATTESTATION_KEY_FORMAT_UNSUPPORTED,
|
|
1701
|
+
details: ["No usable key provided: supply jwk, rawB64Url, or spkiB64"]
|
|
1702
|
+
};
|
|
1703
|
+
}
|
|
1704
|
+
if (pubKeyBytes.length !== 32) {
|
|
1705
|
+
return {
|
|
1706
|
+
ok: false,
|
|
1707
|
+
code: CerVerifyCode.ATTESTATION_KEY_FORMAT_UNSUPPORTED,
|
|
1708
|
+
details: [`Ed25519 public key must be 32 bytes, got ${pubKeyBytes.length}`]
|
|
1709
|
+
};
|
|
1710
|
+
}
|
|
1711
|
+
const sigBytes = base64urlToBytes(signatureB64Url);
|
|
1712
|
+
if (sigBytes.length !== 64) {
|
|
1713
|
+
return {
|
|
1714
|
+
ok: false,
|
|
1715
|
+
code: CerVerifyCode.ATTESTATION_INVALID_SIGNATURE,
|
|
1716
|
+
details: [`Ed25519 signature must be 64 bytes, got ${sigBytes.length}`]
|
|
1717
|
+
};
|
|
1718
|
+
}
|
|
1719
|
+
const msgBytes = new TextEncoder().encode(toCanonicalJson(receipt));
|
|
1720
|
+
const isValid = await verify(sigBytes, msgBytes, pubKeyBytes);
|
|
1721
|
+
if (!isValid) {
|
|
1722
|
+
return {
|
|
1723
|
+
ok: false,
|
|
1724
|
+
code: CerVerifyCode.ATTESTATION_INVALID_SIGNATURE,
|
|
1725
|
+
details: ["Ed25519 signature verification failed"]
|
|
1726
|
+
};
|
|
1727
|
+
}
|
|
1728
|
+
return { ok: true, code: CerVerifyCode.OK };
|
|
1729
|
+
} catch (err2) {
|
|
1730
|
+
return {
|
|
1731
|
+
ok: false,
|
|
1732
|
+
code: CerVerifyCode.ATTESTATION_INVALID_SIGNATURE,
|
|
1733
|
+
details: [err2 instanceof Error ? err2.message : String(err2)]
|
|
1734
|
+
};
|
|
1735
|
+
}
|
|
1736
|
+
}
|
|
1737
|
+
async function fetchNodeKeys(nodeUrl) {
|
|
1738
|
+
const url = `${nodeUrl.replace(/\/+$/, "")}/.well-known/nexart-node.json`;
|
|
1739
|
+
const response = await fetch(url);
|
|
1740
|
+
if (!response.ok) {
|
|
1741
|
+
throw new Error(`Failed to fetch node keys from ${url}: HTTP ${response.status}`);
|
|
1742
|
+
}
|
|
1743
|
+
const data = await response.json();
|
|
1744
|
+
if (typeof data !== "object" || data === null) {
|
|
1745
|
+
throw new Error("Node keys response is not an object");
|
|
1746
|
+
}
|
|
1747
|
+
const doc = data;
|
|
1748
|
+
if (typeof doc.nodeId !== "string" || !Array.isArray(doc.keys)) {
|
|
1749
|
+
throw new Error("Node keys document missing required fields (nodeId, keys)");
|
|
1750
|
+
}
|
|
1751
|
+
return data;
|
|
1752
|
+
}
|
|
1753
|
+
function selectNodeKey(doc, kid) {
|
|
1754
|
+
if (kid) {
|
|
1755
|
+
const found = doc.keys.find((k) => k.kid === kid);
|
|
1756
|
+
if (!found) {
|
|
1757
|
+
return {
|
|
1758
|
+
error: {
|
|
1759
|
+
ok: false,
|
|
1760
|
+
code: CerVerifyCode.ATTESTATION_KEY_NOT_FOUND,
|
|
1761
|
+
details: [`Key with kid="${kid}" not found in node keys document`]
|
|
1762
|
+
}
|
|
1763
|
+
};
|
|
1764
|
+
}
|
|
1765
|
+
return { key: found };
|
|
1766
|
+
}
|
|
1767
|
+
if (doc.activeKid) {
|
|
1768
|
+
const found = doc.keys.find((k) => k.kid === doc.activeKid);
|
|
1769
|
+
if (!found) {
|
|
1770
|
+
return {
|
|
1771
|
+
error: {
|
|
1772
|
+
ok: false,
|
|
1773
|
+
code: CerVerifyCode.ATTESTATION_KEY_NOT_FOUND,
|
|
1774
|
+
details: [`activeKid="${doc.activeKid}" not found in keys array`]
|
|
1775
|
+
}
|
|
1776
|
+
};
|
|
1777
|
+
}
|
|
1778
|
+
return { key: found };
|
|
1779
|
+
}
|
|
1780
|
+
if (doc.keys.length === 0) {
|
|
1781
|
+
return {
|
|
1782
|
+
error: {
|
|
1783
|
+
ok: false,
|
|
1784
|
+
code: CerVerifyCode.ATTESTATION_KEY_NOT_FOUND,
|
|
1785
|
+
details: ["No keys available in node keys document"]
|
|
1786
|
+
}
|
|
1787
|
+
};
|
|
1788
|
+
}
|
|
1789
|
+
return { key: doc.keys[0] };
|
|
1790
|
+
}
|
|
1791
|
+
function extractReceiptAndSignature(bundle) {
|
|
1792
|
+
if (typeof bundle !== "object" || bundle === null) return null;
|
|
1793
|
+
const b = bundle;
|
|
1794
|
+
if (typeof b.receipt === "object" && b.receipt !== null && typeof b.signature === "string") {
|
|
1795
|
+
return {
|
|
1796
|
+
receipt: b.receipt,
|
|
1797
|
+
signatureB64Url: b.signature,
|
|
1798
|
+
attestorKeyId: typeof b.attestorKeyId === "string" ? b.attestorKeyId : void 0
|
|
1799
|
+
};
|
|
1800
|
+
}
|
|
1801
|
+
if (typeof b.meta === "object" && b.meta !== null) {
|
|
1802
|
+
const meta = b.meta;
|
|
1803
|
+
if (typeof meta.attestation === "object" && meta.attestation !== null) {
|
|
1804
|
+
const att = meta.attestation;
|
|
1805
|
+
if (typeof att.receipt === "object" && att.receipt !== null && typeof att.signature === "string") {
|
|
1806
|
+
return {
|
|
1807
|
+
receipt: att.receipt,
|
|
1808
|
+
signatureB64Url: att.signature,
|
|
1809
|
+
attestorKeyId: typeof att.attestorKeyId === "string" ? att.attestorKeyId : void 0
|
|
1810
|
+
};
|
|
1811
|
+
}
|
|
1812
|
+
}
|
|
1813
|
+
}
|
|
1814
|
+
return null;
|
|
1815
|
+
}
|
|
1816
|
+
async function verifyBundleAttestation(bundle, options) {
|
|
1817
|
+
const extracted = extractReceiptAndSignature(bundle);
|
|
1818
|
+
if (!extracted) {
|
|
1819
|
+
return {
|
|
1820
|
+
ok: false,
|
|
1821
|
+
code: CerVerifyCode.ATTESTATION_MISSING,
|
|
1822
|
+
details: ["No signed receipt found in bundle (expected bundle.receipt + bundle.signature)"]
|
|
1823
|
+
};
|
|
1824
|
+
}
|
|
1825
|
+
const nodeId = extracted.receipt.nodeId;
|
|
1826
|
+
const resolvedKid = options.kid ?? extracted.attestorKeyId ?? extracted.receipt.attestorKeyId;
|
|
1827
|
+
function ctx() {
|
|
1828
|
+
const lines = [];
|
|
1829
|
+
if (nodeId) lines.push(`nodeId: ${nodeId}`);
|
|
1830
|
+
if (resolvedKid) lines.push(`kid: ${resolvedKid}`);
|
|
1831
|
+
return lines;
|
|
1832
|
+
}
|
|
1833
|
+
let keysDoc;
|
|
1834
|
+
try {
|
|
1835
|
+
keysDoc = await fetchNodeKeys(options.nodeUrl);
|
|
1836
|
+
} catch (err2) {
|
|
1837
|
+
return {
|
|
1838
|
+
ok: false,
|
|
1839
|
+
code: CerVerifyCode.ATTESTATION_KEY_NOT_FOUND,
|
|
1840
|
+
details: [...ctx(), err2 instanceof Error ? err2.message : String(err2)]
|
|
1841
|
+
};
|
|
1842
|
+
}
|
|
1843
|
+
if (typeof bundle.certificateHash === "string") {
|
|
1844
|
+
const bundleCertHash = bundle.certificateHash;
|
|
1845
|
+
if (extracted.receipt.certificateHash !== bundleCertHash) {
|
|
1846
|
+
return {
|
|
1847
|
+
ok: false,
|
|
1848
|
+
code: CerVerifyCode.CERTIFICATE_HASH_MISMATCH,
|
|
1849
|
+
details: [
|
|
1850
|
+
`Receipt certificateHash does not match bundle certificateHash`,
|
|
1851
|
+
`receipt.certificateHash: ${extracted.receipt.certificateHash}`,
|
|
1852
|
+
`bundle.certificateHash: ${bundleCertHash}`,
|
|
1853
|
+
...ctx()
|
|
1854
|
+
]
|
|
1855
|
+
};
|
|
1856
|
+
}
|
|
1857
|
+
}
|
|
1858
|
+
const selected = selectNodeKey(keysDoc, resolvedKid);
|
|
1859
|
+
if (selected.error) {
|
|
1860
|
+
return {
|
|
1861
|
+
...selected.error,
|
|
1862
|
+
details: [...ctx(), ...selected.error.details ?? []]
|
|
1863
|
+
};
|
|
1864
|
+
}
|
|
1865
|
+
const keyEntry = selected.key;
|
|
1866
|
+
const keyParam = {};
|
|
1867
|
+
if (keyEntry.publicKeyJwk) keyParam.jwk = keyEntry.publicKeyJwk;
|
|
1868
|
+
else if (keyEntry.publicKey) keyParam.rawB64Url = keyEntry.publicKey;
|
|
1869
|
+
else if (keyEntry.publicKeySpkiB64) keyParam.spkiB64 = keyEntry.publicKeySpkiB64;
|
|
1870
|
+
else {
|
|
1871
|
+
return {
|
|
1872
|
+
ok: false,
|
|
1873
|
+
code: CerVerifyCode.ATTESTATION_KEY_FORMAT_UNSUPPORTED,
|
|
1874
|
+
details: [
|
|
1875
|
+
`Key kid="${keyEntry.kid}" has no usable public key field (publicKeyJwk, publicKey, or publicKeySpkiB64)`,
|
|
1876
|
+
...ctx()
|
|
1877
|
+
]
|
|
1878
|
+
};
|
|
1879
|
+
}
|
|
1880
|
+
const sigResult = await verifyNodeReceiptSignature({
|
|
1881
|
+
receipt: extracted.receipt,
|
|
1882
|
+
signatureB64Url: extracted.signatureB64Url,
|
|
1883
|
+
key: keyParam
|
|
1884
|
+
});
|
|
1885
|
+
const contextLines = ctx();
|
|
1886
|
+
if (contextLines.length === 0) return sigResult;
|
|
1887
|
+
return sigResult.ok ? { ok: true, code: CerVerifyCode.OK, details: contextLines } : { ...sigResult, details: [...contextLines, ...sigResult.details ?? []] };
|
|
1888
|
+
}
|
|
1889
|
+
|
|
1890
|
+
// src/certifyFromProvider.ts
|
|
1891
|
+
var crypto5 = __toESM(require("crypto"), 1);
|
|
1892
|
+
|
|
1893
|
+
// src/providerExtract.ts
|
|
1894
|
+
function str(v) {
|
|
1895
|
+
return typeof v === "string" && v.length > 0 ? v : null;
|
|
1896
|
+
}
|
|
1897
|
+
function num(v, fallback) {
|
|
1898
|
+
return typeof v === "number" && Number.isFinite(v) ? v : fallback;
|
|
1899
|
+
}
|
|
1900
|
+
function numOrNull(v) {
|
|
1901
|
+
return typeof v === "number" && Number.isFinite(v) ? v : null;
|
|
1902
|
+
}
|
|
1903
|
+
function extractChoicesOutput(response) {
|
|
1904
|
+
const choices = response.choices;
|
|
1905
|
+
if (!Array.isArray(choices) || choices.length === 0) return null;
|
|
1906
|
+
const first = choices[0];
|
|
1907
|
+
if (!first || typeof first !== "object") return null;
|
|
1908
|
+
const msg = first.message;
|
|
1909
|
+
if (!msg || typeof msg !== "object") return null;
|
|
1910
|
+
if (typeof msg.content === "string") return msg.content;
|
|
1911
|
+
if (Array.isArray(msg.content)) {
|
|
1912
|
+
const texts = msg.content.filter((p) => typeof p === "object" && p !== null).map((p) => str(p.text)).filter((t) => t !== null);
|
|
1913
|
+
return texts.length > 0 ? texts.join("\n") : null;
|
|
1914
|
+
}
|
|
1915
|
+
return null;
|
|
1916
|
+
}
|
|
1917
|
+
function extractAnthropicOutput(response) {
|
|
1918
|
+
const content = response.content;
|
|
1919
|
+
if (!Array.isArray(content) || content.length === 0) return null;
|
|
1920
|
+
const first = content[0];
|
|
1921
|
+
if (!first || typeof first !== "object") return null;
|
|
1922
|
+
return str(first.text);
|
|
1923
|
+
}
|
|
1924
|
+
function extractGeminiOutput(response) {
|
|
1925
|
+
const candidates = response.candidates;
|
|
1926
|
+
if (!Array.isArray(candidates) || candidates.length === 0) return null;
|
|
1927
|
+
const first = candidates[0];
|
|
1928
|
+
if (!first || typeof first !== "object") return null;
|
|
1929
|
+
const contentObj = first.content;
|
|
1930
|
+
if (!contentObj || typeof contentObj !== "object") return null;
|
|
1931
|
+
const parts = contentObj.parts;
|
|
1932
|
+
if (!Array.isArray(parts) || parts.length === 0) return null;
|
|
1933
|
+
const part = parts[0];
|
|
1934
|
+
if (!part || typeof part !== "object") return null;
|
|
1935
|
+
return str(part.text);
|
|
1936
|
+
}
|
|
1937
|
+
function extractGenericOutput(response) {
|
|
1938
|
+
return str(response.text) ?? str(response.output_text) ?? (typeof response.output === "string" ? response.output : null) ?? str(response.result) ?? null;
|
|
1939
|
+
}
|
|
1940
|
+
function extractOutput(response) {
|
|
1941
|
+
return extractChoicesOutput(response) ?? extractAnthropicOutput(response) ?? extractGeminiOutput(response) ?? extractGenericOutput(response);
|
|
1942
|
+
}
|
|
1943
|
+
function extractInput(request) {
|
|
1944
|
+
if (Array.isArray(request.messages) && request.messages.length > 0) {
|
|
1945
|
+
return { messages: request.messages };
|
|
1946
|
+
}
|
|
1947
|
+
if (Array.isArray(request.contents) && request.contents.length > 0) {
|
|
1948
|
+
return { contents: request.contents };
|
|
1949
|
+
}
|
|
1950
|
+
if (typeof request.prompt === "string") return request.prompt;
|
|
1951
|
+
if (typeof request.input === "string") return request.input;
|
|
1952
|
+
if (typeof request.input === "object" && request.input !== null) {
|
|
1953
|
+
return request.input;
|
|
1954
|
+
}
|
|
1955
|
+
return null;
|
|
1956
|
+
}
|
|
1957
|
+
function derivePrompt(request) {
|
|
1958
|
+
if (typeof request.prompt === "string") return request.prompt;
|
|
1959
|
+
if (Array.isArray(request.messages)) {
|
|
1960
|
+
const msgs = request.messages;
|
|
1961
|
+
for (let i = msgs.length - 1; i >= 0; i--) {
|
|
1962
|
+
const msg = msgs[i];
|
|
1963
|
+
if (msg.role === "user" || msg.role === "human") {
|
|
1964
|
+
const content = msg.content;
|
|
1965
|
+
if (typeof content === "string") return content;
|
|
1966
|
+
if (Array.isArray(content)) {
|
|
1967
|
+
const text = content.filter((p) => typeof p === "object" && p !== null).map((p) => str(p.text)).filter((t) => t !== null).join("\n");
|
|
1968
|
+
if (text) return text;
|
|
1969
|
+
}
|
|
1970
|
+
}
|
|
1971
|
+
}
|
|
1972
|
+
}
|
|
1973
|
+
if (Array.isArray(request.contents)) {
|
|
1974
|
+
const contents = request.contents;
|
|
1975
|
+
for (let i = contents.length - 1; i >= 0; i--) {
|
|
1976
|
+
const c = contents[i];
|
|
1977
|
+
if (c.role === "user") {
|
|
1978
|
+
const parts = c.parts;
|
|
1979
|
+
if (Array.isArray(parts)) {
|
|
1980
|
+
const text = parts.map((p) => str(p.text)).filter((t) => t !== null).join("\n");
|
|
1981
|
+
if (text) return text;
|
|
1982
|
+
}
|
|
1983
|
+
}
|
|
1984
|
+
}
|
|
1985
|
+
}
|
|
1986
|
+
return null;
|
|
1987
|
+
}
|
|
1988
|
+
function extractParams(request) {
|
|
1989
|
+
const cfg = typeof request.generationConfig === "object" && request.generationConfig !== null ? request.generationConfig : request;
|
|
1990
|
+
return {
|
|
1991
|
+
temperature: num(cfg.temperature, 1),
|
|
1992
|
+
maxTokens: num(cfg.max_tokens ?? cfg.maxTokens ?? cfg.maxOutputTokens ?? cfg.max_output_tokens, 1024),
|
|
1993
|
+
topP: numOrNull(cfg.top_p ?? cfg.topP),
|
|
1994
|
+
seed: numOrNull(cfg.seed)
|
|
1995
|
+
};
|
|
1996
|
+
}
|
|
1997
|
+
function extractModel(providerHint, request, response, override) {
|
|
1998
|
+
const raw = override ?? str(request.model) ?? str(request.modelId) ?? // Bedrock
|
|
1999
|
+
str(response.model) ?? str(response.modelId) ?? null;
|
|
2000
|
+
if (!raw) return null;
|
|
2001
|
+
const parts = raw.split("/");
|
|
2002
|
+
const modelName = parts[parts.length - 1];
|
|
2003
|
+
const modelVersion = str(response.model_version ?? response.modelVersion) ?? null;
|
|
2004
|
+
return { model: modelName, modelVersion };
|
|
2005
|
+
}
|
|
2006
|
+
function tryUnwrapBedrock(request) {
|
|
2007
|
+
const modelId = str(request.modelId);
|
|
2008
|
+
if (!modelId) return null;
|
|
2009
|
+
let body = {};
|
|
2010
|
+
if (typeof request.body === "string") {
|
|
2011
|
+
try {
|
|
2012
|
+
body = JSON.parse(request.body);
|
|
2013
|
+
} catch {
|
|
2014
|
+
body = {};
|
|
2015
|
+
}
|
|
2016
|
+
} else if (typeof request.body === "object" && request.body !== null) {
|
|
2017
|
+
body = request.body;
|
|
2018
|
+
}
|
|
2019
|
+
return { req: { ...body, modelId }, modelId };
|
|
2020
|
+
}
|
|
2021
|
+
function extractFromProviderCall(provider, modelOverride, rawRequest, rawResponse) {
|
|
2022
|
+
let request = rawRequest;
|
|
2023
|
+
if (provider === "bedrock" || str(rawRequest.modelId)) {
|
|
2024
|
+
const unwrapped = tryUnwrapBedrock(rawRequest);
|
|
2025
|
+
if (unwrapped) request = unwrapped.req;
|
|
2026
|
+
}
|
|
2027
|
+
const modelResult = extractModel(provider, request, rawResponse, modelOverride);
|
|
2028
|
+
if (!modelResult) {
|
|
2029
|
+
return {
|
|
2030
|
+
ok: false,
|
|
2031
|
+
reason: "Could not determine model name. Provide it via the `model` field, or ensure request.model / request.modelId is present."
|
|
2032
|
+
};
|
|
2033
|
+
}
|
|
2034
|
+
const input = extractInput(request);
|
|
2035
|
+
if (input === null) {
|
|
2036
|
+
return {
|
|
2037
|
+
ok: false,
|
|
2038
|
+
reason: "Could not extract input. Expected request.messages (OpenAI/Anthropic/Mistral), request.contents (Gemini), or request.prompt/request.input (generic)."
|
|
2039
|
+
};
|
|
2040
|
+
}
|
|
2041
|
+
const prompt = derivePrompt(request) ?? (typeof input === "string" ? input : "[structured input]");
|
|
2042
|
+
const output = extractOutput(rawResponse);
|
|
2043
|
+
if (output === null) {
|
|
2044
|
+
return {
|
|
2045
|
+
ok: false,
|
|
2046
|
+
reason: "Could not extract output text. Expected response.choices[0].message.content (OpenAI/Mistral), response.content[0].text (Anthropic), response.candidates[0].content.parts[0].text (Gemini), or response.text / response.output_text (generic)."
|
|
2047
|
+
};
|
|
2048
|
+
}
|
|
2049
|
+
const parameters = extractParams(request);
|
|
2050
|
+
return {
|
|
2051
|
+
ok: true,
|
|
2052
|
+
data: {
|
|
2053
|
+
model: modelResult.model,
|
|
2054
|
+
modelVersion: modelResult.modelVersion,
|
|
2055
|
+
prompt,
|
|
2056
|
+
input,
|
|
2057
|
+
output,
|
|
2058
|
+
parameters
|
|
2059
|
+
}
|
|
2060
|
+
};
|
|
2061
|
+
}
|
|
2062
|
+
|
|
2063
|
+
// src/certifyFromProvider.ts
|
|
2064
|
+
function certifyDecisionFromProviderCall(params) {
|
|
2065
|
+
const extracted = extractFromProviderCall(
|
|
2066
|
+
params.provider,
|
|
2067
|
+
params.model,
|
|
2068
|
+
params.request,
|
|
2069
|
+
params.response
|
|
2070
|
+
);
|
|
2071
|
+
if (!extracted.ok) {
|
|
2072
|
+
return { ok: false, code: CerVerifyCode.SCHEMA_ERROR, reason: extracted.reason };
|
|
2073
|
+
}
|
|
2074
|
+
const { model, modelVersion, prompt, input, output, parameters } = extracted.data;
|
|
2075
|
+
try {
|
|
2076
|
+
const snapshot = createSnapshot({
|
|
2077
|
+
executionId: params.executionId ?? crypto5.randomUUID(),
|
|
2078
|
+
timestamp: params.timestamp,
|
|
2079
|
+
provider: params.provider,
|
|
2080
|
+
model,
|
|
2081
|
+
modelVersion,
|
|
2082
|
+
prompt,
|
|
2083
|
+
input,
|
|
2084
|
+
parameters,
|
|
2085
|
+
output,
|
|
2086
|
+
appId: params.appId ?? null,
|
|
2087
|
+
workflowId: params.workflowId ?? null,
|
|
2088
|
+
conversationId: params.conversationId ?? null
|
|
2089
|
+
});
|
|
2090
|
+
const bundle = sealCer(snapshot, { meta: params.meta, createdAt: params.createdAt });
|
|
2091
|
+
return { ok: true, bundle };
|
|
2092
|
+
} catch (err2) {
|
|
2093
|
+
return {
|
|
2094
|
+
ok: false,
|
|
2095
|
+
code: CerVerifyCode.SCHEMA_ERROR,
|
|
2096
|
+
reason: err2 instanceof Error ? err2.message : String(err2)
|
|
2097
|
+
};
|
|
2098
|
+
}
|
|
2099
|
+
}
|
|
2100
|
+
|
|
2101
|
+
// src/client.ts
|
|
2102
|
+
async function resolveApiKey(key) {
|
|
2103
|
+
if (typeof key === "function") return key();
|
|
2104
|
+
return key ?? "";
|
|
2105
|
+
}
|
|
2106
|
+
function mergeDefaultMeta(defaults, meta) {
|
|
2107
|
+
const base = {};
|
|
2108
|
+
if (defaults.tags && defaults.tags.length > 0) base.tags = defaults.tags;
|
|
2109
|
+
if (defaults.source) base.source = defaults.source;
|
|
2110
|
+
if (!meta && Object.keys(base).length === 0) return void 0;
|
|
2111
|
+
return { ...base, ...meta };
|
|
2112
|
+
}
|
|
2113
|
+
function createClient(defaults = {}) {
|
|
2114
|
+
return {
|
|
2115
|
+
certifyDecision(params) {
|
|
2116
|
+
return certifyDecision({
|
|
2117
|
+
appId: defaults.appId ?? null,
|
|
2118
|
+
workflowId: defaults.workflowId ?? null,
|
|
2119
|
+
...params,
|
|
2120
|
+
meta: mergeDefaultMeta(defaults, params.meta)
|
|
2121
|
+
});
|
|
2122
|
+
},
|
|
2123
|
+
async certifyAndAttestDecision(params, options) {
|
|
2124
|
+
const nodeUrl = options?.nodeUrl ?? defaults.nodeUrl;
|
|
2125
|
+
if (!nodeUrl) {
|
|
2126
|
+
throw new Error("certifyAndAttestDecision requires nodeUrl (set in defaults or options)");
|
|
2127
|
+
}
|
|
2128
|
+
const apiKey = options?.apiKey ?? await resolveApiKey(defaults.apiKey);
|
|
2129
|
+
const mergedParams = {
|
|
2130
|
+
appId: defaults.appId ?? null,
|
|
2131
|
+
workflowId: defaults.workflowId ?? null,
|
|
2132
|
+
...params,
|
|
2133
|
+
meta: mergeDefaultMeta(defaults, params.meta)
|
|
2134
|
+
};
|
|
2135
|
+
return certifyAndAttestDecision(mergedParams, {
|
|
2136
|
+
nodeUrl,
|
|
2137
|
+
apiKey,
|
|
2138
|
+
timeoutMs: options?.timeoutMs
|
|
2139
|
+
});
|
|
2140
|
+
},
|
|
2141
|
+
verify(bundle) {
|
|
2142
|
+
return verifyCer(bundle);
|
|
2143
|
+
},
|
|
2144
|
+
async verifyBundleAttestation(bundle, options) {
|
|
2145
|
+
const nodeUrl = options?.nodeUrl ?? defaults.nodeUrl;
|
|
2146
|
+
if (!nodeUrl) {
|
|
2147
|
+
throw new Error("verifyBundleAttestation requires nodeUrl (set in defaults or options)");
|
|
2148
|
+
}
|
|
2149
|
+
return verifyBundleAttestation(bundle, { nodeUrl, kid: options?.kid });
|
|
2150
|
+
}
|
|
2151
|
+
};
|
|
2152
|
+
}
|
|
746
2153
|
// Annotate the CommonJS export names for ESM import in node:
|
|
747
2154
|
0 && (module.exports = {
|
|
748
2155
|
CerAttestationError,
|
|
@@ -753,22 +2160,38 @@ async function attestIfNeeded(bundle, options) {
|
|
|
753
2160
|
attestIfNeeded,
|
|
754
2161
|
certifyAndAttestDecision,
|
|
755
2162
|
certifyDecision,
|
|
2163
|
+
certifyDecisionFromProviderCall,
|
|
756
2164
|
computeInputHash,
|
|
757
2165
|
computeOutputHash,
|
|
2166
|
+
createClient,
|
|
758
2167
|
createSnapshot,
|
|
759
2168
|
exportCer,
|
|
2169
|
+
fetchNodeKeys,
|
|
760
2170
|
getAttestationReceipt,
|
|
761
2171
|
hasAttestation,
|
|
762
2172
|
hashCanonicalJson,
|
|
763
2173
|
hashUtf8,
|
|
764
2174
|
importCer,
|
|
765
2175
|
sanitizeForAttestation,
|
|
2176
|
+
sanitizeForStamp,
|
|
2177
|
+
sanitizeForStorage,
|
|
766
2178
|
sealCer,
|
|
2179
|
+
selectNodeKey,
|
|
767
2180
|
sha256Hex,
|
|
768
2181
|
toCanonicalJson,
|
|
769
2182
|
verify,
|
|
2183
|
+
verifyBundleAttestation,
|
|
770
2184
|
verifyCer,
|
|
2185
|
+
verifyNodeReceiptSignature,
|
|
771
2186
|
verifySnapshot,
|
|
772
2187
|
wrapProvider
|
|
773
2188
|
});
|
|
2189
|
+
/*! Bundled license information:
|
|
2190
|
+
|
|
2191
|
+
@noble/ed25519/index.js:
|
|
2192
|
+
(*! noble-ed25519 - MIT License (c) 2019 Paul Miller (paulmillr.com) *)
|
|
2193
|
+
|
|
2194
|
+
@noble/hashes/esm/utils.js:
|
|
2195
|
+
(*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
2196
|
+
*/
|
|
774
2197
|
//# sourceMappingURL=index.cjs.map
|