def valid?(request, integration, payload)
      return true unless integration.verify_payloads?

      secret = integration.secret
      if integration.gitlab
        secret == request.env['HTTP_X_GITLAB_TOKEN']
      else
        request_signature = request.env['HTTP_X_HUB_SIGNATURE']
        Cryptography.valid_signature?(payload, secret, request_signature)
      end
    end
def valid?(request, integration, payload)
      return true unless integration.verify_payloads?

      secret = integration.secret
      if integration.gitlab
        secret == request.env['HTTP_X_GITLAB_TOKEN']
      else
        request_signature = request.env['HTTP_X_HUB_SIGNATURE']
        Cryptography.valid_signature?(payload, secret, request_signature)
      end
    end
Verifies a webhook signature.

 @param request [Sinatra::Request] the request received by the web server
 @param integration [Integration] the integration for which the request
                                  was made
 @param payload [String] the payload that was sent to the endpoint
 @return [Boolean] whether the signature is valid