@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.cjs CHANGED
@@ -6237,9 +6237,14 @@ async function recoveryAttestationNonce(cluster, node) {
6237
6237
  new DataView(id.buffer).setBigUint64(0, BigInt(node), false);
6238
6238
  return hex(await sha2564(concat(utf85("calimero.recovery-backup.attest.v1\0"), len, name, id)));
6239
6239
  }
6240
- async function receiptKeyBinding(receiptKey, governance) {
6240
+ async function receiptKeyBinding(receiptKey, governance, cluster, node) {
6241
6241
  const g = await sha2564(utf85(JSON.stringify(governance)));
6242
- return hex(await sha2564(concat(utf85("calimero.tee-attest.receipt-key.v2"), receiptKey, g)));
6242
+ const name = utf85(cluster);
6243
+ const len = new Uint8Array(4);
6244
+ new DataView(len.buffer).setUint32(0, name.length, false);
6245
+ const id = new Uint8Array(8);
6246
+ new DataView(id.buffer).setBigUint64(0, BigInt(node), false);
6247
+ return hex(await sha2564(concat(utf85("calimero.tee-attest.receipt-key.v3"), receiptKey, g, len, name, id)));
6243
6248
  }
6244
6249
  async function verifyRecoveryAttestation(header, verifyQuote) {
6245
6250
  const doc = header.attestation;
@@ -6252,7 +6257,12 @@ async function verifyRecoveryAttestation(header, verifyQuote) {
6252
6257
  }
6253
6258
  const nonce2 = await recoveryAttestationNonce(header.cluster, header.node);
6254
6259
  if (doc.nonce !== nonce2) throw new Error("the attestation is not over the recovery nonce");
6255
- const reportDataSuffix = await receiptKeyBinding(fromHex(header.signingKey, "signing key", 32), doc.governance);
6260
+ const reportDataSuffix = await receiptKeyBinding(
6261
+ fromHex(header.signingKey, "signing key", 32),
6262
+ doc.governance,
6263
+ header.cluster,
6264
+ header.node
6265
+ );
6256
6266
  const ok = await verifyQuote({ quoteB64: doc.quote, nonce: nonce2, reportDataSuffix });
6257
6267
  if (!ok) throw new Error("the quote was not accepted");
6258
6268
  }