How to use the @line/bot-sdk.validateSignature function in @line/bot-sdk

To help you get started, we’ve selected a few @line/bot-sdk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cofacts / rumors-line-bot / src / checkSignature.js View on Github external
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();
  }
}

@line/bot-sdk

Node.js SDK for LINE Messaging API

Apache-2.0
Latest version published 1 month ago

Package Health Score

90 / 100
Full package analysis