secret-obfuscator
v1.0.3
Published
Replaces secrets in strings with "***".
Downloads
5
Maintainers
Readme
Secret Obfuscator
Replaces secrets in strings with "***".
Installation
npm install --save secret-obfuscator
or available on JSDelivr at "https://cdn.jsdelivr.net/npm/secret-obfuscator@1".
Usage
import { Obfuscator } from 'secret-obfuscator';
const obfuscator = new Obfuscator({
secrets: ['abc', 'def', 'efg'],
replacement: '***', // optional
});
obfuscator.obfuscate('This is a secret: abc');
// => This is a secret: ***
obfuscator.obfuscate('These are some secrets: abc def');
// => These are some secrets: *** ***
obfuscator.obfuscate('This is a mix of overlapping secrets: abcdefg');
// => This is a mix of overlapping secrets: ***