https://github.com/hex7c0/json-decrypt
decrypt your json configuration with password
https://github.com/hex7c0/json-decrypt
json-configuration json-decrypt nodejs
Last synced: 11 months ago
JSON representation
decrypt your json configuration with password
- Host: GitHub
- URL: https://github.com/hex7c0/json-decrypt
- Owner: hex7c0
- License: gpl-3.0
- Created: 2014-11-25T13:28:21.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2023-04-16T00:17:44.000Z (about 3 years ago)
- Last Synced: 2025-06-30T02:42:24.923Z (12 months ago)
- Topics: json-configuration, json-decrypt, nodejs
- Language: JavaScript
- Homepage: https://github.com/hex7c0/json-decrypt
- Size: 57.6 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# [json-decrypt](https://github.com/hex7c0/json-decrypt)
[](https://www.npmjs.com/package/json-decrypt)
[](https://travis-ci.org/hex7c0/json-decrypt)
[](https://ci.appveyor.com/project/hex7c0/json-decrypt)
[](https://david-dm.org/hex7c0/json-decrypt)
[](https://coveralls.io/r/hex7c0/json-decrypt)
decrypt (or encrypt) your json configuration (or object) with a password.
You can save your key into user environment for decrypt this cfg file
## Installation
Install through NPM
```bash
npm install json-decrypt
```
or
```bash
git clone git://github.com/hex7c0/json-decrypt.git
```
## API
decrypt your Object key, with an ENV passphrase
```js
var decrypt = require('json-decrypt').decrypt;
var cfg = {
fix: 'ciao',
foo: 'hRzVwi8=',
pr: [ 'foo' ]
};
var plaintext_cfg = decrypt(cfg, 'pr', process.env.p);
```
encrypt your Object key
```js
var encrypt = require('json-decrypt').encrypt;
var cfg = {
fix: 'ciao',
foo: 'hex7c',
pr: [ 'foo' ]
};
var ciphertext_cfg = encrypt(cfg, 'pr', process.env.p);
```
### decrypt(obj, index, key [, cipher [, encoding]])
#### options
- `obj` - **Object** Your object *(default "required")*
- `index` - **String** Object key *(default "required")*
- `key` - **String** Your Key *(default "required")*
- `cipher` - **String** Cipher *(default "aes-128-ctr")*
- `encoding` - **String** Output encoding *(default "base64")*
## Examples
Take a look at my [examples](examples)
### [License GPLv3](LICENSE)