Hi Bubblers,
I’m trying to verify webhook from Lemonsqueezy. They provide a verification method with the nodejs code like this:
const crypto = require('crypto');
const secret = '[SIGNING_SECRET]';
const hmac = crypto.createHmac('sha256', secret);
const digest = Buffer.from(hmac.update(request.rawBody).digest('hex'), 'utf8');
const signature = Buffer.from(request.get('X-Signature') || '', 'utf8');
if (!crypto.timingSafeEqual(digest, signature)) {
throw new Error('Invalid signature.');
}
I’m trying to implement it with Bubble as the following:
Note: find&replace just find
/
and replace with \\/
But I have never gotten the right signature.
Does anyone have any experience with this? Thank you.