lib/pusher/webhook.rb
def valid?(extra_tokens = nil)
      extra_tokens = [extra_tokens] if extra_tokens.kind_of?(Hash)
      if @key == @client.key
        return check_signature(@client.secret)
      elsif extra_tokens
        extra_tokens.each do |token|
          return check_signature(token[:secret]) if @key == token[:key]
        end
      end
      Pusher.logger.warn "Received webhook with unknown key: #{key}"
      return false
    end
# Returns whether the WebHook is valid by checking that the signature
# matches the configured key & secret. In the case that the webhook is
# invalid, the reason is logged
#
# @param extra_tokens [Hash] If you have extra tokens for your Pusher app, you can specify them so that they're used to attempt validation.
#
Returns whether the WebHook is valid by checking that the signature
matches the configured key & secret. In the case that the webhook is
invalid, the reason is logged
Returns whether the WebHook is valid by checking that the signature matches the configured key & secret . In the case that the webhook is invalid the reason is logged
def valid?(extra_tokens = nil)
      extra_tokens = [extra_tokens] if extra_tokens.kind_of?(Hash)
      if @key == @client.key
        return check_signature(@client.secret)
      elsif extra_tokens
        extra_tokens.each do |token|
          return check_signature(token[:secret]) if @key == token[:key]
        end
      end
      Pusher.logger.warn "Received webhook with unknown key: #{key}"
      return false
    end
def valid? ( extra_tokens = nil ) extra_tokens = [ extra_tokens ] if extra_tokens . kind_of? ( Hash ) if @key == @client . key return check_signature ( @client . secret ) elsif extra_tokens extra_tokens . each do | token | return check_signature ( token [ :secret ] ) if @key == token [ :key ] end end Pusher . logger . warn "Received webhook with unknown key: #{key}" return false end
Returns whether the WebHook is valid by checking that the signature
matches the configured key & secret.
Returns whether the WebHook is valid by checking that the signature matches the configured key & secret .
extra_tokens
If you have extra tokens for your Pusher app, you can specify them so that they're used to attempt validation.
If you have extra tokens for your Pusher app you can specify them so that they ' re used to attempt validation .