Class: Rubymail::Secure
Instance Method Summary collapse
- #check_request_auth(timestamp, token, signature, offset = -5)) ⇒ Object
-
#initialize(rubymail) ⇒ Secure
constructor
A new instance of Secure.
Constructor Details
#initialize(rubymail) ⇒ Secure
Returns a new instance of Secure.
3 4 5 |
# File 'lib/rubymail/secure.rb', line 3 def initialize(rubymail) @rubymail = rubymail end |
Instance Method Details
#check_request_auth(timestamp, token, signature, offset = -5)) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/rubymail/secure.rb', line 7 def check_request_auth(, token, signature, offset=-5) if offset != 0 offset = Time.now.to_i + offset * 60 return false if < offset end return signature == OpenSSL::HMAC.hexdigest( OpenSSL::Digest::Digest.new('sha256'), Rubymail.api_key, '%s%s' % [, token]) end |