@asymmetrik/yadda-secret
Advanced tools
Comparing version 0.0.7 to 0.0.8
@@ -22,2 +22,3 @@ 'use strict'; | ||
kmsKey: module.exports.getSecretKMSAlias(), | ||
kmsRegion: module.exports.getSecretKMSRegion() | ||
}); | ||
@@ -39,2 +40,3 @@ | ||
module.exports.getSecretKMSAlias = env.getSecretKMSAlias; | ||
module.exports.getSecretKMSRegion = env.getSecretKMSRegion; | ||
@@ -41,0 +43,0 @@ module.exports.generateSecretKey = require('./src/lib/secretGen'); |
{ | ||
"name": "@asymmetrik/yadda-secret", | ||
"description": "Client secret library", | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"main": "index.js", | ||
@@ -6,0 +6,0 @@ "author": "contributors", |
@@ -21,6 +21,7 @@ ## Yadda-Secret | ||
- `__YADDA__DEPLOYMENT_SECRET_TABLE__`: DyanmoDB table which holds the secrets | ||
- `__YADDA__DEPLOYMENT_SECRET_TABLE__`: DynamoDB table which holds the secrets | ||
- `__YADDA__DEPLOYMENT_SECRET_TABLE_REGION__`: DynamoDB table region | ||
- `__YADDA__DEPLOYMENT_SECRET_PREFIX__`: The secret key prefix (*AppName/Region/Environment*) | ||
- `__YADDA__DEPLOYMENT_SECRET_KMSALIAS__`: The KMS CMK alias to encrypt and decrypt | ||
- `__YADDA__DEPLOYMENT_SECRET_REGION__`: The region the KMS key resides in (optional) | ||
@@ -27,0 +28,0 @@ Developers using this tool will not need access to the CMK but the resulting deployed container will need |
@@ -6,2 +6,3 @@ 'use strict'; | ||
module.exports.getSecretPrefix = function(){ return process.env.__YADDA__DEPLOYMENT_SECRET_PREFIX__ || null }; | ||
module.exports.getSecretKMSAlias = function(){ return process.env.__YADDA__DEPLOYMENT_SECRET_KMSALIAS__ || null }; | ||
module.exports.getSecretKMSAlias = function(){ return process.env.__YADDA__DEPLOYMENT_SECRET_KMSALIAS__ || null }; | ||
module.exports.getSecretKMSRegion = function(){ return process.env.__YADDA__DEPLOYMENT_SECRET_REGION__ || process.env.__YADDA__DEPLOYMENT_SECRET_TABLE_REGION__ || null }; |
@@ -34,5 +34,8 @@ 'use strict'; | ||
const { region, table, kmsKey } = this.options; | ||
const { region, table, kmsKey, kmsRegion } = this.options; | ||
if(region && table) | ||
this.store = new SecretStore({ table, awsOpts: { region }, kmsKey }); | ||
this.store = new SecretStore({ table, awsOpts: { region }, kmsOpts: { region: kmsRegion }, kmsKey }); | ||
else { | ||
console.warn('region and table are not defined!'); | ||
} | ||
@@ -49,3 +52,3 @@ return this.store; | ||
retrieveFromKMS(value){ | ||
return Promise.resolve(this.storage ? this.storage.getSecret({ name: value }) : null); | ||
return this.storage ? this.storage.getSecret({ name: value }) : Promise.resolve(null); | ||
} | ||
@@ -52,0 +55,0 @@ |
13797
206
125