@calimero-network/mero-js 24.7.0 → 25.0.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.mjs CHANGED
@@ -6562,6 +6562,9 @@ function createQuoteVerifier(options) {
6562
6562
  throw new Error(`The platform's TCB status is ${verified.status}, which is not accepted`);
6563
6563
  }
6564
6564
  const td = tdReport(verified.report);
6565
+ if (td.tdAttributes?.length !== 8 || (td.tdAttributes[0] & 1) !== 0) {
6566
+ throw new Error("The quote is from a debug TD, or its TD attributes cannot be read");
6567
+ }
6565
6568
  const measured = [td.mrTd, td.rtMr0, td.rtMr1, td.rtMr2, td.rtMr3].map((register) => hex(register));
6566
6569
  if (allowedImages.length > 0 && !allowedImages.includes(measured.join())) {
6567
6570
  throw new Error(
@@ -6614,7 +6617,8 @@ var TCB_STATUSES = [
6614
6617
  "OutOfDate",
6615
6618
  "OutOfDateConfigurationNeeded"
6616
6619
  ];
6617
- function trustedMeasurementsFromReleases(releases, { profile }) {
6620
+ var PRODUCTION_PROFILE = "locked-read-only";
6621
+ function trustedMeasurementsFromReleases(releases, { profile, allowDebugProfile = false }) {
6618
6622
  if (releases.length === 0) {
6619
6623
  throw new Error("No release given, so no image would be trusted");
6620
6624
  }
@@ -6629,6 +6633,11 @@ function trustedMeasurementsFromReleases(releases, { profile }) {
6629
6633
  const known = Object.keys(release?.profiles ?? {}).join(", ") || "none";
6630
6634
  throw new Error(`${name} has no profile ${JSON.stringify(profile)} (it has: ${known})`);
6631
6635
  }
6636
+ if (profile !== PRODUCTION_PROFILE && !allowDebugProfile) {
6637
+ throw new Error(
6638
+ `${JSON.stringify(profile)} is not a production profile: its image is readable by whoever operates the node. Trust ${JSON.stringify(PRODUCTION_PROFILE)}, or pass allowDebugProfile to test`
6639
+ );
6640
+ }
6632
6641
  const accepted = (image.allowed_tcb_statuses ?? ["uptodate"]).map((status) => tcbStatus(status, name));
6633
6642
  statuses = statuses === void 0 ? accepted : statuses.filter((status) => accepted.includes(status));
6634
6643
  return {
@@ -7117,7 +7126,10 @@ async function trustSignedRelease(options) {
7117
7126
  if (compareReleaseVersions(version, minimum) < 0) {
7118
7127
  throw new Error(`Release ${version} is older than the minimum trusted, ${minimum}`);
7119
7128
  }
7120
- return trustedMeasurementsFromReleases([published], { profile: options.profile });
7129
+ return trustedMeasurementsFromReleases([published], {
7130
+ profile: options.profile,
7131
+ allowDebugProfile: options.allowDebugProfile
7132
+ });
7121
7133
  }
7122
7134
  function createSignedReleaseVerifier(options) {
7123
7135
  releaseVersion(options.minReleaseVersion, "minReleaseVersion");
@@ -7125,6 +7137,7 @@ function createSignedReleaseVerifier(options) {
7125
7137
  const trusted = await trustSignedRelease({
7126
7138
  release: await options.release(),
7127
7139
  profile: options.profile,
7140
+ allowDebugProfile: options.allowDebugProfile,
7128
7141
  minReleaseVersion: options.minReleaseVersion,
7129
7142
  identity: options.identity,
7130
7143
  issuer: options.issuer
@@ -12675,6 +12688,7 @@ export {
12675
12688
  NotForAccountError,
12676
12689
  OWNER_OP_KIND,
12677
12690
  PRESENCE_DOMAIN,
12691
+ PRODUCTION_PROFILE,
12678
12692
  RELAY_NODE_KEY_RETRY_MS,
12679
12693
  REQUEST_PROOF_HEADER,
12680
12694
  RelayClient,