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 +4 -4
- data/lib/honeymaker/clients/gemini.rb +2 -1
- data/lib/honeymaker/version.rb +1 -1
- data/test/honeymaker/clients/gemini_client_test.rb +17 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6862c70498fbf141e4808db14c19d5bd63a5dc59d7877797048756252b1d2836
|
|
4
|
+
data.tar.gz: e593c15692fcf4fb4677349b269076314cfac14fbe09b65b1c05b7aada91894d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
-
|
|
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
|
data/lib/honeymaker/version.rb
CHANGED
|
@@ -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)
|