flexzuu / graphcms-utils

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

graphcms-utils

Install

npm i graphcms-utils

Usage

verifyWebhookSignature

const { verifyWebhookSignature } = require("graphcms-utils");

const secret = "rCNwyiloY3oJYYkxgpBXaleIiUv5MYlx";

const body = {}; // Typically req.body

const signature = verifyWebhookSignature({ body, secret });

generateWebhookSignature

This is useful for testing signed webhooks. You can generate a GraphCMS webhook signature, and then use it to test your webhook.

const { generateWebhookSignature } = require("graphcms-utils");

const secret = "rCNwyiloY3oJYYkxgpBXaleIiUv5MYlx";

const body = {
  hello: "world",
};

const signature = generateWebhookSignature({ body, secret });

About


Languages

Language:JavaScript 100.0%