2.1.2 • Published 12 months ago

@warren-bank/fcrypt v2.1.2

Weekly downloads
1
License
MIT
Repository
github
Last release
12 months ago

fcrypt

fork of fcrypt v1.1.1

Library to store an input directory to an encrypted .zip file, and decrypt and extract an input encrypted .zip file to a directory.

Install

npm i "@warren-bank/fcrypt" --save

Node.js

var fcrypt = require("@warren-bank/fcrypt");

Encrypt

fcrypt.encrypt({
  key:    "mySuperPass1337",
  input:  "./src/private",
  output: "./dst/encrypted.zip.data",
  callback: (errors) => {
    if (errors.exists) {
      errors.console();
      return;
    }
    console.log("encrypted");
  }
});

Decrypt

fcrypt.decrypt({
  key:    "mySuperPass1337",
  input:  "./dst/encrypted.zip.data",
  output: "./dst/decrypted.zip",
  callback: (errors) => {
    if (errors.exists) {
      errors.console();
      return;
    }
    console.log("decrypted");
  }
});

Decrypt and Extract

fcrypt.extract({
  key:    "mySuperPass1337",
  input:  "./dst/encrypted.zip.data",
  output: "./dst/decrypted",
  callback: (errors) => {
    if (errors.exists) {
      errors.console();
      return;
    }
    console.log("extracted");
  }
});

Extra

You could change default crypto method

fcrypt.encrypt({
  method: "aes192", // HERE
  key:    "mySuperPass1337",
  input:  "./src/private",
  output: "./dst/encrypted.zip.data",
  callback: (errors) => {
    if (errors.exists) {
      errors.console();
      return;
    }
    console.log("encrypted");
  }
});

Same method parameter works for decrypt() and extract().