Node.JS module for managing CLI application encrypted preferences
JavaScript
Latest commit 35947ed Sep 30, 2015 @lastguest lastguest Update README.md
Permalink
Failed to load latest commit information.
.editorconfig Saving work done by : stefano.azzolini Sep 15, 2015
.gitignore Initial release Sep 15, 2015
LICENSE Update readme Sep 15, 2015
README.md Update README.md Sep 30, 2015
index.js StandardJS compliance Sep 16, 2015
package.json 0.2.1 Sep 16, 2015

README.md

Preferences

NPM version NPM downloads

Node.JS Module for handling encrypted user preferences.

Designed for CLI applications.

js-standard-style

Installation

NPM

npm install --save preferences

Usage

var Preferences = require("preferences");

// Init preference file with an unique identifier and an optional default data
var prefs = new Preferences('com.your.app.identifier',{
  account: {
    username: 'MrRobot',
    password: 'fsociety'
  },
  test: {
    cycles: 1
  }
});

// Preferences can be accessed directly
prefs.test.cycles++;

console.log(prefs.account);

Preferences are automatically saved on disk before process exit.

Encryption uses your private ssh key if founded, otherwise it will automatically use an identifier dependant generated password.

You can override the default key path in the options:

var prefs = new Preferences('com.foo.bar',{}, {
  key: '~/certs/my-custom-key.pem'
});

License

MIT. Copyright (c) 2015 Caffeina.