{"id":21820577,"url":"https://github.com/sue445/chatwork_webhook_verify","last_synced_at":"2025-04-14T02:53:31.163Z","repository":{"id":28575049,"uuid":"118620955","full_name":"sue445/chatwork_webhook_verify","owner":"sue445","description":"Verify ChatWork webhook signature","archived":false,"fork":false,"pushed_at":"2025-01-17T12:42:14.000Z","size":127,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-27T16:56:04.402Z","etag":null,"topics":["chatwork","webhook"],"latest_commit_sha":null,"homepage":"https://sue445.github.io/chatwork_webhook_verify","language":"Ruby","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/sue445.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"MIT-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":"2018-01-23T14:25:01.000Z","updated_at":"2025-01-17T12:42:16.000Z","dependencies_parsed_at":"2024-04-10T16:45:13.359Z","dependency_job_id":"c6850951-c352-41d7-b4db-9beb4d35ce92","html_url":"https://github.com/sue445/chatwork_webhook_verify","commit_stats":{"total_commits":100,"total_committers":3,"mean_commits":"33.333333333333336","dds":0.13,"last_synced_commit":"a8e82f178d992ee57449c62b875b07391b1f4d26"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sue445%2Fchatwork_webhook_verify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sue445%2Fchatwork_webhook_verify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sue445%2Fchatwork_webhook_verify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sue445%2Fchatwork_webhook_verify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sue445","download_url":"https://codeload.github.com/sue445/chatwork_webhook_verify/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248643042,"owners_count":21138353,"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":["chatwork","webhook"],"created_at":"2024-11-27T16:37:46.868Z","updated_at":"2025-04-14T02:53:31.157Z","avatar_url":"https://github.com/sue445.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ChatworkWebhookVerify\nVerify ChatWork webhook signature\n\n[![Gem Version](https://badge.fury.io/rb/chatwork_webhook_verify.svg)](https://badge.fury.io/rb/chatwork_webhook_verify)\n[![test](https://github.com/sue445/chatwork_webhook_verify/actions/workflows/test.yml/badge.svg)](https://github.com/sue445/chatwork_webhook_verify/actions/workflows/test.yml)\n[![Maintainability](https://api.codeclimate.com/v1/badges/d7ea5e910c29987c7c0e/maintainability)](https://codeclimate.com/github/sue445/chatwork_webhook_verify/maintainability)\n[![Coverage Status](https://coveralls.io/repos/github/sue445/chatwork_webhook_verify/badge.svg?branch=master)](https://coveralls.io/github/sue445/chatwork_webhook_verify?branch=master)\n\n## Installation\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'chatwork_webhook_verify'\n```\n\nAnd then execute:\n```bash\n$ bundle\n```\n\nOr install it yourself as:\n```bash\n$ gem install chatwork_webhook_verify\n```\n\n## Basic usage\n```ruby\nChatworkWebhookVerify.verify?(token: token, body: body, signature: signature)\n#=\u003e true | false\n```\n\nor \n\n```ruby\nChatworkWebhookVerify.verify!(token: token, body: body, signature: signature)\n#=\u003e raise ChatworkWebhookVerify::InvalidSignatureError if signature is invalid\n```\n\n* `token` : webhook token (default: `ChatworkWebhookVerify.config.token`)\n  * Either `token` or `ChatworkWebhookVerify.config.token` is required\n* `body` : request body from webhook\n* `signature` : `chatwork_webhook_signature` (query string) or `X-ChatWorkWebhookSignature` (request header)\n\n## for Rails\ncall `verify_chatwork_webhook_signature!` in your controller\n\n### Example 1\n```ruby\n# config/initializers/chatwork_webhook_verify.rb\nChatworkWebhookVerify.config.token = ENV[\"CHATWORK_WEBHOOK_TOKEN\"]\n```\n\n```ruby\n# app/controllers/webhook_controller.rb\nclass WebhookController \u003c ApplicationController\n  # `ChatworkWebhookVerify.config.token` is used\n  before_action :verify_chatwork_webhook_signature!\nend\n```\n\n### Example 2\n```ruby\n# app/controllers/webhook_controller.rb\nclass WebhookController \u003c ApplicationController\n  before_action :verify_chatwork_webhook_signature_with_own_token!\n  \n  def verify_chatwork_webhook_signature_with_own_token!\n    verify_chatwork_webhook_signature!(\"another_token\")\n  end\nend\n```\n\n## for Sinatra\n```ruby\n# app.rb\nclass App \u003c Sinatra::Base\n  before \"/webhook\" do\n    token     = ENV[\"CHATWORK_WEBHOOK_TOKEN\"]\n    body      = request.body.read\n    signature = request.env[\"HTTP_X_CHATWORKWEBHOOKSIGNATURE\"]\n\n    ChatworkWebhookVerify.verify!(token: token, body: body, signature: signature)\n  end\n\n  post \"/webhook\" do\n    \"ok\"\n  end\nend\n```\n\n## Configuration\n```ruby\nChatworkWebhookVerify.config.token = ENV[\"CHATWORK_WEBHOOK_TOKEN\"]\n```\n\n* `token` : default webhook token\n\n## Contributing\nContribution directions go here.\n\n## License\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsue445%2Fchatwork_webhook_verify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsue445%2Fchatwork_webhook_verify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsue445%2Fchatwork_webhook_verify/lists"}