Skip to content

Commit

Permalink
feat: default to SHA-384 for signature authentication (#69)
Browse files Browse the repository at this point in the history
* feat: default to SHA-384 for signature authentication

* Prepend algorithm to signature

* Update test fixtures

---------

Co-authored-by: Marius Kleidl <marius@transloadit.com>
  • Loading branch information
aduh95 and Acconut committed Mar 1, 2024
1 parent 87e199e commit 79cb079
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/transloadit/request.rb
Expand Up @@ -16,7 +16,7 @@ class Transloadit::Request
API_HEADERS = {"Transloadit-Client" => "ruby-sdk:#{Transloadit::VERSION}"}

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

# @return [String] the API endpoint for the request
attr_reader :url
Expand Down Expand Up @@ -203,6 +203,6 @@ def request!(&request)
# @return [String] the HMAC signature for the params
#
def signature(params)
self.class._hmac(secret, params) if secret.to_s.length > 0
"sha384:" + self.class._hmac(secret, params) if secret.to_s.length > 0
end
end
2 changes: 1 addition & 1 deletion test/fixtures/cassettes/fetch_root.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 79cb079

Please sign in to comment.