{"id":18821150,"url":"https://github.com/compwright/x-hub-signature","last_synced_at":"2025-04-14T00:26:47.840Z","repository":{"id":26220654,"uuid":"107689787","full_name":"compwright/x-hub-signature","owner":"compwright","description":"X-Hub-Signature signer for Node.js","archived":false,"fork":false,"pushed_at":"2024-09-26T21:09:48.000Z","size":1623,"stargazers_count":12,"open_issues_count":1,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-27T14:47:44.664Z","etag":null,"topics":["webhook"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/x-hub-signature","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/compwright.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"compwright"}},"created_at":"2017-10-20T14:43:32.000Z","updated_at":"2024-09-26T21:09:45.000Z","dependencies_parsed_at":"2023-01-14T04:13:48.232Z","dependency_job_id":"a6f54228-d032-40cf-97d8-555528db0a48","html_url":"https://github.com/compwright/x-hub-signature","commit_stats":{"total_commits":39,"total_committers":4,"mean_commits":9.75,"dds":0.5128205128205128,"last_synced_commit":"b683262335f0292ec908d9a79db53f7bb87b23cf"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/compwright%2Fx-hub-signature","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/compwright%2Fx-hub-signature/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/compwright%2Fx-hub-signature/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/compwright%2Fx-hub-signature/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/compwright","download_url":"https://codeload.github.com/compwright/x-hub-signature/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248782260,"owners_count":21160717,"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":["webhook"],"created_at":"2024-11-08T00:34:38.422Z","updated_at":"2025-04-14T00:26:47.816Z","avatar_url":"https://github.com/compwright.png","language":"JavaScript","funding_links":["https://github.com/sponsors/compwright"],"categories":[],"sub_categories":[],"readme":"# X-Hub-Signature tools for Node.js\n\n[![Build Status](https://app.travis-ci.com/compwright/x-hub-signature.svg?branch=master)](https://app.travis-ci.com/github/compwright/x-hub-signature)\n[![Download Status](https://img.shields.io/npm/dm/x-hub-signature.svg?style=flat-square)](https://www.npmjs.com/package/x-hub-signature)\n[![Sponsor on GitHub](https://img.shields.io/static/v1?label=Sponsor\u0026message=❤\u0026logo=GitHub\u0026link=https://github.com/sponsors/compwright)](https://github.com/sponsors/compwright)\n\nX-Hub-Signature is a compact way to validate webhooks from [Facebook](https://developers.facebook.com/docs/graph-api/webhooks/), [GitHub](https://developer.github.com/webhooks/securing/), or any other source that uses this signature scheme.\n\nRequires Node.js 16+\n\n\u003e The Express middleware that was included in this package in v1.x has been moved to a separate package. See [x-hub-signature-middleware](https://github.com/compwright/x-hub-signature-middleware).\n\n## Getting Started\n\nTo install:\n\n```shell\nnpm install x-hub-signature --save\n```\n\n## Usage\n\nSign a buffer containing a request body:\n\n```javascript\nimport XHubSignature from 'x-hub-signature';\nconst x = new XHubSignature('sha1', 'my_little_secret');\nconst signature = x.sign(new Buffer('body-to-sign'));\n// sha1=3dca279e731c97c38e3019a075dee9ebbd0a99f0\n```\n\n## XHubSignature\n\n### constructor(algorithm, secret)\n\n* `algorithm` (required) - `sha1` or other desired signing algorithm\n* `secret` (required) - signing secret that the webhook was signed with\n\nCreates an XHubSignature instance.\n\n### sign(requestBody)\n\n* `requestBody` (required) - a string or Buffer containing the body of the request to sign\n\nReturns a string containing the value expected in the `X-Hub-Signature` header.\n\n### verify(expectedSignature, requestBody)\n\n* `expectedSignature` (required) - a string containing the `X-Hub-Signature` header value for an incoming request\n* `requestBody` (required) - a string or Buffer containing the body of the incoming request\n\nReturns `true` if the signature is valid, or false if it is invalid.\n\n## License\n\nMIT License\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcompwright%2Fx-hub-signature","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcompwright%2Fx-hub-signature","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcompwright%2Fx-hub-signature/lists"}