class Cryptoexchange::Exchanges::Coinut::Authentication

Public Instance Methods

headers(payload) click to toggle source
# File lib/cryptoexchange/exchanges/coinut/authentication.rb, line 9
def headers(payload)
  username = HashHelper.dig(Cryptoexchange::Credentials.get(@exchange), 'username')
  { 'X-USER' => username, 'X-SIGNATURE' => signature(payload) }
end
required_credentials() click to toggle source
# File lib/cryptoexchange/exchanges/coinut/authentication.rb, line 14
def required_credentials
  %i(api_key username)
end
signature(payload) click to toggle source
# File lib/cryptoexchange/exchanges/coinut/authentication.rb, line 4
def signature(payload)
  api_key = HashHelper.dig(Cryptoexchange::Credentials.get(@exchange), 'api_key')
  OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha256'), api_key, payload)
end