From a42ce6fc09fc6c649c3f5e0d6e54b806aabde039 Mon Sep 17 00:00:00 2001 From: Arnaud Brousseau Date: Thu, 9 May 2024 12:25:10 -0500 Subject: [PATCH] Fix regex usage --- export/index.template.html | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/export/index.template.html b/export/index.template.html index d24c2a0..61d7a51 100644 --- a/export/index.template.html +++ b/export/index.template.html @@ -749,7 +749,12 @@

Message log

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}`); }