Skip to content

Commit

Permalink
Fix regex usage
Browse files Browse the repository at this point in the history
  • Loading branch information
r-n-o committed May 9, 2024
1 parent 0aba476 commit a42ce6f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion export/index.template.html
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,12 @@ <h2>Message log</h2>
throw new Error(`unable to find signed data in bundle: ${bundle}`);
}

verified = await TKHQ.verifyEnclaveSignature(bundleObj.enclaveQuorumPublic, bundleObj.dataSignature, signedData + "}");
// We add the closing brace back: it was our marker for the end of the group in the regex above, hence not captured.
const signedDataBytes = new TextEncoder().encode(signedData[1] + "}");
// Encode these bytes to hex since verifyEnclaveSignature expects hex-encoded bytes
const signedDataHexString = TKHQ.uint8arrayToHexString(signedDataBytes);

verified = await TKHQ.verifyEnclaveSignature(bundleObj.enclaveQuorumPublic, bundleObj.dataSignature, signedDataHexString);
if (!verified) {
throw new Error(`failed to verify enclave signature: ${bundle}`);
}
Expand Down

0 comments on commit a42ce6f

Please sign in to comment.