Sha256: a95ac35afff3d07f8d94684568436c85c0205a3eb74a558ca3a887ce357abbf2
Contents?: true
Size: 603 Bytes
Versions: 3
Compression:
Stored size: 603 Bytes
Contents
module Twilio module Util class RequestValidator def initialize(auth_token = nil) @auth_token = auth_token || Twilio.auth_token raise ArgumentError, 'Auth token is required' if @auth_token.nil? end def validate(url, params, signature) expected = build_signature_for url, params expected == signature end def build_signature_for(url, params) data = url + params.sort.join digest = OpenSSL::Digest.new('sha1') Base64.encode64(OpenSSL::HMAC.digest(digest, @auth_token, data)).strip end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
twilio-ruby-3.13.1 | lib/twilio-ruby/util/request_validator.rb |
twilio-ruby-3.13.0 | lib/twilio-ruby/util/request_validator.rb |
twilio-ruby-3.12.3 | lib/twilio-ruby/util/request_validator.rb |