fast-azure-storage
Advanced tools
Comparing version 2.0.0 to 2.1.0
@@ -17,24 +17,22 @@ var querystring = require('querystring'); | ||
this._nextSASRefresh = 0; | ||
// Refresh SAS | ||
this._sas = Promise.resolve(this.options.sas()); | ||
// Update _nextSASRefresh when the SAS has been refreshed | ||
this._sas.then(function(sas) { | ||
sas = querystring.parse(sas); | ||
// Find next sas refresh time | ||
self._nextSASRefresh = ( | ||
new Date(sas.se).getTime() - self.options.minSASAuthExpiry | ||
); | ||
debug("Refreshed shared-access-signature, will refresh in %s ms", | ||
self._nextSASRefresh); | ||
// Throw an error if the signature expiration comes too soon | ||
if (Date.now() > self._nextSASRefresh) { | ||
throw new Error("Refreshed SAS, but got a Shared-Access-Signature " + | ||
"that expires less than options.minSASAuthExpiry " + | ||
"from now, signature expiry: " + sas.se); | ||
} | ||
}).catch(function(err) { | ||
// If we have an error freshing SAS that's bad and we'll emit it; for most | ||
// apps it's probably best to ignore this error and just crash. | ||
self.emit('error', err); | ||
}); | ||
// Refresh SAS and update _nextSASRefresh when the SAS has been refreshed | ||
this._sas = Promise.resolve(this.options.sas()) | ||
.then(function(sasString) { | ||
sas = querystring.parse(sasString); | ||
// Find next sas refresh time | ||
self._nextSASRefresh = ( | ||
new Date(sas.se).getTime() - self.options.minSASAuthExpiry | ||
); | ||
debug("Refreshed shared-access-signature, will refresh at", | ||
new Date(self._nextSASRefresh)); | ||
// Throw an error if the signature expiration comes too soon | ||
if (Date.now() > self._nextSASRefresh) { | ||
throw new Error("Refreshed SAS, but got a Shared-Access-Signature " + | ||
"that expires less than options.minSASAuthExpiry (" + | ||
self.options.minSASAuthExpiry / 1000 + | ||
"s) from now; signature expiry: " + sas.se); | ||
} | ||
return sasString; | ||
}); | ||
} | ||
@@ -184,2 +182,2 @@ | ||
exports.authorizeWithSharedKey = authorizeWithSharedKey; | ||
exports.authorizeWithSharedKey = authorizeWithSharedKey; |
@@ -329,4 +329,4 @@ 'use strict'; | ||
debug("Error code: %s for %s %s on retry: %s", | ||
err.code, method, path, retry); | ||
debug("Error code: %s (%s) for %s %s on retry: %s", | ||
data.code, res.statusCode, method, path, retry); | ||
@@ -333,0 +333,0 @@ // Throw the constructed error |
@@ -412,4 +412,4 @@ 'use strict'; | ||
debug("Error code: %s for %s %s on retry: %s", | ||
code, method, path, retry); | ||
debug("Error code: %s (%s) for %s %s on retry: %s", | ||
code, res.statusCode, method, path, retry); | ||
@@ -416,0 +416,0 @@ // Throw the constructed error |
{ | ||
"name": "fast-azure-storage", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"author": "Jonas Finnemann Jensen <jopsen@gmail.com>, Elena Solomon <elenasolomon28@gmail.com>", | ||
@@ -17,2 +17,5 @@ "description": "Fast client library for azure storage services", | ||
}, | ||
"files": [ | ||
"lib" | ||
], | ||
"engines": { | ||
@@ -19,0 +22,0 @@ "node": ">=4" |
Sorry, the diff of this file is too big to display
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
244581
13
5209
3