Crypt - A wrapper for crypt
npm install crypt-lib
//Example 1:
var encrypted = new Crypt().setItem('mypass42!#T').encrypt().getEncrypted();
console.log(encrypted);
var decrypted = new Crypt().setItem(encrypted).decrypt().getDecrypted();
console.log(decrypted);
//Example 2:
var c = new Crypt();
c.setKey('lkmsdoaf982029!#84');
var e = c.setItem('bob').encrypt().getEncrypted();
console.log(e);
var c = new Crypt();
c.setKey('lkmsdoaf982029!#84');
var d = c.setItem(e).decrypt().getDecrypted();
console.log(d);
//Example 3:
var encrypted = new Crypt().setItem({ password : 'mypass42!#T'}).encrypt().getEncrypted();
console.log(encrypted);
var decrypted = new Crypt().setItem(encrypted).decrypt().getDecrypted();
console.log(decrypted);
//Example 4:
var encrypted = new Crypt().setItem({ password : 'mypass42!#T'}).encrypt().getEncrypted();
console.log(encrypted);
var decrypted = new Crypt().setItem(encrypted).decrypt().getField('password');
console.log(decrypted);
You use a new Crypt assuming you are on a distributed system otherwise this can be written differently.