akos-egg-nos
Advanced tools
Comparing version 1.0.9 to 1.0.10
@@ -72,6 +72,8 @@ 'use strict'; | ||
app.nos.getPrivateObjectUrl = function(bucketName, key, expire) { | ||
const config = app.config.nos; | ||
bucketName = bucketName || config.bucket; | ||
expire = expire || 120 * 60 * 1000; | ||
if (!bucketName || !key || !expire) { | ||
throw new Error('config is not right'); | ||
} | ||
const config = app.config.nos; | ||
const httpVerb = 'GET'; | ||
@@ -81,5 +83,5 @@ const resourcePath = `/${bucketName}/${encodeURI(key)}`; | ||
const message = `${httpVerb}\n\n\n${expiration}\n${resourcePath}`; | ||
const secretMessage = crypto.createHmac('SHA256', config.secretKey).update(message).digest('base64'); | ||
return `https://${config.bucket}.${config.endpoint}/${encodeURI(key)}?Signature=${encodeURIComponent(secretMessage)}&Expires=${expiration}&NOSAccessKeyId=${config.accesskey}`; | ||
const secretMessage = crypto.createHmac('SHA256', config.secretId).update(message).digest('base64'); | ||
return `https://${config.bucket}.${config.endpoint}/${encodeURI(key)}?Signature=${encodeURIComponent(secretMessage)}&Expires=${expiration}&NOSAccessKeyId=${config.accessId}`; | ||
}; | ||
}; |
{ | ||
"name": "akos-egg-nos", | ||
"version": "1.0.9", | ||
"version": "1.0.10", | ||
"description": "[![NPM version][npm-image]][npm-url] [![build status][travis-image]][travis-url] [![Test coverage][codecov-image]][codecov-url] [![David deps][david-image]][david-url] [![Known Vulnerabilities][snyk-image]][snyk-url] [![npm download][download-image]][download-url]", | ||
@@ -5,0 +5,0 @@ "eggPlugin": { |
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
10462
122