Skip to content

Commit 79cb079

Browse files
aduh95Marius Kleidl
andauthored
feat: default to SHA-384 for signature authentication (#69)
* feat: default to SHA-384 for signature authentication * Prepend algorithm to signature * Update test fixtures --------- Co-authored-by: Marius Kleidl <[email protected]>
1 parent 87e199e commit 79cb079

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/transloadit/request.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class Transloadit::Request
1616
API_HEADERS = {"Transloadit-Client" => "ruby-sdk:#{Transloadit::VERSION}"}
1717

1818
# The HMAC algorithm used for calculation request signatures.
19-
HMAC_ALGORITHM = OpenSSL::Digest.new("sha1")
19+
HMAC_ALGORITHM = OpenSSL::Digest.new("sha384")
2020

2121
# @return [String] the API endpoint for the request
2222
attr_reader :url
@@ -203,6 +203,6 @@ def request!(&request)
203203
# @return [String] the HMAC signature for the params
204204
#
205205
def signature(params)
206-
self.class._hmac(secret, params) if secret.to_s.length > 0
206+
"sha384:" + self.class._hmac(secret, params) if secret.to_s.length > 0
207207
end
208208
end

test/fixtures/cassettes/fetch_root.yml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)