https://github.com/hydrocarbons/secure-json
JSON storage library to securely persist json data on disk
https://github.com/hydrocarbons/secure-json
2019 adf database encrypted-data hydrocarbons inmemory json localstorage nodejs persistence persistent-storage secure secure-json simple
Last synced: 3 months ago
JSON representation
JSON storage library to securely persist json data on disk
- Host: GitHub
- URL: https://github.com/hydrocarbons/secure-json
- Owner: HydroCarbons
- License: apache-2.0
- Created: 2019-01-12T08:26:47.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-01-14T02:19:44.000Z (over 6 years ago)
- Last Synced: 2025-01-16T22:20:10.450Z (5 months ago)
- Topics: 2019, adf, database, encrypted-data, hydrocarbons, inmemory, json, localstorage, nodejs, persistence, persistent-storage, secure, secure-json, simple
- Language: JavaScript
- Size: 36.1 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

## Travis CI Status
[](https://travis-ci.com/HydroCarbons/secure-json)
[](https://coveralls.io/github/HydroCarbons/secure-json?branch=master)# Secure JSON
- **Secure JSON** JSON storage library to securely persist JSON data on disk. **Cipher** is configured to use **AES-256-CBC** with initialization vector.
- There are two types of storage schema: _inmemory_ or _disk_
- **inmemory**: Store items are not persisted on disk and are not encrypted.
- **disk**: Store items are persisted on disk and can be encrypted.## Usage
### Install
```javascript
npm install secure-json --save
```### Require
```javascript
const SecureJStore = require("secure-json");
```
### Create an instance of SecureJStore
```javascript
var instance = new SecureJStore();
```### Initialize instance with options
```javascriptvar options = {
store: ,
dbType: ,
password:
};instance.init(options);
```### Create an instance of SecureJStore
```javascript
var instance = new SecureJStore();
```### Storing an item
```javascript
instance.setItem("key1", "value1");
```### Retrieving an item
```javascript
let value = instance.getItem("key1");
```### Removing an item
```javascript
let value = instance.removeItem("key1");
```### Retrieving all keys
```javascript
let keys = instance.keys();
```### Retrieving all values
```javascript
let values = instance.values();
```### Retrieving all entries of (key, value) pairs
```javascript
let items = instance.entries();
```### Retrieving all entries with for...of loop
```javascript
for(let item of instance ) { ... }
```### Retrieving all entries with forEach loop
```javascript
instance.forEach( (x) => { ... });
```### Archiving instance
```javascript
instance.archive();
```## Library Usage/Test
### Install
` npm install `### Test
` npm run test `### Coverage
` npm run coverage`OR
` istanbul cover ./test/test.js `
Check coverage folder