{"_id":"@danielsinclair/preferences","_rev":"1-06646e044c0fe919bedae178a7f54220","name":"@danielsinclair/preferences","dist-tags":{"latest":"2.0.2"},"versions":{"2.0.2":{"name":"@danielsinclair/preferences","version":"2.0.2","description":"Manage CLI application encrypted preferences.","main":"index.js","types":"index.d.ts","repository":{"type":"git","url":"git+https://github.com/CaffeinaLab/preferences.git"},"scripts":{"test":"node test/crypto.test.js"},"keywords":["config","cli","preferences","encrypted","secure"],"author":{"name":"Stefano Azzolini","email":"stefano.azzolini@caffeina.it","url":"http://caffeina.it"},"contributors":[{"name":"David Goodwin","email":"goodwid@gmail.com"}],"license":"MIT","bugs":{"url":"https://github.com/CaffeinaLab/preferences/issues"},"homepage":"https://github.com/CaffeinaLab/preferences#readme","dependencies":{"yaml":"^1.6.0"},"_id":"@danielsinclair/preferences@2.0.2","_nodeVersion":"13.0.1","_npmVersion":"6.13.4","dist":{"integrity":"sha512-BAsPccW2YjVq+0hkmNwtEqUEcx/Yp9WEbDNbAfDn8SZrFLEqFyA7VMZ79Rw7/R+lfphNg3Sg9PF/3VS06MVrfg==","shasum":"828a50b97483eb8fb7ac5e5c8b613826b084ef36","tarball":"https://registry.npmjs.org/@danielsinclair/preferences/-/preferences-2.0.2.tgz","fileCount":13,"unpackedSize":16099,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeCZkACRA9TVsSAnZWagAA7x4P/2gE5p9LyNUcRZCnYVtz\n/C/E6bYyd+H/eYs58SpnT3vsvylsbGyAcfIY+SZQGPaEORt/S48si903/cRf\nmJCaiB91CjEiO5hwGATAiEJ463et7II6Q7jR7ZI4IjBEZhVmIvbeQEn1U45e\n6oWynbz+BEVIZOJtWIhkf7D69k3IyR/92aHd5NyGTM2ndp3xtvAAknVphs9F\nCOKI8n7LlPHwlc66V1ZNvLNzcgB2gPy/IiX93BahnnkjX0t+2DBu4tnqrZYy\nzUBrTTgaTeUOtWZggVwBBCwE4mDY4Qm0qIqy+MQ+YH0PYFhBpOJmGyR0hdcX\nOwMMm00YIy5DdblEwnMrQmssCTEHvEGus7osKAooRVyg2CtLSywYvmSA5GTV\nLnLY65Co7Zl4fg7FjEsnEqsn8iYl6eMpEHyVb2LUla6YnQAeaQ8tWjg2cg+V\naOihvGZcweyZLuXWmrut1EOwE9hEM8Q2C1gfhn+m5KzXRVrEeC3gAk0CSMaV\nza7mV1LtyIYFv2kM5Onyb+lkVSmqBsUXiyZyP1uN7q/QAJiwXGwMz7N+gKzx\nqmdG4R56XmRevfOd0LkfeZ2PPlZDYqhjMmg1JNywPTcmrnCZCArACMZwAX3O\n1lrqflgkLz0aynvzZ51OQ9881lD3A6KtptYvdX5nxXkRribN/p8UmYWGm/ro\nYmqv\r\n=Y9cK\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCvIrDjbj8ySt9onPDwVi6v8467XFuwH5cxn7ylAzu+FgIgRFOKtGp69k+3XbIVaHGchIUOObzLYlqB7IP/oUKgYiA="}]},"maintainers":[{"name":"danielsinclair","email":"d@niel.nyc"}],"_npmUser":{"name":"danielsinclair","email":"d@niel.nyc"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/preferences_2.0.2_1577687295652_0.23286100518159492"},"_hasShrinkwrap":false}},"time":{"created":"2019-12-30T06:28:15.622Z","2.0.2":"2019-12-30T06:28:15.813Z","modified":"2022-04-05T02:41:24.755Z"},"maintainers":[{"name":"danielsinclair","email":"d@niel.nyc"}],"description":"Manage CLI application encrypted preferences.","homepage":"https://github.com/CaffeinaLab/preferences#readme","keywords":["config","cli","preferences","encrypted","secure"],"repository":{"type":"git","url":"git+https://github.com/CaffeinaLab/preferences.git"},"contributors":[{"name":"David Goodwin","email":"goodwid@gmail.com"}],"author":{"name":"Stefano Azzolini","email":"stefano.azzolini@caffeina.it","url":"http://caffeina.it"},"bugs":{"url":"https://github.com/CaffeinaLab/preferences/issues"},"license":"MIT","readme":"# Preferences\n\n![NPM version](https://img.shields.io/npm/dm/preferences.svg)\n![NPM downloads](https://img.shields.io/npm/dt/preferences.svg)\n\nNode.JS Module for handling **encrypted** user preferences.\n\nDesigned for CLI applications.\n\n[![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard)\n\n## Installation\n\n[![NPM](https://nodei.co/npm/preferences.png)](https://npmjs.org/package/preferences)\n\n```sh\nnpm install --save preferences\n```\n\n## Usage\n\n```js\nvar Preferences = require(\"preferences\");\n\n// Init preference file with an unique identifier and an optional default data\nvar prefs = new Preferences('com.your.app.identifier',{\n  account: {\n    username: 'MrRobot',\n    password: 'fsociety'\n  },\n  test: {\n    cycles: 1\n  }\n});\n\n// Preferences can be accessed directly\nprefs.test.cycles++;\n\nconsole.log(prefs);\n```\n\nPreferences are automatically saved on disk before process exit.\n\n## Options\n### Encryption\nEncryption uses your private ssh key if founded, otherwise it will automatically use an identifier dependant generated password.\n\nYou can override the default key path in the options:\n\n```js\nvar prefs = new Preferences('com.foo.bar',{}, {\n  key: '~/certs/my-custom-key.pem'\n});\n```\n\nYou can disable encryption for plain text preferences by setting encrypt to false.\n```js\nvar prefs = new Preferences('com.foo.bar',{}, {\n  encrypt: false\n});\n```\n\n### Location\nThe preference file defaults to being saved in ~/.config/preferences/IDENTIFIER.pref. For example, the following would create ```~/.config/preferences/com.foo.bar.pref```.\n\n```js\nvar prefs = new Preferences('com.foo.bar');\n```\n\n### Human Editable\nYou can use the format option to specify the format for serialization. The supported types are ```json``` and ```yaml```. This option is most useful when disabling encryption as it provides a human editable file.\n\n```js\nvar prefs = new Preferences('com.foo.bar',{}, {\n  encrypt: false,\n  file: path.join(path.dirname(process.cwd()), '.foo'),\n  format: 'yaml'\n});\n```\n\n## License\n\nMIT. Copyright (c) 2015 Caffeina.\n","readmeFilename":"README.md"}