Encryption and decryption files and folders.
npm i fcrypt --save-dev
var fcrypt = require("fcrypt");
fcrypt.encrypt({
key: "mySuperPass1337",
input: "./src/private",
output: "./src/dest/private.data",
callback: (errors) => {
if (errors.exists) {
errors.console();
return;
}
console.log("encrypted");
}
});
fcrypt.decrypt({
key: "mySuperPass1337",
input: "./src/dest/private.data",
output: "./src/output",
callback: (errors) => {
if (errors.exists) {
errors.console();
return;
}
console.log("decrypted");
}
});
You could change default crypto method
fcrypt.encrypt({
key: "mySuperPass1337",
input: "./private",
output: "./dest/private.data",
method: "aes192", // <-- The one
callback: () => {
console.log("encrypted");
}
});
Same thing in decrypt()