Hi,
I need some custom code to generate a signature for an API authorisation , and the code works fine on VSCode under javascript, generated the correct signature when tested. However, the same code runs into error when I put them in the toolbox plugin, the error message is:
“Bug in custom code eval code@
eval@[native code]
@
at root (undefined:1:23)”
Anyone encountered similar issue before?
the javascript box is visible on page load.
The code:
function generateHmacSha1SignatureBase64(text, secretKey) {
const hmac = crypto.createHmac('sha1', secretKey);
hmac.update(text);
const signature = hmac.digest('base64');
return signature;
}
const textToSign = '2024-01-15 21:48:14[access key]GET/activity.json/[id]/availabilities?start=2024-01-15&end=2024-01-15&includeSoldOut=false';
const secretKey = '[secret key]';
const generatedSignatureBase64 = generateHmacSha1SignatureBase64(textToSign, secretKey);
bubble_fn_sig(generatedSignatureBase64)
Thank you!