Nth Permutation Mathematics

npm

Need private packages and team management tools?Check out npm Orgs. »

giantdb-crypto

2.0.0 • Public • Published

giantdb-crypto

Build Status Test Coverage Maintainability

GiantDB middleware for object encryption

Install

npm i giantdb-crypto

Setup

Example:

const GiantDB = require("giantdb");
const GiantDBCrypto = require("giantdb-crypto");
 
const db = new GiantDB();
 
// register the middleware
db.use(new GiantDBCrypto());

That's all there is to it!

Note that this middleware cannot be added in retrospect. Items not previously encrypted will cause errors when it is suddenly introduced.

Usage

You will need to provide an encryption key with every action that reads or writes items. Examples:

const options = {
    encryption: {
        key: /* your encryption key (any 24-byte Buffer) */,
    },
};
 
db.create(options).then((change) => {
    // ... everything else is normal
});
 
db.get(/* item id */).then((item) => {
    return item.getReadable(options).then((readable) => {
        // ... everything else is normal
    });
});
 
db.get(/* item id */).then((item) => {
    return item.getWritable(options).then((writable) => {
        // ... everything else is normal
    });
});

Encryption Algorithm

giantdb-crypto uses 192-bit AES with a per-item random initialization vector by default. The cipher is provided by Node's native crypto module, which in turn uses OpenSSL.

install

npm i giantdb-crypto

Downloadsweekly downloads

3

version

2.0.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability