lib/slack/events/request.rb in slack-ruby-client-0.17.0 vs lib/slack/events/request.rb in slack-ruby-client-1.0.0

- old
+ new

@@ -1,11 +1,13 @@ # frozen_string_literal: true module Slack module Events class Request class MissingSigningSecret < StandardError; end + class TimestampExpired < StandardError; end + class InvalidSignature < StandardError; end attr_reader :http_request, :signing_secret, :signature_expires_in @@ -49,10 +51,10 @@ # Returns true if the signature coming from Slack is valid. def valid? raise MissingSigningSecret unless signing_secret - digest = OpenSSL::Digest::SHA256.new + digest = OpenSSL::Digest.new('SHA256') signature_basestring = [version, timestamp, body].join(':') hex_hash = OpenSSL::HMAC.hexdigest(digest, signing_secret, signature_basestring) computed_signature = [version, hex_hash].join('=') computed_signature == signature end