Skip to content

Commit

Permalink
Reduce number of variables
Browse files Browse the repository at this point in the history
  • Loading branch information
lauriro committed Sep 21, 2024
1 parent 97dbd9a commit 373dcae
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions s3.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,13 @@ function awsSig(s3, method, path, _opts, optsPrefix, headers, longDate, contentH
out.SignedHeaders,
contentHash
].join("\n")
, signKey = hmac(hmac(hmac(hmac("AWS4" + s3.secret, shortDate), s3.region), "s3"), "aws4_request")
, signString = [

out.Signature = hmac(hmac(hmac(hmac(hmac("AWS4" + s3.secret, shortDate), s3.region), "s3"), "aws4_request"), [
ALGO,
longDate,
scope,
hash(canonical)
].join("\n")

out.Signature = hmac(signKey, signString).toString("hex").toLowerCase()
].join("\n")).toString("hex").toLowerCase()
out.url = s3.protocol + "://" + s3.endpoint + path + (query ? "?" + query : "")
out.auth = ALGO + " Credential=" + out.Credential + ", SignedHeaders=" + out.SignedHeaders + ", Signature=" + out.Signature
return out
Expand Down

0 comments on commit 373dcae

Please sign in to comment.