Sha256: ea8c6d122cbfbf82af6723c0c423aaa0c192a70282fafa370612a8ceeb6f5bf5

Contents?: true

Size: 484 Bytes

Versions: 32

Compression:

Stored size: 484 Bytes

Contents

require 'base64'
require 'openssl'
require 'stringio'
require 'zlib'

module Adyen
  module Encoding
    def self.hmac_base64(hmac_key, message)
      digest = OpenSSL::HMAC.digest(OpenSSL::Digest::Digest.new('sha1'), hmac_key, message)
      Base64.encode64(digest).strip
    end

    def self.gzip_base64(message)
      sio = StringIO.new
      gz  = Zlib::GzipWriter.new(sio)
      gz.write(message)
      gz.close
      Base64.encode64(sio.string).gsub("\n", "")
    end
  end
end

Version data entries

32 entries across 32 versions & 4 rubygems

Version Path
adyen-0.3.5 lib/adyen/encoding.rb
adyen-0.3.4 lib/adyen/encoding.rb
adyen-0.3.3 lib/adyen/encoding.rb
adyen-0.3.2 lib/adyen/encoding.rb
adyen-0.3.0 lib/adyen/encoding.rb
adyen-0.2.3 lib/adyen/encoding.rb
adyen-0.2.2 lib/adyen/encoding.rb
floorplanner-adyen-0.2.2 lib/adyen/encoding.rb
adyen-0.2.1 lib/adyen/encoding.rb
adyen-0.2.0 lib/adyen/encoding.rb
adyen-0.1.5 lib/adyen/encoding.rb
adyen-0.1.4 lib/adyen/encoding.rb