Method: Webhookdb::WebhookResponse.for_standard_secret
- Defined in:
- lib/webhookdb/webhook_response.rb
.for_standard_secret(request, webhook_secret, ok_status: 202) ⇒ Webhookdb::WebhookResponse
Compare the value of the SECRET_HEADER_RACK in the request header.
15 16 17 18 19 20 21 |
# File 'lib/webhookdb/webhook_response.rb', line 15 def self.for_standard_secret(request, webhook_secret, ok_status: 202) hdr_secret = request.env[SECRET_HEADER_RACK] return self.error("missing secret header") if hdr_secret.nil? matches = ActiveSupport::SecurityUtils.secure_compare(webhook_secret, hdr_secret) return self.error("secret mismatch") unless matches return self.ok(status: ok_status) end |