{"id":20839630,"url":"https://github.com/chec/webhook-verifier","last_synced_at":"2025-05-12T01:30:24.847Z","repository":{"id":45395528,"uuid":"421159459","full_name":"chec/webhook-verifier","owner":"chec","description":"A lightweight tool for verifying the validity of webhook payloads","archived":true,"fork":false,"pushed_at":"2021-12-16T01:21:55.000Z","size":140,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-12T10:11:21.289Z","etag":null,"topics":["commercejs","webhooks"],"latest_commit_sha":null,"homepage":"https://commercejs.com","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chec.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-10-25T19:32:40.000Z","updated_at":"2024-10-09T14:32:07.000Z","dependencies_parsed_at":"2022-09-19T10:20:27.437Z","dependency_job_id":null,"html_url":"https://github.com/chec/webhook-verifier","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chec%2Fwebhook-verifier","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chec%2Fwebhook-verifier/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chec%2Fwebhook-verifier/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chec%2Fwebhook-verifier/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chec","download_url":"https://codeload.github.com/chec/webhook-verifier/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253659137,"owners_count":21943605,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["commercejs","webhooks"],"created_at":"2024-11-18T01:14:03.275Z","updated_at":"2025-05-12T01:30:24.480Z","avatar_url":"https://github.com/chec.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eWebhook verifier\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n\tA lightweight JavaScript tool for verifying the validity of incoming webhook payloads from the Chec API. This script\n\tis designed to run in a Node.js context, e.g. a serverless function/Lambda.\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\t\u003ca href=\"https://github.com/chec/webhook-verifier/actions\"\u003e\n\t\t\u003cimg src=\"https://github.com/github/docs/actions/workflows/test.yml/badge.svg\" alt=\"CI status\" /\u003e\n\t\u003c/a\u003e\n\t\u003ca href=\"https://npmjs.org/package/@chec/webhook-verifier\"\u003e\n\t\t\u003cimg src=\"https://img.shields.io/npm/v/@chec/webhook-verifier.svg\" alt=\"Version\" /\u003e\n\t\u003c/a\u003e\n\t\u003ca href=\"https://npmjs.org/package/@chec/webhook-verifier\"\u003e\n\t\t\u003cimg src=\"https://img.shields.io/npm/dw/@chec/webhook-verifier.svg\" alt=\"Downloads/week\" /\u003e\n\t\u003c/a\u003e\n\t\u003ca href=\"https://github.com/chec/webhook-verifier/blob/master/package.json\"\u003e\n\t\t\u003cimg src=\"https://img.shields.io/npm/l/@chec/webhook-verifier.svg\" alt=\"License\" /\u003e\n\t\u003c/a\u003e\n\t\u003cbr\u003e\n\t\u003ca href=\"https://commercejs.com\"\u003ecommercejs.com\u003c/a\u003e | \u003ca href=\"https://twitter.com/commercejs\"\u003e@commercejs\u003c/a\u003e | \u003ca href=\"http://slack.commercejs.com\"\u003eSlack\u003c/a\u003e\n\u003c/p\u003e\n\n## Installation\n\n```\nnpm install @chec/webhook-verifier\n# or\nyarn add @chec/webhook-verifier\n```\n\n## Usage\n\nImport `verifyWebhook` and use it at the start of your handler method. Provide your Chec webhook signing key as the\nsecond argument (available in your [Chec Dashboard](https://dashboard.chec.io/settings/webhooks)):\n\n```js\nimport { verifyWebhook } from '@chec/webhook-verifier';\n\nmodule.exports = function (request) {\n    verifyWebhook(request, process.env.CHEC_WEBHOOK_SIGNING_KEY);\n\n    // ... continue with your logic\n}\n```\n\nThe `verifyWebhook` method signature is:\n```ts\ninterface Payload {\n    signature?: string,\n    created: number,\n}\n\nexport function verifyWebhook(data: Payload, signingKey: string, maxAgeSeconds: number = 300): void {\n    // ...\n}\n```\n\nThe `verifyWebhook` method will throw an error if any checks fail:\n* The webhook signature is missing, or the signing key is missing\n* The webhook signature was invalid\n* The request is older than 5 minutes (by default)\n\n## License\n\nThis repository is available under a [BSD-3-Clause license](./LICENSE.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchec%2Fwebhook-verifier","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchec%2Fwebhook-verifier","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchec%2Fwebhook-verifier/lists"}