@calimero-network/mero-js 24.7.0 → 25.0.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.browser.mjs +2 -2
- package/dist/index.browser.mjs.map +3 -3
- package/dist/index.cjs +16 -2
- package/dist/index.cjs.map +2 -2
- package/dist/index.mjs +16 -2
- package/dist/index.mjs.map +2 -2
- package/dist/sealed/index.d.ts +2 -2
- package/dist/sealed/index.js +1 -1
- package/dist/sealed/release.d.ts +2 -4
- package/dist/sealed/release.js +5 -1
- package/dist/sealed/verify.d.ts +16 -2
- package/dist/sealed/verify.js +19 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -61,6 +61,7 @@ __export(index_exports, {
|
|
|
61
61
|
NotForAccountError: () => NotForAccountError,
|
|
62
62
|
OWNER_OP_KIND: () => OWNER_OP_KIND,
|
|
63
63
|
PRESENCE_DOMAIN: () => PRESENCE_DOMAIN,
|
|
64
|
+
PRODUCTION_PROFILE: () => PRODUCTION_PROFILE,
|
|
64
65
|
RELAY_NODE_KEY_RETRY_MS: () => RELAY_NODE_KEY_RETRY_MS,
|
|
65
66
|
REQUEST_PROOF_HEADER: () => REQUEST_PROOF_HEADER,
|
|
66
67
|
RelayClient: () => RelayClient,
|
|
@@ -6846,6 +6847,9 @@ function createQuoteVerifier(options) {
|
|
|
6846
6847
|
throw new Error(`The platform's TCB status is ${verified.status}, which is not accepted`);
|
|
6847
6848
|
}
|
|
6848
6849
|
const td = tdReport(verified.report);
|
|
6850
|
+
if (td.tdAttributes?.length !== 8 || (td.tdAttributes[0] & 1) !== 0) {
|
|
6851
|
+
throw new Error("The quote is from a debug TD, or its TD attributes cannot be read");
|
|
6852
|
+
}
|
|
6849
6853
|
const measured = [td.mrTd, td.rtMr0, td.rtMr1, td.rtMr2, td.rtMr3].map((register) => hex(register));
|
|
6850
6854
|
if (allowedImages.length > 0 && !allowedImages.includes(measured.join())) {
|
|
6851
6855
|
throw new Error(
|
|
@@ -6898,7 +6902,8 @@ var TCB_STATUSES = [
|
|
|
6898
6902
|
"OutOfDate",
|
|
6899
6903
|
"OutOfDateConfigurationNeeded"
|
|
6900
6904
|
];
|
|
6901
|
-
|
|
6905
|
+
var PRODUCTION_PROFILE = "locked-read-only";
|
|
6906
|
+
function trustedMeasurementsFromReleases(releases, { profile, allowDebugProfile = false }) {
|
|
6902
6907
|
if (releases.length === 0) {
|
|
6903
6908
|
throw new Error("No release given, so no image would be trusted");
|
|
6904
6909
|
}
|
|
@@ -6913,6 +6918,11 @@ function trustedMeasurementsFromReleases(releases, { profile }) {
|
|
|
6913
6918
|
const known = Object.keys(release?.profiles ?? {}).join(", ") || "none";
|
|
6914
6919
|
throw new Error(`${name} has no profile ${JSON.stringify(profile)} (it has: ${known})`);
|
|
6915
6920
|
}
|
|
6921
|
+
if (profile !== PRODUCTION_PROFILE && !allowDebugProfile) {
|
|
6922
|
+
throw new Error(
|
|
6923
|
+
`${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`
|
|
6924
|
+
);
|
|
6925
|
+
}
|
|
6916
6926
|
const accepted = (image.allowed_tcb_statuses ?? ["uptodate"]).map((status) => tcbStatus(status, name));
|
|
6917
6927
|
statuses = statuses === void 0 ? accepted : statuses.filter((status) => accepted.includes(status));
|
|
6918
6928
|
return {
|
|
@@ -7401,7 +7411,10 @@ async function trustSignedRelease(options) {
|
|
|
7401
7411
|
if (compareReleaseVersions(version, minimum) < 0) {
|
|
7402
7412
|
throw new Error(`Release ${version} is older than the minimum trusted, ${minimum}`);
|
|
7403
7413
|
}
|
|
7404
|
-
return trustedMeasurementsFromReleases([published], {
|
|
7414
|
+
return trustedMeasurementsFromReleases([published], {
|
|
7415
|
+
profile: options.profile,
|
|
7416
|
+
allowDebugProfile: options.allowDebugProfile
|
|
7417
|
+
});
|
|
7405
7418
|
}
|
|
7406
7419
|
function createSignedReleaseVerifier(options) {
|
|
7407
7420
|
releaseVersion(options.minReleaseVersion, "minReleaseVersion");
|
|
@@ -7409,6 +7422,7 @@ function createSignedReleaseVerifier(options) {
|
|
|
7409
7422
|
const trusted = await trustSignedRelease({
|
|
7410
7423
|
release: await options.release(),
|
|
7411
7424
|
profile: options.profile,
|
|
7425
|
+
allowDebugProfile: options.allowDebugProfile,
|
|
7412
7426
|
minReleaseVersion: options.minReleaseVersion,
|
|
7413
7427
|
identity: options.identity,
|
|
7414
7428
|
issuer: options.issuer
|