@t2000/sdk 5.20.0 → 5.20.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +13 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +13 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2139,7 +2139,15 @@ async function verifyTdxQuote(base, model, receiptWorkloadId) {
|
|
|
2139
2139
|
};
|
|
2140
2140
|
}
|
|
2141
2141
|
try {
|
|
2142
|
-
const
|
|
2142
|
+
const dcap = await import('@phala/dcap-qvl');
|
|
2143
|
+
const getCollateralAndVerify = dcap.getCollateralAndVerify ?? dcap.default?.getCollateralAndVerify;
|
|
2144
|
+
if (typeof getCollateralAndVerify !== "function") {
|
|
2145
|
+
return {
|
|
2146
|
+
status: "fail",
|
|
2147
|
+
forged: false,
|
|
2148
|
+
detail: "DCAP verifier unavailable in this build"
|
|
2149
|
+
};
|
|
2150
|
+
}
|
|
2143
2151
|
const quoteBytes = utils$1.hexToBytes(quoteHex.replace(/^0x/, ""));
|
|
2144
2152
|
const vr = await getCollateralAndVerify(quoteBytes);
|
|
2145
2153
|
const td = vr.report.asTd10() ?? vr.report.asTd15()?.base ?? null;
|
|
@@ -2265,7 +2273,6 @@ async function verifyReceipt(receiptId, opts = {}) {
|
|
|
2265
2273
|
});
|
|
2266
2274
|
}
|
|
2267
2275
|
}
|
|
2268
|
-
let signatureForged = false;
|
|
2269
2276
|
let sigStatus = "skip";
|
|
2270
2277
|
let sigDetail = "no signature on receipt";
|
|
2271
2278
|
if (receipt.signature?.value) {
|
|
@@ -2282,7 +2289,6 @@ async function verifyReceipt(receiptId, opts = {}) {
|
|
|
2282
2289
|
} else {
|
|
2283
2290
|
const ok = verifyReceiptSignature(receipt, att.signingKey);
|
|
2284
2291
|
sigStatus = ok ? "pass" : "fail";
|
|
2285
|
-
signatureForged = !ok;
|
|
2286
2292
|
sigDetail = ok ? `signed by the attested receipt key (${receipt.signature.key_id ?? "key"})` : "signature does NOT recover the attested receipt key \u2014 forged/altered";
|
|
2287
2293
|
}
|
|
2288
2294
|
} catch {
|
|
@@ -2295,7 +2301,6 @@ async function verifyReceipt(receiptId, opts = {}) {
|
|
|
2295
2301
|
detail: sigDetail,
|
|
2296
2302
|
trust: sigStatus === "skip" ? "roadmap" : "trustless"
|
|
2297
2303
|
});
|
|
2298
|
-
let quoteForged = false;
|
|
2299
2304
|
if (opts.skipQuote) {
|
|
2300
2305
|
checks.push({
|
|
2301
2306
|
name: "TDX quote (DCAP)",
|
|
@@ -2309,7 +2314,6 @@ async function verifyReceipt(receiptId, opts = {}) {
|
|
|
2309
2314
|
opts.model ?? "phala/glm-5.2",
|
|
2310
2315
|
workloadId ?? ""
|
|
2311
2316
|
);
|
|
2312
|
-
quoteForged = q.forged;
|
|
2313
2317
|
checks.push({
|
|
2314
2318
|
name: "TDX quote (DCAP)",
|
|
2315
2319
|
status: q.status,
|
|
@@ -2317,9 +2321,12 @@ async function verifyReceipt(receiptId, opts = {}) {
|
|
|
2317
2321
|
trust: "trustless"
|
|
2318
2322
|
});
|
|
2319
2323
|
}
|
|
2324
|
+
const trustlessFailed = checks.some(
|
|
2325
|
+
(c) => c.trust === "trustless" && c.status === "fail"
|
|
2326
|
+
);
|
|
2320
2327
|
return {
|
|
2321
2328
|
receiptId,
|
|
2322
|
-
verified: Boolean(wireHash && workloadId) &&
|
|
2329
|
+
verified: Boolean(wireHash && workloadId) && !trustlessFailed,
|
|
2323
2330
|
anchorVerified,
|
|
2324
2331
|
checks,
|
|
2325
2332
|
wireHash,
|