Small NodeConfig extension which supports encryption.
npm install crypto-configThis library is a wrapper around Config. On instantiation, each string property
value matching the pattern ENC(<encrypted-value>) will go through the handler specified in the constructor.
constassert=require('assert');constcrypto=require('crypto');constalgorithm='aes-256-ctr';constConfig=require('crypto-config');// The key which has been used to encrypt the passwordconstsalt='secret';// This is the handler to decrypt your encrypted valuesfunctiondecrypt(val){assert(text,"Unspecified text");constdecipher=crypto.createDecipher(algorithm,salt);letdec=decipher.update(text,'hex','utf8');dec+=decipher.final('utf8');returndec;}// 'crypto-config' instantiation with handler.constconfig=newConfig(val=>{returndecrypt(val);}).config;The Config contains two properties: orig (original configuration values) and config (the handled configuration values).
To Jasypt for the inspiration.
May be freely distributed under the MIT license. Copyright (c) 2017 Christian Ribeaud