Sha256: e1658d2cb174f8bffc2fbda319378c6752ac42e0213efdc4bc3cf3178c36d09a

Contents?: true

Size: 363 Bytes

Versions: 55

Compression:

Stored size: 363 Bytes

Contents

module Cobrato
  class Signature
    attr_accessor :secret

    def initialize(secret)
      @secret = secret
    end

    def check?(cobrato_request_id, signature_to_check, body)
      cobrato_signature = OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha1'), secret, "#{cobrato_request_id}#{body}")
      signature_to_check == cobrato_signature
    end
  end
end

Version data entries

55 entries across 55 versions & 1 rubygems

Version Path
cobrato-client-0.23.0.beta8 lib/cobrato/signature.rb
cobrato-client-0.23.0.beta7 lib/cobrato/signature.rb
cobrato-client-0.23.0.beta6 lib/cobrato/signature.rb
cobrato-client-0.23.0.beta5 lib/cobrato/signature.rb
cobrato-client-0.23.0.beta4 lib/cobrato/signature.rb
cobrato-client-0.23.0.beta3 lib/cobrato/signature.rb
cobrato-client-0.23.0.beta2 lib/cobrato/signature.rb
cobrato-client-0.23.0.beta1 lib/cobrato/signature.rb
cobrato-client-0.22.0 lib/cobrato/signature.rb
cobrato-client-0.21.0 lib/cobrato/signature.rb
cobrato-client-0.20.0 lib/cobrato/signature.rb
cobrato-client-0.19.0 lib/cobrato/signature.rb
cobrato-client-0.18.0 lib/cobrato/signature.rb
cobrato-client-0.17.0 lib/cobrato/signature.rb
cobrato-client-0.16.0 lib/cobrato/signature.rb
cobrato-client-0.15.0 lib/cobrato/signature.rb
cobrato-client-0.14.0 lib/cobrato/signature.rb
cobrato-client-0.13.0 lib/cobrato/signature.rb
cobrato-client-0.12.0 lib/cobrato/signature.rb
cobrato-client-0.11.0 lib/cobrato/signature.rb