class ItBitSDK::MessageSigner
Public Instance Methods
make_message(verb, url, body, nonce, timestamp)
click to toggle source
# File lib/it_bit_sdk/message_signer.rb, line 8 def make_message(verb, url, body, nonce, timestamp) [verb, url, body, nonce.to_s, timestamp.to_s].to_json end
sign_message(verb, url, json_body, nonce, timestamp)
click to toggle source
# File lib/it_bit_sdk/message_signer.rb, line 12 def sign_message(verb, url, json_body, nonce, timestamp) message = JSON.dump([verb.upcase, url, json_body || '', nonce.to_s, timestamp]) hash_digest = OpenSSL::Digest::SHA256.digest(nonce.to_s + message) hmac_digest = OpenSSL::HMAC.digest(OpenSSL::Digest::SHA512.new, ItBitSDK.secret, url + hash_digest) Base64.strict_encode64(hmac_digest) end