Sha256: 35f62cab06b657d354d15efb2a7f6a9913a0725af0a48ec31155bcdf185b16ee
Contents?: true
Size: 678 Bytes
Versions: 7
Compression:
Stored size: 678 Bytes
Contents
module GotFixed module Receivers class GithubWebhook HMAC_DIGEST = OpenSSL::Digest::Digest.new('sha1') class SignatureError < StandardError; end def initialize(options = {}) @secret = options[:secret] end # Incoming request: # https://github.com/github/github-services/blob/14f4da01ce29bc6a02427a9fbf37b08b141e81d9/lib/services/web.rb#L48 def check_hub_signature!(header, body) expected_signature = "sha1=#{OpenSSL::HMAC.hexdigest(HMAC_DIGEST, @secret, body)}" if header != expected_signature raise SignatureError.new "#{header} != #{expected_signature}" end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems