dh-encrypt

1.0.5 • Public • Published

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

  1. Encrypt a value:

     dhEncrypt.encrypt('string');
    
  2. Decrypt a value:

     dhEncrypt.decrypt('encrypted string');
    

Example:

let encryptedText = dhEncrypt.encrypt('test');
console.log(dhEncrypt.decrypt(encryptedText));

Prints:

test

Readme

Keywords

none

Package Sidebar

Install

npm i dh-encrypt

Weekly Downloads

8

Version

1.0.5

License

(MIT OR Apache-2.0)

Unpacked Size

4.69 kB

Total Files

5

Last publish

Collaborators

  • uranakam