Comparing version 1.9.0 to 1.10.0
@@ -218,4 +218,4 @@ module.exports = | ||
function init(config) { | ||
if (!config || !config.accessKey || !config.secretKey || !config.region || !config.bucket || !config.masterKey) { | ||
throw new Error('Configuration must include keys [accessKey, secretKey, region, bucket, masterKey]'); | ||
if (!config || !config.region || !config.bucket || !config.masterKey) { | ||
throw new Error('Configuration must include keys [region, bucket, masterKey]'); | ||
} | ||
@@ -225,2 +225,16 @@ | ||
var options = { | ||
region: config.region | ||
}; | ||
if (config.accessKey && config.secretKey) { | ||
debug('Using explicit credentials'); | ||
options.credentials = new AWS.Credentials({ | ||
accessKeyId: config.accessKey, | ||
secretAccessKey: config.secretKey | ||
}); | ||
} else { | ||
debug('Using credentials from environment'); | ||
} | ||
return { | ||
@@ -231,9 +245,3 @@ config: config, | ||
kms: new AWS.KMS({ | ||
region: config.region, | ||
credentials: new AWS.Credentials({ | ||
accessKeyId: config.accessKey, | ||
secretAccessKey: config.secretKey | ||
}) | ||
}), | ||
kms: new AWS.KMS(options), | ||
@@ -240,0 +248,0 @@ /** |
{ | ||
"name": "secretkms", | ||
"version": "1.9.0", | ||
"version": "1.10.0", | ||
"private": false, | ||
@@ -5,0 +5,0 @@ "scripts": { |
20996
434