dh-encrypt
v1.0.5
Published
Simple encryption and decryption module.
Downloads
9
Readme
Configure
Require and configure the module:
const dhEncrypt = require('dh-encrypt');
dhEncrypt.configure({
algorithm: String, // Required
password: String, // Required
ivKey: String, // Required
logger: Object // Optional logger reference for custom logging. Defaults to console.
});
Use
Encrypt a value:
dhEncrypt.encrypt('string');
Decrypt a value:
dhEncrypt.decrypt('encrypted string');
Example:
let encryptedText = dhEncrypt.encrypt('test');
console.log(dhEncrypt.decrypt(encryptedText));
Prints:
test