Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export async function checkSignature(ctx, next) {
const signature = ctx.request.headers['x-line-signature'];
if (!validateSignature(ctx.rawBody, SECRET, signature)) {
ctx.status = 401;
ctx.body = 'x-line-signature and hash does not match';
rollbar.warning(ctx.body, ctx.request, {
signature,
});
} else {
return next();
}
}