secure-db

An encrypted local JSON database package.

Usage no npm install needed!

<script type="module">
  import secureDb from 'https://cdn.skypack.dev/secure-db';
</script>

README

SecureDB - Local Database

SecureDB is a fast, encrypted, simple and easy to use database package for simple projects with local JSON storage.

PACKAGE VESION PACKAGE DOWNLOADS PACKAGE SIZE PACKAGE LICENSE

Installation

This is a Node.js module available through the npm registry.

Before installing, download and install Node.js. Node.js 0.10 or higher is required.

Installation is done using the npm install command:

$ npm install secure-db
const { Database } = require('secure-db');
const db = new Database('my-database');
// ES6
import { Database } from 'secure-db';
const db = new Database('my-database');

Features

- 1.5.0^

  • Safe Data

This package is 100% secure because it has a key encryption feature cript.js. The data is stored in JSON format so its handling becomes faster and more perfomatic. There is no need to run a server to use the database because its storage is saved locally.

  • Separate Databases

It is possible to create several databases separated by folders and files, all with individual security. All databases created can have a Child Database which is a space within a database separated by file and can be accessed individually.

  • Individual Security Keys

All saved data is initially stored with encryption. Each database has its security key that is used to encrypt the data, if it is changed, the saved data is lost forever or until the key is renconstructed correctly.

  • Enabled Encryption

It is possible to enable the encryption of the databases new Database('your-database', true).

Need Help? Check out:

Example

const db = require('secure-db');

// Saves data to the database
db.set('Felipe', { age: 30 }); // Felipe: { age: 30 }

// Pushing an element to an array
db.push('Felipe.books', 'Harry Potter'); // Felipe: { books: ['Harry Potter'] }

// Add in a number
db.sum('Felipe.age', 3); // Felipe: { age: 33 }

// Subtract a number
db.sub('Felipe.age', 2); // Felipe: { age: 31 }

// Returns saved data
db.get('Felipe'); // Felipe: { age: 31, books: ['Harry Potter'] }
db.get('Felipe.books'); // Felipe: { books: ['Harry Potter'] }

Dependencies