Class: Cryptoexchange::Exchanges::Coinut::Authentication
Instance Method Summary
collapse
#initialize, #is_missing_credentials?, #missing_credentials, #raise_credentials_missing_error, #validate_credentials!
Instance Method Details
9
10
11
12
|
# File 'lib/cryptoexchange/exchanges/coinut/authentication.rb', line 9
def (payload)
username = HashHelper.dig(Cryptoexchange::Credentials.get(@exchange), 'username')
{ 'X-USER' => username, 'X-SIGNATURE' => signature(payload) }
end
|
#required_credentials ⇒ Object
14
15
16
|
# File 'lib/cryptoexchange/exchanges/coinut/authentication.rb', line 14
def required_credentials
%i(api_key username)
end
|
#signature(payload) ⇒ Object
4
5
6
7
|
# 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
|