Sha256: 0eeccdf6fc382ca641241fc8626bf7d8dfa927044f2060cbe5157ccc245bc92f
Contents?: true
Size: 510 Bytes
Versions: 19
Compression:
Stored size: 510 Bytes
Contents
module Twilio module Util class RequestValidator def initialize(auth_token) @auth_token = auth_token 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::Digest.new('sha1') Base64.encode64(OpenSSL::HMAC.digest(digest, @auth_token, data)).strip end end end end
Version data entries
19 entries across 19 versions & 1 rubygems