Sha256: 709baa5021c50ae88fa526f25692cabc4d62f2c6c1da6c4b193dcd6d7af757a9

Contents?: true

Size: 466 Bytes

Versions: 2

Compression:

Stored size: 466 Bytes

Contents

# frozen_string_literal: true

module Sumsub
  # https://developers.sumsub.com/api-reference/#signing-a-request
  class MessageSigner
    def self.sign(
      time:, 
      resource:, 
      method:, 
      body: nil, 
      secret_key: Sumsub.configuration.secret_key
    )
      data = time.to_s + method + '/resources/' + resource + body.to_s
      digest = OpenSSL::Digest.new('sha256')

      OpenSSL::HMAC.hexdigest(digest, secret_key, data)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sumsub-ruby-sdk-0.2.1 lib/sumsub/message_signer.rb
sumsub-ruby-sdk-0.2.0 lib/sumsub/message_signer.rb