Skip to content

Commit

Permalink
Clarify when to use the encryptionKey option
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Aug 15, 2021
1 parent e57c232 commit 397ce8d
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions readme.md
Expand Up @@ -173,11 +173,9 @@ If a relative path, it's relative to the default cwd. For example, `{cwd: 'unico
Type: `string | Buffer | TypedArray | DataView`\
Default: `undefined`

This can be used to secure sensitive data **if** the encryption key is stored in a secure manner (not plain-text) in the Node.js app. For example, by using [`node-keytar`](https://github.com/atom/node-keytar) to store the encryption key securely, or asking the encryption key from the user (a password) and then storing it in a variable.
Note that this is **not intended for security purposes**, since the encryption key would be easily found inside a plain-text Node.js app.

In addition to security, this could be used for obscurity. If a user looks through the config directory and finds the config file, since it's just a JSON file, they may be tempted to modify it. By providing an encryption key, the file will be obfuscated, which should hopefully deter any users from doing so.

It also has the added bonus of ensuring the config file's integrity. If the file is changed in any way, the decryption will not work, in which case the store will just reset back to its default state.
Its main use is for obscurity. If a user looks through the config directory and finds the config file, since it's just a JSON file, they may be tempted to modify it. By providing an encryption key, the file will be obfuscated, which should hopefully deter any users from doing so.

When specified, the store will be encrypted using the [`aes-256-cbc`](https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation) encryption algorithm.

Expand Down

0 comments on commit 397ce8d

Please sign in to comment.