lowdb-encryption

    0.1.0 • Public • Published

    Lowdb Encryption

    Lowdb add-on for ecnryption.


    Table of Contents

    Install

    npm:

    npm install lowdb-encryption

    Yarn:

    yarn add lowdb-encryption

    GitHub:

    git clone https://github.com/mazecodes/lowdb-encryption.git

    Usage

    const lowdb = require('lowdb');
    const FileSync = require('lowdb/adapters/FileSync');
    const lowdbEncryption = require('lowdb-encryption');
    
    const adapter = new FileSync('db.json', {
      ...lowdbEncryption({
        secret: 's3cr3t',
        iterations: 100_000,
      }),
    });
    
    const db = lowdb(adapter);

    iterations is the number of iterations used for key derivation. The encryption key will be derived from secret. (Iterations is set to 100,000 by default)

    Encryption Details

    Lowdb Encryption uses PBKDF2 for key derivation with 100,000 iterations set by default and uses AES256 in CBC mode for encryption. It also uses HMAC-SHA256 for signing and validation the state.

    Contributing

    All contributions, issues and feature requests are welcome!
    Please feel free to check issues page.

    1. Fork the project
    2. Create your feature branch (git checkout -b feature/AwesomeFeature)
    3. Commit your changes (git commit -m "Add Awesome Feature")
    4. Push to the branch (git push origin feature/AwesomeFeature)
    5. Open a Pull Request

    Author

    Maze Peterson:

    Show your support

    Give a if you liked this project!

    License

    MIT © Maze Peterson

    Install

    npm i lowdb-encryption

    DownloadsWeekly Downloads

    21

    Version

    0.1.0

    License

    MIT

    Unpacked Size

    10.9 kB

    Total Files

    12

    Last publish

    Collaborators

    • avatar