Module: ChatworkWebhookVerify::ControllerExtension
- Defined in:
- lib/chatwork_webhook_verify/controller_extension.rb
Instance Method Summary collapse
Instance Method Details
#verify_chatwork_webhook_signature!(token = nil) ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'lib/chatwork_webhook_verify/controller_extension.rb', line 6 def verify_chatwork_webhook_signature!(token = nil) ChatworkWebhookVerify.verify!( token: token, body: request.env["rack.input"].read, signature: request.headers["X-ChatWorkWebhookSignature"] || params[:chatwork_webhook_signature], ) rescue ChatworkWebhookVerify::InvalidSignatureError, ::ArgumentError raise ActionController::BadRequest, "signature is invalid" end |