Skip to content

Commit 2313b6d

Browse files
author
sevenbitbyte
committed
comments
1 parent b527873 commit 2313b6d

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

src/config/secure-config.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ const ARGON_TYPE = 'argon2id'
1818
class SecureConfig extends IConfig {
1919

2020
/**
21+
* A secure configuration. This uses an underlying `IConfig` for storage. Multiple
22+
* secure configs can be placed within the same `IConfig` so long as different `id`
23+
* is set. By default `pbkdf2` is used to generate NaCl keys. If `argon` is provided
24+
* then `argon2` will be used to generate the NaCl keys. Applications should
25+
* use `argon2`.
2126
* @class module:Config.SecureConfig
2227
* @implements {module:Config.SecureConfig}
2328
* @link module.Config
@@ -26,6 +31,8 @@ class SecureConfig extends IConfig {
2631
* @param {number} timeoutMs Timeout since last unlock, after which the config will be locked. Defaults to 5 minutes.
2732
* @param {boolean} includeActivity When set to `true` the timeout is reset after any read/write activity. Defaults to `true`
2833
* @param {Argon2} argon Instance of argon2 from either `npm:argon2` or `npm:argon2-browser`
34+
* @see https://github.com/ranisalt/node-argon2
35+
* @see https://github.com/antelle/argon2-browser
2936
*/
3037
constructor({
3138
id = 'secure-config',
@@ -38,6 +45,10 @@ class SecureConfig extends IConfig {
3845

3946
this.argon = argon
4047

48+
if(!this.argon){
49+
console.warn('Warning - PBKDF2 based secure config. You should probably use argon2!')
50+
}
51+
4152
this.content = null
4253
this.identity = null
4354
this.timer = null

0 commit comments

Comments
 (0)