Skip to content

Instantly share code, notes, and snippets.

@TeTiRoss
Created July 1, 2020 07:00
Show Gist options
  • Save TeTiRoss/55842daec4dc3495c57513651a7e1a0b to your computer and use it in GitHub Desktop.
Save TeTiRoss/55842daec4dc3495c57513651a7e1a0b to your computer and use it in GitHub Desktop.
authenticated Miinto orders requested
shop_id = SHOP_ID
channel_response_id = CHANNEL_RESPONSE_ID
channel_response_token = CHANNEL_RESPONSE_TOKEN
time = Time.now.to_i.to_s
seed = rand(1..99)
resourceSig = Digest::SHA256.hexdigest('GET' + "\n" + 'api-order.miinto.net' + "\n" + "/shops/#{shop_id}/orders" + "\n")
headerSig = Digest::SHA256.hexdigest(channel_response_id + "\n" + time + "\n" + seed + "\n" + 'MNT-HMAC-SHA256-1-0')
payloadSig = Digest::SHA256.hexdigest('')
OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha256'), channel_response_token, resourceSig + "\n" + headerSig + "\n" + payloadSig)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment