json-file-encrypt
v2.1.2
Published
Package for encrypting JSON
Downloads
2,496
Readme
#json-file-encrypt 2
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 jfe = require("json-file-encrypt");
Note: Decryption functions will return false if the key is incorrect / the decryption failed.
Class based usage
//create Instance with "test Key" as the key
let key1 = new jfe.encryptor ("test Key");
//Encrypt a string:
let encrypted = key1.encrypt("some string"); //returns encrypted string
//Decrypt an encrypted string
let data = key1.decrypt(encrypted);
Direct usage
//encrypt a string
let encrypted = jfe.encrypt("key", "string data");
//decrypt a encrypted string
let original = jfe.decrypt("key", encrypted);