json-file-encrypt

Package for encrypting JSON

Usage no npm install needed!

<script type="module">
  import jsonFileEncrypt from 'https://cdn.skypack.dev/json-file-encrypt';
</script>

README

json-file-encrypt

json-file-encrypt is a node.js module for encrypting json files, with minimal effort. It uses sha256 and AES 256.

Usage

Require the module:

const encryptor = require("json-file-encrypt");

Create a new instance of the class:

//create Instance with "test Key" as the key
var key1 = new encryptor ("test Key");

Save JSON to a file:

//save JSON with pre-specified key
//first argument: path, second argument: data
key1.save("./file.json", {string: "This is a random JSON Object."});

Load JSON from a file:

//load file, decrypt with pre-specified key
//will return json data, {string: "This is a random JSON Object."}
var data = key1.load("./file.json");