Skip to content

Latest commit

History

9 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

NPMBuild Status

node-crypto-config

Small NodeConfig extension which supports encryption.

Installation

 npm install crypto-config

Usage

This 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).

Thanks

To Jasypt for the inspiration.

License

May be freely distributed under the MIT license. Copyright (c) 2017 Christian Ribeaud

About

Small Node config extension which supports encryption

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages