@t2000/sdk 5.20.0 → 5.21.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/dist/index.cjs CHANGED
@@ -2030,7 +2030,8 @@ async function listModels(opts) {
2030
2030
  contextWindow: m.context_window ?? m.context_length,
2031
2031
  inputPer1M: m.pricing?.input_per_1m ?? m.pricing?.prompt,
2032
2032
  outputPer1M: m.pricing?.output_per_1m ?? m.pricing?.completion,
2033
- privacy: m.privacy ?? m.privacy_tier
2033
+ privacy: m.privacy ?? m.privacy_tier,
2034
+ reasoning: m.reasoning
2034
2035
  }));
2035
2036
  }
2036
2037
  var RECEIPT_ANCHORED_SUFFIX = "::anchor::ReceiptAnchored";
@@ -2139,7 +2140,15 @@ async function verifyTdxQuote(base, model, receiptWorkloadId) {
2139
2140
  };
2140
2141
  }
2141
2142
  try {
2142
- const { getCollateralAndVerify } = await import('@phala/dcap-qvl');
2143
+ const dcap = await import('@phala/dcap-qvl');
2144
+ const getCollateralAndVerify = dcap.getCollateralAndVerify ?? dcap.default?.getCollateralAndVerify;
2145
+ if (typeof getCollateralAndVerify !== "function") {
2146
+ return {
2147
+ status: "fail",
2148
+ forged: false,
2149
+ detail: "DCAP verifier unavailable in this build"
2150
+ };
2151
+ }
2143
2152
  const quoteBytes = utils$1.hexToBytes(quoteHex.replace(/^0x/, ""));
2144
2153
  const vr = await getCollateralAndVerify(quoteBytes);
2145
2154
  const td = vr.report.asTd10() ?? vr.report.asTd15()?.base ?? null;
@@ -2265,7 +2274,6 @@ async function verifyReceipt(receiptId, opts = {}) {
2265
2274
  });
2266
2275
  }
2267
2276
  }
2268
- let signatureForged = false;
2269
2277
  let sigStatus = "skip";
2270
2278
  let sigDetail = "no signature on receipt";
2271
2279
  if (receipt.signature?.value) {
@@ -2282,7 +2290,6 @@ async function verifyReceipt(receiptId, opts = {}) {
2282
2290
  } else {
2283
2291
  const ok = verifyReceiptSignature(receipt, att.signingKey);
2284
2292
  sigStatus = ok ? "pass" : "fail";
2285
- signatureForged = !ok;
2286
2293
  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
2294
  }
2288
2295
  } catch {
@@ -2295,7 +2302,6 @@ async function verifyReceipt(receiptId, opts = {}) {
2295
2302
  detail: sigDetail,
2296
2303
  trust: sigStatus === "skip" ? "roadmap" : "trustless"
2297
2304
  });
2298
- let quoteForged = false;
2299
2305
  if (opts.skipQuote) {
2300
2306
  checks.push({
2301
2307
  name: "TDX quote (DCAP)",
@@ -2309,7 +2315,6 @@ async function verifyReceipt(receiptId, opts = {}) {
2309
2315
  opts.model ?? "phala/glm-5.2",
2310
2316
  workloadId ?? ""
2311
2317
  );
2312
- quoteForged = q.forged;
2313
2318
  checks.push({
2314
2319
  name: "TDX quote (DCAP)",
2315
2320
  status: q.status,
@@ -2317,9 +2322,12 @@ async function verifyReceipt(receiptId, opts = {}) {
2317
2322
  trust: "trustless"
2318
2323
  });
2319
2324
  }
2325
+ const trustlessFailed = checks.some(
2326
+ (c) => c.trust === "trustless" && c.status === "fail"
2327
+ );
2320
2328
  return {
2321
2329
  receiptId,
2322
- verified: Boolean(wireHash && workloadId) && anchorVerified && !signatureForged && !quoteForged,
2330
+ verified: Boolean(wireHash && workloadId) && !trustlessFailed,
2323
2331
  anchorVerified,
2324
2332
  checks,
2325
2333
  wireHash,