Socket
Socket
Sign inDemoInstall

aws4

Package Overview
Dependencies
0
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.9.0 to 1.9.1

20

aws4.js

@@ -25,2 +25,6 @@ var aws4 = exports,

function encodeRfc3986Full(str) {
return encodeRfc3986(encodeURIComponent(str))
}
// request: { path | body, [host], [method], [headers], [service], [region] }

@@ -226,16 +230,16 @@ // credentials: { accessKeyId, secretAccessKey, [sessionToken] }

if (!key) return obj
obj[key] = !Array.isArray(query[key]) ? query[key] :
(firstValOnly ? query[key][0] : query[key].slice().sort())
obj[encodeRfc3986Full(key)] = !Array.isArray(query[key]) ? query[key] :
(firstValOnly ? query[key][0] : query[key])
return obj
}, {})
var encodedQueryPieces = []
Object.keys(reducedQuery).forEach(function(key) {
var encodedPrefix = encodeURIComponent(key) + '='
Object.keys(reducedQuery).sort().forEach(function(key) {
if (!Array.isArray(reducedQuery[key])) {
encodedQueryPieces.push(encodeRfc3986(encodedPrefix + encodeURIComponent(reducedQuery[key])))
encodedQueryPieces.push(key + '=' + encodeRfc3986Full(reducedQuery[key]))
} else {
reducedQuery[key].forEach(function(val) { encodedQueryPieces.push(encodeRfc3986(encodedPrefix + encodeURIComponent(val))) })
reducedQuery[key].map(encodeRfc3986Full).sort()
.forEach(function(val) { encodedQueryPieces.push(key + '=' + val) })
}
})
queryStr = encodedQueryPieces.sort().join('&')
queryStr = encodedQueryPieces.join('&')
}

@@ -249,3 +253,3 @@ if (pathStr !== '/') {

if (decodePath) piece = decodeURIComponent(piece).replace(/\+/g, ' ')
path.push(encodeRfc3986(encodeURIComponent(piece)))
path.push(encodeRfc3986Full(piece))
}

@@ -252,0 +256,0 @@ return path

{
"name": "aws4",
"version": "1.9.0",
"version": "1.9.1",
"description": "Signs and prepares requests using AWS Signature Version 4",

@@ -69,4 +69,5 @@ "author": "Michael Hart <michael.hart.au@gmail.com> (http://github.com/mhart)",

"scripts": {
"test": "mocha ./test/fast.js -b -t 100s -R list"
"test": "mocha ./test/fast.js -b -t 100s -R list",
"integration": "node ./test/slow.js"
}
}

4

README.md

@@ -6,6 +6,6 @@ aws4

A small utility to sign vanilla node.js http(s) request options using Amazon's
A small utility to sign vanilla Node.js http(s) request options using Amazon's
[AWS Signature Version 4](http://docs.amazonwebservices.com/general/latest/gr/signature-version-4.html).
Can also be used [in the browser](./browser).
If you want to sign and send AWS requests in a modern browser, or an environment like [Cloudflare Workers](https://developers.cloudflare.com/workers/), then check out [aws4fetch](https://github.com/mhart/aws4fetch) – otherwise you can also bundle this library for use [in the browser](./browser).

@@ -12,0 +12,0 @@ This signature is supported by nearly all Amazon services, including

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc