Comparing version 0.1.12 to 0.2.0
21
aws4.js
@@ -1,4 +0,6 @@ | ||
var aws4 = exports, | ||
url = require('url'), | ||
crypto = require('crypto') | ||
var aws4 = exports, | ||
url = require('url'), | ||
crypto = require('crypto'), | ||
lru = require('lru-cache'), | ||
credentialsCache = lru(1000) | ||
@@ -96,6 +98,11 @@ // http://docs.amazonwebservices.com/general/latest/gr/signature-version-4.html | ||
RequestSigner.prototype.signature = function() { | ||
var kDate = hmac('AWS4' + this.credentials.secretAccessKey, this.date), | ||
kRegion = hmac(kDate, this.region), | ||
kService = hmac(kRegion, this.service), | ||
kCredentials = hmac(kService, 'aws4_request') | ||
var cacheKey = [this.credentials.secretAccessKey, this.date, this.region, this.service].join(), | ||
kDate, kRegion, kService, kCredentials = credentialsCache.get(cacheKey) | ||
if (!kCredentials) { | ||
kDate = hmac('AWS4' + this.credentials.secretAccessKey, this.date) | ||
kRegion = hmac(kDate, this.region) | ||
kService = hmac(kRegion, this.service) | ||
kCredentials = hmac(kService, 'aws4_request') | ||
credentialsCache.set(cacheKey, kCredentials) | ||
} | ||
return hmac(kCredentials, this.stringToSign(), 'hex') | ||
@@ -102,0 +109,0 @@ } |
{ | ||
"name": "aws4", | ||
"version": "0.1.12", | ||
"version": "0.2.0", | ||
"description": "Signs and prepares requests using AWS Signature Version 4", | ||
@@ -38,2 +38,5 @@ "author": "Michael Hart <michael.hart.au@gmail.com> (http://github.com/mhart)", | ||
"license": "MIT", | ||
"dependencies": { | ||
"lru-cache": "~2.3.1" | ||
}, | ||
"devDependencies": { | ||
@@ -40,0 +43,0 @@ "should": "~1.2.1", |
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
27033
415
1
+ Addedlru-cache@~2.3.1
+ Addedlru-cache@2.3.1(transitive)