aws-signature-v4
Advanced tools
Comparing version 1.3.0 to 1.4.0
18
index.js
@@ -17,7 +17,15 @@ /* eslint-env node */ | ||
headers, | ||
payload | ||
payload, | ||
doubleEscape | ||
) { | ||
return [ | ||
method.toUpperCase(), | ||
createCanonicalURI(pathname), | ||
createCanonicalURI( | ||
doubleEscape | ||
? pathname | ||
.split(/\//g) | ||
.map(v => encodeURIComponent(v)) | ||
.join("/") | ||
: pathname | ||
), | ||
exports.createCanonicalQueryString(query), | ||
@@ -141,2 +149,3 @@ exports.createCanonicalHeaders(headers), | ||
options.signSessionToken = true; | ||
options.doubleEscape = false; | ||
return exports.createPresignedURL( | ||
@@ -170,2 +179,4 @@ options.method, | ||
options.signSessionToken = options.signSessionToken || false; | ||
options.doubleEscape = | ||
options.doubleEscape !== undefined ? options.doubleEscape : true; | ||
@@ -196,3 +207,4 @@ // host is required | ||
options.headers, | ||
payload | ||
payload, | ||
options.doubleEscape | ||
); | ||
@@ -199,0 +211,0 @@ var stringToSign = exports.createStringToSign( |
{ | ||
"name": "aws-signature-v4", | ||
"version": "1.3.0", | ||
"version": "1.4.0", | ||
"description": "Generate AWS V4 Signatures and Signed URLs", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -64,2 +64,33 @@ /* eslint-env node, mocha */ | ||
it("should generate a canonical request for websocket connection api", function() { | ||
var webCanonicalRequest = aws.createCanonicalRequest( | ||
"GET", | ||
"/@connections", | ||
{ | ||
"X-Amz-Algorithm": "AWS4-HMAC-SHA256", | ||
"X-Amz-Credential": | ||
"AKIAIOSFODNN7EXAMPLE/20130524/us-east-1/s3/aws4_request", | ||
"X-Amz-Date": "20130524T000000Z", | ||
"X-Amz-SignedHeaders": "host" | ||
}, | ||
{ | ||
Host: "examplebucket.s3.amazonaws.com" | ||
}, | ||
"UNSIGNED-PAYLOAD", | ||
true | ||
); | ||
assert.equal( | ||
webCanonicalRequest, | ||
[ | ||
"GET", | ||
"/%40connections", | ||
"X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIOSFODNN7EXAMPLE%2F20130524%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20130524T000000Z&X-Amz-SignedHeaders=host", | ||
"host:examplebucket.s3.amazonaws.com", | ||
"", | ||
"host", | ||
"UNSIGNED-PAYLOAD" | ||
].join("\n") | ||
); | ||
}); | ||
it("should generate a string to sign", function() { | ||
@@ -66,0 +97,0 @@ // time, region, service, request |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
81315
631
2