Class: Cryptoexchange::Exchanges::BitboxPrivate::Authentication
Instance Method Summary
collapse
#initialize, #is_missing_credentials?, #missing_credentials, #raise_credentials_missing_error, #validate_credentials!
Instance Method Details
9
10
11
12
13
14
15
16
17
|
# File 'lib/cryptoexchange/exchanges/bitbox_private/authentication.rb', line 9
def (payload, timestamp)
api_key = HashHelper.dig(Cryptoexchange::Credentials.get(@exchange), 'api_key')
{
"X-API-Key" => api_key,
"X-API-SIGN" => signature(payload),
"X-API-TIMESTAMP" => timestamp,
"X-API-NONCE" => "12345"
}
end
|
#required_credentials ⇒ Object
19
20
21
|
# File 'lib/cryptoexchange/exchanges/bitbox_private/authentication.rb', line 19
def required_credentials
%i(api_key api_secret)
end
|
#signature(payload) ⇒ Object
4
5
6
7
|
# File 'lib/cryptoexchange/exchanges/bitbox_private/authentication.rb', line 4
def signature(payload)
api_secret = HashHelper.dig(Cryptoexchange::Credentials.get(@exchange), 'api_secret')
OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha256'), api_secret, payload)
end
|