{"id":13876137,"url":"https://github.com/quirrel-dev/secure-webhooks","last_synced_at":"2025-04-30T22:31:25.106Z","repository":{"id":36976816,"uuid":"295181285","full_name":"quirrel-dev/secure-webhooks","owner":"quirrel-dev","description":"Secure signature-based authentication helper for webhooks.","archived":false,"fork":false,"pushed_at":"2024-10-23T16:18:22.000Z","size":210,"stargazers_count":36,"open_issues_count":18,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-24T21:24:57.527Z","etag":null,"topics":["javascript","quirrel","webhooks"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/quirrel-dev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"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}},"created_at":"2020-09-13T15:34:37.000Z","updated_at":"2024-05-08T20:48:14.000Z","dependencies_parsed_at":"2024-02-14T01:29:41.695Z","dependency_job_id":"0dba3a7a-2fde-4759-bb9b-a92c17a0f1e4","html_url":"https://github.com/quirrel-dev/secure-webhooks","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quirrel-dev%2Fsecure-webhooks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quirrel-dev%2Fsecure-webhooks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quirrel-dev%2Fsecure-webhooks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quirrel-dev%2Fsecure-webhooks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/quirrel-dev","download_url":"https://codeload.github.com/quirrel-dev/secure-webhooks/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224225241,"owners_count":17276435,"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":["javascript","quirrel","webhooks"],"created_at":"2024-08-06T06:01:03.305Z","updated_at":"2024-11-12T06:07:15.939Z","avatar_url":"https://github.com/quirrel-dev.png","language":"TypeScript","funding_links":[],"categories":["TypeScript","javascript"],"sub_categories":[],"readme":"# secure-webhooks\n\nUseful for securing webhooks.\n\n## Usage\n\nOn the webhook sender:\n\n```ts\nimport { symmetric } from \"secure-webhooks\"\n\nconst secret = \"some shared secret\"\nconst payload = \"...\";\n\nconst signature = symmetric.sign(payload, secret);\n\nsendToWebhookReceiver({\n  body: payload,\n  headers: {\n    \"x-webhook-signature\": signature\n    ...\n  }\n})\n```\n\nOn the webhook receiver:\n\n```ts\nimport { symmetric } from \"secure-webhooks\"\n\nconst secret = \"some shared secret\" // the same as above\n\napp.post(\"/webhook-endpoint\", (req, res) =\u003e {\n  const isTrustWorthy = symmetric.verify(\n    req.body, // 👈 needs to be exactly the same as above, make sure to disable any body parsing for this route\n    secret,\n    req.headers[\"x-webhook-signature\"]\n  )\n\n  if (!isTrustWorthy) {\n    res.status(401).end(\"Not Authorized\")\n    return\n  }\n\n  ...\n})\n```\n\nSame works with asymmetric mode:\n\n```ts\nimport { asymmetric } from \"secure-webhooks\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquirrel-dev%2Fsecure-webhooks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fquirrel-dev%2Fsecure-webhooks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquirrel-dev%2Fsecure-webhooks/lists"}