honeymaker 0.12.1 → 0.12.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 490f356afca4a4979a1926d396a86790bb48931476252fa2b26b578dcc8f293c
4
- data.tar.gz: 1d9e2be37ff533e69c07f91879e82c3fe7a80dd399d59106a9a1fef5bcd95ebb
3
+ metadata.gz: 6862c70498fbf141e4808db14c19d5bd63a5dc59d7877797048756252b1d2836
4
+ data.tar.gz: e593c15692fcf4fb4677349b269076314cfac14fbe09b65b1c05b7aada91894d
5
5
  SHA512:
6
- metadata.gz: 336d17418b800025c21b423b033416f78fc8ac47448e8959833fab49e7f77fd2568904d757a2d68487c3fab9373092a8ab4f7645285d96fba9a1bf1c0e0c73d8
7
- data.tar.gz: b616e6aed2b85c593cf18523071966d697530407c963b7d1c97c1031e2cc6d0e4711be06ea974488aa22fa61c1cc5de7f66e601247436fc9ab475dbc9b5699e5
6
+ metadata.gz: f1547ddeaa92b66ba371d21f5452d88dc5aec87895649d28dec3ea9d54b36cb76582084b923381aadcbc004a95ba17291951b717ad4a7601a4401966f72af760
7
+ data.tar.gz: 96ad193d8d2ca903ac26e261c7a493ce77f25f2e644e4e5e152d8d4a3f717b5ae5cb6bfa6d1f3f33d49656b3a5decd5ee98402ce85ea5d3c72f28819858a93c2
@@ -168,7 +168,8 @@ module Honeymaker
168
168
  with_rescue do
169
169
  payload = body.compact.merge(request: path, nonce: timestamp_ms.to_s)
170
170
  encoded_payload = Base64.strict_encode64(payload.to_json)
171
- signature = hmac_sha256(@api_secret, encoded_payload)
171
+ # HMAC-SHA384, not SHA256: https://developer.gemini.com/authentication/api-key
172
+ signature = OpenSSL::HMAC.hexdigest("sha384", @api_secret, encoded_payload)
172
173
 
173
174
  response = connection.post do |req|
174
175
  req.url path
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Honeymaker
4
- VERSION = "0.12.1"
4
+ VERSION = "0.12.2"
5
5
  end
@@ -72,6 +72,23 @@ class Honeymaker::Clients::GeminiTest < Minitest::Test
72
72
  assert result.success?
73
73
  end
74
74
 
75
+ # Gemini signs with HMAC-SHA384 of the base64 payload
76
+ # (https://developer.gemini.com/authentication/api-key); any other digest is rejected.
77
+ def test_private_requests_are_signed_with_hmac_sha384
78
+ request = Struct.new(:headers) { def url(_path) = nil }.new
79
+ connection = Object.new
80
+ connection.define_singleton_method(:post) do |&block|
81
+ block.call(request)
82
+ Struct.new(:body).new({})
83
+ end
84
+ @client.instance_variable_set(:@connection, connection)
85
+
86
+ @client.get_balances
87
+
88
+ payload = request.headers[:"X-GEMINI-PAYLOAD"]
89
+ assert_equal OpenSSL::HMAC.hexdigest("sha384", "test_secret", payload), request.headers[:"X-GEMINI-SIGNATURE"]
90
+ end
91
+
75
92
  private
76
93
 
77
94
  def stub_connection(method, body)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: honeymaker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.1
4
+ version: 0.12.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Deltabadger