hide-sensitive-keys
v1.0.1
Published
This module can be usefull to hide sensitive information while logging request/response.
Downloads
3
Maintainers
Readme
hide sensitive keys
Hide sensitive keys from a string or from a json payload. It acceptes a string or a JSON payload.
Usage
var HideSenSitiveKeys = require('hide-sensitive-keys');
const hidesensitivekeys = new HideSenSitiveKeys({sensitiveKeys: ['password','cardNumber']});
//-hiding keys and return new payload/string.
var data = hidesensitivekeys.hide({payload:{username:'ali_142', password: '415145'}});
API
new HideSenSitiveKeys(sensitiveKeys)
constructor
, You have to pass a list of sensitive keys in the constructor you are using in your project. It's optional.
HideSenSitiveKeys#hideSensitiveKeys = function(sensitiveKeys)
sensitiveKeys
You can pass sensitive keys later as well.
HideSenSitiveKeys#hideKey = function(key)
key
, a single key can be set on run time.
Todo
- Tests