@calimero-network/mero-js 33.3.0 → 33.3.2

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
@@ -6071,9 +6071,14 @@ async function recoveryAttestationNonce(cluster, node) {
6071
6071
  new DataView(id.buffer).setBigUint64(0, BigInt(node), false);
6072
6072
  return hex(await sha2564(concat(utf85("calimero.recovery-backup.attest.v1\0"), len, name, id)));
6073
6073
  }
6074
- async function receiptKeyBinding(receiptKey, governance) {
6074
+ async function receiptKeyBinding(receiptKey, governance, cluster, node) {
6075
6075
  const g = await sha2564(utf85(JSON.stringify(governance)));
6076
- return hex(await sha2564(concat(utf85("calimero.tee-attest.receipt-key.v2"), receiptKey, g)));
6076
+ const name = utf85(cluster);
6077
+ const len = new Uint8Array(4);
6078
+ new DataView(len.buffer).setUint32(0, name.length, false);
6079
+ const id = new Uint8Array(8);
6080
+ new DataView(id.buffer).setBigUint64(0, BigInt(node), false);
6081
+ return hex(await sha2564(concat(utf85("calimero.tee-attest.receipt-key.v3"), receiptKey, g, len, name, id)));
6077
6082
  }
6078
6083
  async function verifyRecoveryAttestation(header, verifyQuote) {
6079
6084
  const doc = header.attestation;
@@ -6086,7 +6091,12 @@ async function verifyRecoveryAttestation(header, verifyQuote) {
6086
6091
  }
6087
6092
  const nonce2 = await recoveryAttestationNonce(header.cluster, header.node);
6088
6093
  if (doc.nonce !== nonce2) throw new Error("the attestation is not over the recovery nonce");
6089
- const reportDataSuffix = await receiptKeyBinding(fromHex(header.signingKey, "signing key", 32), doc.governance);
6094
+ const reportDataSuffix = await receiptKeyBinding(
6095
+ fromHex(header.signingKey, "signing key", 32),
6096
+ doc.governance,
6097
+ header.cluster,
6098
+ header.node
6099
+ );
6090
6100
  const ok = await verifyQuote({ quoteB64: doc.quote, nonce: nonce2, reportDataSuffix });
6091
6101
  if (!ok) throw new Error("the quote was not accepted");
6092
6102
  }