@dotenvx/dotenvx 1.69.0 → 1.69.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -2
- package/README.md +7 -7
- package/package.json +1 -1
- package/src/cli/actions/decrypt.js +6 -4
- package/src/cli/actions/encrypt.js +14 -20
- package/src/cli/actions/get.js +2 -2
- package/src/cli/actions/keypair.js +2 -2
- package/src/cli/actions/rotate.js +4 -10
- package/src/cli/actions/run.js +6 -6
- package/src/cli/actions/set.js +4 -8
- package/src/cli/dotenvx.js +11 -10
- package/src/lib/helpers/cryptography/index.js +2 -2
- package/src/lib/helpers/cryptography/mutateKeysSrc.js +1 -1
- package/src/lib/helpers/cryptography/mutateKeysSrcSync.js +1 -1
- package/src/lib/helpers/cryptography/provision.js +8 -8
- package/src/lib/helpers/cryptography/provisionSync.js +6 -6
- package/src/lib/helpers/cryptography/provisionWithPrivateKey.js +1 -1
- package/src/lib/helpers/cryptography/{opsKeypair.js → vltKeypair.js} +2 -2
- package/src/lib/helpers/cryptography/{opsKeypairSync.js → vltKeypairSync.js} +2 -2
- package/src/lib/helpers/executeDynamic.js +26 -44
- package/src/lib/helpers/keyResolution/keyValues.js +13 -6
- package/src/lib/helpers/keyResolution/keyValuesFromEnvSrc.js +12 -5
- package/src/lib/helpers/keyResolution/keyValuesSync.js +15 -8
- package/src/lib/main.js +12 -16
- package/src/lib/services/decrypt.js +5 -3
- package/src/lib/services/encrypt.js +4 -4
- package/src/lib/services/get.js +4 -4
- package/src/lib/services/keypair.js +4 -4
- package/src/lib/services/rotate.js +9 -9
- package/src/lib/services/run.js +21 -8
- package/src/lib/services/sets.js +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -2,7 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
-
[Unreleased](https://github.com/dotenvx/dotenvx/compare/v1.69.
|
|
5
|
+
[Unreleased](https://github.com/dotenvx/dotenvx/compare/v1.69.2...main)
|
|
6
|
+
|
|
7
|
+
## [1.69.2](https://github.com/dotenvx/dotenvx/compare/v1.69.1...v1.69.2) (2026-05-29)
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
* Minor messaging improvements, especially if using armored keys ([#825](https://github.com/dotenvx/dotenvx/pull/825))
|
|
12
|
+
|
|
13
|
+
## [1.69.1](https://github.com/dotenvx/dotenvx/compare/v1.69.0...v1.69.1) (2026-05-25)
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
|
|
17
|
+
* Internally rename `ops` to `vlt` ([#823](https://github.com/dotenvx/dotenvx/pull/823))
|
|
6
18
|
|
|
7
19
|
## [1.69.0](https://github.com/dotenvx/dotenvx/compare/v1.68.1...v1.69.0) (2026-05-25)
|
|
8
20
|
|
|
@@ -302,7 +314,7 @@ export default {
|
|
|
302
314
|
|
|
303
315
|
### Added
|
|
304
316
|
|
|
305
|
-
* Add hint on `.env.keys` for `dotenvx
|
|
317
|
+
* Add hint on `.env.keys` for `dotenvx armor up`. Dotenvx Armor lets you armor your private keys securely with just a single command. It's a convenient alternative to manually copy/pasting them in and out of 1Password. ([#718](https://github.com/dotenvx/dotenvx/pull/718))
|
|
306
318
|
|
|
307
319
|
## [1.51.2](https://github.com/dotenvx/dotenvx/compare/v1.51.1...v1.51.2) (2025-12-12)
|
|
308
320
|
|
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
[](https://dotenvx.com)
|
|
1
|
+
[](https://dotenvx.com)
|
|
2
2
|
|
|
3
3
|
*a secure dotenv*–from the creator of [`dotenv`](https://github.com/motdotla/dotenv).
|
|
4
4
|
|
|
@@ -1289,7 +1289,7 @@ $ dotenvx run -fk .env.keys -f apps/app1/.env -- yourcommand
|
|
|
1289
1289
|
</details>
|
|
1290
1290
|
<details><summary>`run --no-vlt`</summary><br>
|
|
1291
1291
|
|
|
1292
|
-
Turn off [Dotenvx
|
|
1292
|
+
Turn off [Dotenvx VLT ⛨](https://dotenvx.com/vlt) features.
|
|
1293
1293
|
|
|
1294
1294
|
```sh
|
|
1295
1295
|
$ dotenvx run --no-vlt -- yourcommand
|
|
@@ -1624,7 +1624,7 @@ $ dotenvx encrypt -f .env.production
|
|
|
1624
1624
|
</details>
|
|
1625
1625
|
<details><summary>`encrypt --no-vlt`</summary><br>
|
|
1626
1626
|
|
|
1627
|
-
Turn off [Dotenvx
|
|
1627
|
+
Turn off [Dotenvx VLT ⛨](https://dotenvx.com/vlt) features for encrypt.
|
|
1628
1628
|
|
|
1629
1629
|
```sh
|
|
1630
1630
|
$ dotenvx encrypt --no-vlt
|
|
@@ -2550,7 +2550,7 @@ $ dotenvx run --convention=nextjs -- node index.js
|
|
|
2550
2550
|
</details>
|
|
2551
2551
|
<details><summary>`config(noVlt:)` - noVlt</summary><br>
|
|
2552
2552
|
|
|
2553
|
-
Turn off [Dotenvx
|
|
2553
|
+
Turn off [Dotenvx VLT ⛨](https://dotenvx.com/vlt) features.
|
|
2554
2554
|
|
|
2555
2555
|
```js
|
|
2556
2556
|
// index.js
|
|
@@ -2650,14 +2650,14 @@ This is known as *Decryption at Access* and is written about in [the whitepaper]
|
|
|
2650
2650
|
|
|
2651
2651
|
|
|
2652
2652
|
|
|
2653
|
-
##
|
|
2653
|
+
## VLT ⛨
|
|
2654
2654
|
|
|
2655
|
-
[](https://dotenvx.com/vlt)
|
|
2655
|
+
[](https://dotenvx.com/vlt)
|
|
2656
2656
|
|
|
2657
2657
|
```
|
|
2658
2658
|
⛨ ARMORED KEYS: Harden your private keys.
|
|
2659
2659
|
⮕ install [curl -sfS https://dotenvx.sh/vlt | sh]
|
|
2660
|
-
⮕ then run [dotenvx
|
|
2660
|
+
⮕ then run [dotenvx vlt login]
|
|
2661
2661
|
```
|
|
2662
2662
|
|
|
2663
2663
|
[Learn more](https://dotenvx.com/vlt)
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@ async function decrypt () {
|
|
|
15
15
|
|
|
16
16
|
const sesh = new Session()
|
|
17
17
|
const envs = this.envs
|
|
18
|
-
const
|
|
18
|
+
const noVlt = options.vlt === false || (await sesh.noVlt())
|
|
19
19
|
|
|
20
20
|
let errorCount = 0
|
|
21
21
|
|
|
@@ -23,7 +23,7 @@ async function decrypt () {
|
|
|
23
23
|
if (options.stdout) {
|
|
24
24
|
const {
|
|
25
25
|
processedEnvs
|
|
26
|
-
} = await new Decrypt(envs, options.key, options.excludeKey, options.envKeysFile,
|
|
26
|
+
} = await new Decrypt(envs, options.key, options.excludeKey, options.envKeysFile, noVlt).run()
|
|
27
27
|
if (spinner) spinner.stop()
|
|
28
28
|
for (const processedEnv of processedEnvs) {
|
|
29
29
|
if (processedEnv.error) {
|
|
@@ -45,7 +45,7 @@ async function decrypt () {
|
|
|
45
45
|
processedEnvs,
|
|
46
46
|
changedFilepaths,
|
|
47
47
|
unchangedFilepaths
|
|
48
|
-
} = await new Decrypt(envs, options.key, options.excludeKey, options.envKeysFile,
|
|
48
|
+
} = await new Decrypt(envs, options.key, options.excludeKey, options.envKeysFile, noVlt).run()
|
|
49
49
|
|
|
50
50
|
for (const processedEnv of processedEnvs) {
|
|
51
51
|
logger.verbose(`decrypting ${processedEnv.envFilepath} (${processedEnv.filepath})`)
|
|
@@ -63,8 +63,10 @@ async function decrypt () {
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
if (spinner) spinner.stop()
|
|
66
|
+
const armoredPrivateKeyUsed = processedEnvs.some((processedEnv) => processedEnv.armoredPrivateKeyUsed)
|
|
67
|
+
const keyUsedSuffix = armoredPrivateKeyUsed ? ' · armored ⛨' : ''
|
|
66
68
|
if (changedFilepaths.length > 0) {
|
|
67
|
-
logger.success(`◇ decrypted (${changedFilepaths.join(',')})`)
|
|
69
|
+
logger.success(`◇ decrypted (${changedFilepaths.join(',')})${keyUsedSuffix}`)
|
|
68
70
|
} else if (unchangedFilepaths.length > 0) {
|
|
69
71
|
logger.info(`○ no change (${unchangedFilepaths})`)
|
|
70
72
|
} else {
|
|
@@ -4,26 +4,25 @@ const { logger } = require('./../../shared/logger')
|
|
|
4
4
|
const Encrypt = require('./../../lib/services/encrypt')
|
|
5
5
|
|
|
6
6
|
const catchAndLog = require('../../lib/helpers/catchAndLog')
|
|
7
|
-
const localDisplayPath = require('../../lib/helpers/localDisplayPath')
|
|
8
7
|
const createSpinner = require('../../lib/helpers/createSpinner')
|
|
9
8
|
const prompts = require('../../lib/helpers/prompts')
|
|
10
9
|
const Session = require('../../db/session')
|
|
11
10
|
const normalizeVltOptions = require('./normalizeVltOptions')
|
|
12
11
|
|
|
13
12
|
function keypairSpinnerHooks (spinner) {
|
|
14
|
-
let
|
|
13
|
+
let stoppedForVlt = false
|
|
15
14
|
|
|
16
15
|
return {
|
|
17
16
|
onStderr: () => {
|
|
18
|
-
if (spinner && !
|
|
17
|
+
if (spinner && !stoppedForVlt) {
|
|
19
18
|
spinner.stop()
|
|
20
|
-
|
|
19
|
+
stoppedForVlt = true
|
|
21
20
|
}
|
|
22
21
|
},
|
|
23
22
|
after: () => {
|
|
24
|
-
if (spinner &&
|
|
23
|
+
if (spinner && stoppedForVlt) {
|
|
25
24
|
spinner.start('encrypting')
|
|
26
|
-
|
|
25
|
+
stoppedForVlt = false
|
|
27
26
|
}
|
|
28
27
|
}
|
|
29
28
|
}
|
|
@@ -37,10 +36,10 @@ function keyStorageSelector (spinner) {
|
|
|
37
36
|
|
|
38
37
|
if (spinner) spinner.stop()
|
|
39
38
|
selected = await prompts.select({
|
|
40
|
-
message: '
|
|
39
|
+
message: 'Choose private key storage',
|
|
41
40
|
choices: [
|
|
42
|
-
{ name: '
|
|
43
|
-
{ name: '
|
|
41
|
+
{ name: '◫ File (.env.keys)', value: 'file' },
|
|
42
|
+
{ name: '⛨ Armor (vlt.dotenvx.com)', value: 'armored' }
|
|
44
43
|
]
|
|
45
44
|
}, {
|
|
46
45
|
input: process.stdin,
|
|
@@ -52,12 +51,12 @@ function keyStorageSelector (spinner) {
|
|
|
52
51
|
}
|
|
53
52
|
}
|
|
54
53
|
|
|
55
|
-
function encryptOptions (spinner,
|
|
54
|
+
function encryptOptions (spinner, noVlt) {
|
|
56
55
|
const options = {
|
|
57
56
|
keypairHooks: keypairSpinnerHooks(spinner)
|
|
58
57
|
}
|
|
59
58
|
|
|
60
|
-
if (!
|
|
59
|
+
if (!noVlt) {
|
|
61
60
|
options.selectKeyStorage = keyStorageSelector(spinner)
|
|
62
61
|
}
|
|
63
62
|
|
|
@@ -72,14 +71,14 @@ async function encrypt () {
|
|
|
72
71
|
|
|
73
72
|
const sesh = new Session()
|
|
74
73
|
const envs = this.envs
|
|
75
|
-
const
|
|
74
|
+
const noVlt = options.vlt === false || (!options.token && (await sesh.noVlt()))
|
|
76
75
|
const noCreate = options.create === false
|
|
77
76
|
|
|
78
77
|
// stdout - should not have a try so that exit codes can surface to stdout
|
|
79
78
|
if (options.stdout) {
|
|
80
79
|
const {
|
|
81
80
|
processedEnvs
|
|
82
|
-
} = await new Encrypt(envs, options.key, options.excludeKey, options.envKeysFile,
|
|
81
|
+
} = await new Encrypt(envs, options.key, options.excludeKey, options.envKeysFile, noVlt, noCreate, options.token, encryptOptions(spinner, noVlt)).run()
|
|
83
82
|
if (spinner) spinner.stop()
|
|
84
83
|
for (const processedEnv of processedEnvs) {
|
|
85
84
|
console.log(processedEnv.envSrc)
|
|
@@ -91,7 +90,7 @@ async function encrypt () {
|
|
|
91
90
|
processedEnvs,
|
|
92
91
|
changedFilepaths,
|
|
93
92
|
unchangedFilepaths
|
|
94
|
-
} = await new Encrypt(envs, options.key, options.excludeKey, options.envKeysFile,
|
|
93
|
+
} = await new Encrypt(envs, options.key, options.excludeKey, options.envKeysFile, noVlt, noCreate, options.token, encryptOptions(spinner, noVlt)).run()
|
|
95
94
|
|
|
96
95
|
for (const processedEnv of processedEnvs) {
|
|
97
96
|
logger.verbose(`encrypting ${processedEnv.envFilepath} (${processedEnv.filepath})`)
|
|
@@ -108,15 +107,10 @@ async function encrypt () {
|
|
|
108
107
|
|
|
109
108
|
if (spinner) spinner.stop()
|
|
110
109
|
if (changedFilepaths.length > 0) {
|
|
111
|
-
const localKeyAddedEnv = processedEnvs.find((processedEnv) => processedEnv.localPrivateKeyAdded)
|
|
112
110
|
const remoteKeyAddedEnv = processedEnvs.find((processedEnv) => processedEnv.remotePrivateKeyAdded)
|
|
113
111
|
let msg = `◈ encrypted (${changedFilepaths.join(',')})`
|
|
114
|
-
if (localKeyAddedEnv) {
|
|
115
|
-
const envKeysFilepath = localDisplayPath(localKeyAddedEnv.envKeysFilepath)
|
|
116
|
-
msg += ` + local key (${envKeysFilepath})`
|
|
117
|
-
}
|
|
118
112
|
if (remoteKeyAddedEnv) {
|
|
119
|
-
msg += '
|
|
113
|
+
msg += ' · armored ⛨'
|
|
120
114
|
}
|
|
121
115
|
logger.success(msg)
|
|
122
116
|
} else if (unchangedFilepaths.length > 0) {
|
package/src/cli/actions/get.js
CHANGED
|
@@ -30,8 +30,8 @@ async function get (key) {
|
|
|
30
30
|
|
|
31
31
|
try {
|
|
32
32
|
const sesh = new Session()
|
|
33
|
-
const
|
|
34
|
-
const { parsed, errors } = await new Get(key, envs, options.overload, options.all, options.envKeysFile,
|
|
33
|
+
const noVlt = options.vlt === false || (await sesh.noVlt())
|
|
34
|
+
const { parsed, errors } = await new Get(key, envs, options.overload, options.all, options.envKeysFile, noVlt).run()
|
|
35
35
|
|
|
36
36
|
for (const error of errors || []) {
|
|
37
37
|
if (options.strict) throw error // throw immediately if strict
|
|
@@ -17,8 +17,8 @@ async function keypair (key) {
|
|
|
17
17
|
const prettyPrint = options.prettyPrint || options.pp
|
|
18
18
|
|
|
19
19
|
const sesh = new Session()
|
|
20
|
-
const
|
|
21
|
-
const keypairs = await new Keypair(options.envFile, options.envKeysFile,
|
|
20
|
+
const noVlt = options.vlt === false || await sesh.noVlt()
|
|
21
|
+
const keypairs = await new Keypair(options.envFile, options.envKeysFile, noVlt).run()
|
|
22
22
|
const results = key ? keypairs[key] : keypairs
|
|
23
23
|
|
|
24
24
|
if (spinner) spinner.stop()
|
|
@@ -5,7 +5,6 @@ const Rotate = require('./../../lib/services/rotate')
|
|
|
5
5
|
|
|
6
6
|
const catchAndLog = require('../../lib/helpers/catchAndLog')
|
|
7
7
|
const createSpinner = require('../../lib/helpers/createSpinner')
|
|
8
|
-
const localDisplayPath = require('../../lib/helpers/localDisplayPath')
|
|
9
8
|
const Session = require('../../db/session')
|
|
10
9
|
const normalizeVltOptions = require('./normalizeVltOptions')
|
|
11
10
|
|
|
@@ -17,13 +16,13 @@ async function rotate () {
|
|
|
17
16
|
|
|
18
17
|
const envs = this.envs
|
|
19
18
|
const sesh = new Session()
|
|
20
|
-
const
|
|
19
|
+
const noVlt = options.vlt === false || (await sesh.noVlt())
|
|
21
20
|
|
|
22
21
|
// stdout - should not have a try so that exit codes can surface to stdout
|
|
23
22
|
if (options.stdout) {
|
|
24
23
|
const {
|
|
25
24
|
processedEnvs
|
|
26
|
-
} = await new Rotate(envs, options.key, options.excludeKey, options.envKeysFile,
|
|
25
|
+
} = await new Rotate(envs, options.key, options.excludeKey, options.envKeysFile, noVlt).run()
|
|
27
26
|
if (spinner) spinner.stop()
|
|
28
27
|
for (const processedEnv of processedEnvs) {
|
|
29
28
|
console.log(processedEnv.envSrc)
|
|
@@ -39,7 +38,7 @@ async function rotate () {
|
|
|
39
38
|
processedEnvs,
|
|
40
39
|
changedFilepaths,
|
|
41
40
|
unchangedFilepaths
|
|
42
|
-
} = await new Rotate(envs, options.key, options.excludeKey, options.envKeysFile,
|
|
41
|
+
} = await new Rotate(envs, options.key, options.excludeKey, options.envKeysFile, noVlt).run()
|
|
43
42
|
|
|
44
43
|
for (const processedEnv of processedEnvs) {
|
|
45
44
|
logger.verbose(`rotating ${processedEnv.envFilepath} (${processedEnv.filepath})`)
|
|
@@ -59,16 +58,11 @@ async function rotate () {
|
|
|
59
58
|
|
|
60
59
|
if (spinner) spinner.stop()
|
|
61
60
|
if (changedFilepaths.length > 0) {
|
|
62
|
-
const localKeyAddedEnv = processedEnvs.find((processedEnv) => processedEnv.localPrivateKeyAdded)
|
|
63
61
|
const remoteKeyAddedEnv = processedEnvs.find((processedEnv) => processedEnv.remotePrivateKeyAdded)
|
|
64
62
|
|
|
65
63
|
let msg = `⟳ rotated (${changedFilepaths.join(',')})`
|
|
66
|
-
if (localKeyAddedEnv) {
|
|
67
|
-
const envKeysFilepath = localDisplayPath(localKeyAddedEnv.envKeysFilepath)
|
|
68
|
-
msg += ` + local key (${envKeysFilepath})`
|
|
69
|
-
}
|
|
70
64
|
if (remoteKeyAddedEnv) {
|
|
71
|
-
msg += '
|
|
65
|
+
msg += ' · armored ⛨'
|
|
72
66
|
}
|
|
73
67
|
logger.success(msg)
|
|
74
68
|
} else if (unchangedFilepaths.length > 0) {
|
package/src/cli/actions/run.js
CHANGED
|
@@ -22,7 +22,7 @@ async function run () {
|
|
|
22
22
|
const ignore = options.ignore || []
|
|
23
23
|
|
|
24
24
|
const sesh = new Session()
|
|
25
|
-
const
|
|
25
|
+
const noVlt = options.vlt === false || (await sesh.noVlt())
|
|
26
26
|
|
|
27
27
|
if (commandArgs.length < 1) {
|
|
28
28
|
if (spinner) spinner.stop()
|
|
@@ -54,11 +54,8 @@ async function run () {
|
|
|
54
54
|
readableStrings,
|
|
55
55
|
readableFilepaths,
|
|
56
56
|
uniqueInjectedKeys
|
|
57
|
-
} = await new Run(envs, options.overload, process.env, options.envKeysFile,
|
|
57
|
+
} = await new Run(envs, options.overload, process.env, options.envKeysFile, noVlt, {
|
|
58
58
|
keypairHooks: {
|
|
59
|
-
before: () => {
|
|
60
|
-
if (spinner) spinner.start('retrieving')
|
|
61
|
-
},
|
|
62
59
|
after: () => {
|
|
63
60
|
if (spinner) spinner.start('injecting')
|
|
64
61
|
}
|
|
@@ -114,8 +111,11 @@ async function run () {
|
|
|
114
111
|
msg += ` from --env flag${readableStrings.length > 1 ? 's' : ''}`
|
|
115
112
|
}
|
|
116
113
|
|
|
114
|
+
const armoredPrivateKeyUsed = processedEnvs.some((processedEnv) => processedEnv.armoredPrivateKeyUsed)
|
|
115
|
+
const keyUsedSuffix = armoredPrivateKeyUsed ? ' · armored ⛨' : ''
|
|
116
|
+
|
|
117
117
|
if (spinner) spinner.stop()
|
|
118
|
-
logger.
|
|
118
|
+
logger.success(`⟐ ${msg}${keyUsedSuffix}`)
|
|
119
119
|
} catch (error) {
|
|
120
120
|
if (spinner) spinner.stop()
|
|
121
121
|
catchAndLog(error)
|
package/src/cli/actions/set.js
CHANGED
|
@@ -3,7 +3,6 @@ const { logger } = require('./../../shared/logger')
|
|
|
3
3
|
|
|
4
4
|
const catchAndLog = require('../../lib/helpers/catchAndLog')
|
|
5
5
|
const createSpinner = require('../../lib/helpers/createSpinner')
|
|
6
|
-
const localDisplayPath = require('../../lib/helpers/localDisplayPath')
|
|
7
6
|
const Session = require('../../db/session')
|
|
8
7
|
const Sets = require('./../../lib/services/sets')
|
|
9
8
|
const normalizeVltOptions = require('./normalizeVltOptions')
|
|
@@ -28,14 +27,14 @@ async function set (key, value) {
|
|
|
28
27
|
const sesh = new Session()
|
|
29
28
|
const envs = this.envs
|
|
30
29
|
const envKeysFilepath = options.envKeysFile
|
|
31
|
-
const
|
|
30
|
+
const noVlt = options.vlt === false || (await sesh.noVlt())
|
|
32
31
|
const noCreate = options.create === false
|
|
33
32
|
|
|
34
33
|
const {
|
|
35
34
|
processedEnvs,
|
|
36
35
|
changedFilepaths,
|
|
37
36
|
unchangedFilepaths
|
|
38
|
-
} = await new Sets(key, value, envs, encrypt, envKeysFilepath,
|
|
37
|
+
} = await new Sets(key, value, envs, encrypt, envKeysFilepath, noVlt, noCreate).run()
|
|
39
38
|
|
|
40
39
|
let withEncryption = ''
|
|
41
40
|
|
|
@@ -59,11 +58,8 @@ async function set (key, value) {
|
|
|
59
58
|
const localKeyAddedEnv = processedEnvs.find((processedEnv) => processedEnv.localPrivateKeyAdded)
|
|
60
59
|
const remoteKeyAddedEnv = processedEnvs.find((processedEnv) => processedEnv.remotePrivateKeyAdded)
|
|
61
60
|
let keyAddedSuffix = ''
|
|
62
|
-
if (localKeyAddedEnv) {
|
|
63
|
-
keyAddedSuffix = ` + local key (${localDisplayPath(localKeyAddedEnv.envKeysFilepath)})`
|
|
64
|
-
}
|
|
65
61
|
if (remoteKeyAddedEnv) {
|
|
66
|
-
keyAddedSuffix = '
|
|
62
|
+
keyAddedSuffix = ' · armored ⛨'
|
|
67
63
|
}
|
|
68
64
|
|
|
69
65
|
if (spinner) spinner.stop()
|
|
@@ -73,7 +69,7 @@ async function set (key, value) {
|
|
|
73
69
|
} else {
|
|
74
70
|
logger.success(`◇ set ${key} (${changedFilepaths.join(',')})`)
|
|
75
71
|
}
|
|
76
|
-
} else if (encrypt && localKeyAddedEnv) {
|
|
72
|
+
} else if (encrypt && localKeyAddedEnv) {
|
|
77
73
|
const localKeyAddedEnvFilepath = localKeyAddedEnv.envFilepath || changedFilepaths[0] || '.env'
|
|
78
74
|
logger.success(`◈ encrypted ${key} (${localKeyAddedEnvFilepath})${keyAddedSuffix}`)
|
|
79
75
|
} else if (unchangedFilepaths.length > 0) {
|
package/src/cli/dotenvx.js
CHANGED
|
@@ -202,12 +202,12 @@ program.command('doctor', { hidden: true })
|
|
|
202
202
|
})
|
|
203
203
|
|
|
204
204
|
// dotenvx login
|
|
205
|
-
program.command('login')
|
|
206
|
-
.description('
|
|
205
|
+
program.command('login', { hidden: true })
|
|
206
|
+
.description('')
|
|
207
207
|
.allowUnknownOption()
|
|
208
208
|
.action(() => {
|
|
209
|
-
const rawArgs = ['
|
|
210
|
-
executeDynamic(program, '
|
|
209
|
+
const rawArgs = ['vlt', 'login', ...process.argv.slice(3)]
|
|
210
|
+
executeDynamic(program, 'vlt', rawArgs)
|
|
211
211
|
})
|
|
212
212
|
|
|
213
213
|
// dotenvx logout
|
|
@@ -215,8 +215,8 @@ program.command('logout', { hidden: true })
|
|
|
215
215
|
.description('log out of your dotenvx account')
|
|
216
216
|
.allowUnknownOption()
|
|
217
217
|
.action(() => {
|
|
218
|
-
const rawArgs = ['
|
|
219
|
-
executeDynamic(program, '
|
|
218
|
+
const rawArgs = ['vlt', 'logout', ...process.argv.slice(3)]
|
|
219
|
+
executeDynamic(program, 'vlt', rawArgs)
|
|
220
220
|
})
|
|
221
221
|
|
|
222
222
|
// dotenvx armor
|
|
@@ -224,8 +224,8 @@ program.command('armor', { hidden: true })
|
|
|
224
224
|
.description('ARMORED KEYS ⛨')
|
|
225
225
|
.allowUnknownOption()
|
|
226
226
|
.action((args) => {
|
|
227
|
-
const rawArgs = ['
|
|
228
|
-
executeDynamic(program, '
|
|
227
|
+
const rawArgs = ['vlt', 'armor', ...process.argv.slice(3)]
|
|
228
|
+
executeDynamic(program, 'vlt', rawArgs)
|
|
229
229
|
})
|
|
230
230
|
|
|
231
231
|
// dotenvx help
|
|
@@ -247,8 +247,9 @@ program.command('help [command]')
|
|
|
247
247
|
// dotenvx vlt ops
|
|
248
248
|
program.addHelpText('after', ' ')
|
|
249
249
|
program.addHelpText('after', 'Advanced: ')
|
|
250
|
-
program.addHelpText('after', '
|
|
251
|
-
program.addHelpText('after', '
|
|
250
|
+
program.addHelpText('after', ' login')
|
|
251
|
+
program.addHelpText('after', ' vlt ⛨ ARMORED KEYS [www.dotenvx.com/vlt]')
|
|
252
|
+
program.addHelpText('after', ' ext ⊕ extensions')
|
|
252
253
|
|
|
253
254
|
// dotenvx ext
|
|
254
255
|
program.addCommand(require('./commands/ext'))
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
vltKeypair: require('./vltKeypair'),
|
|
3
|
+
vltKeypairSync: require('./vltKeypairSync'),
|
|
4
4
|
localKeypair: require('./localKeypair'),
|
|
5
5
|
encryptValue: require('./encryptValue'),
|
|
6
6
|
decryptKeyValue: require('./decryptKeyValue'),
|
|
@@ -2,7 +2,7 @@ const FIRST_TIME_KEYS_SRC = [
|
|
|
2
2
|
'#/------------------!DOTENV_PRIVATE_KEYS!-------------------/',
|
|
3
3
|
'#/ private decryption keys. DO NOT commit to source control /',
|
|
4
4
|
'#/ [how it works](https://dotenvx.com/encryption) /',
|
|
5
|
-
|
|
5
|
+
'#/ ⛨ ARMORED KEYS: `dotenvx armor up` /',
|
|
6
6
|
'#/----------------------------------------------------------/'
|
|
7
7
|
].join('\n')
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@ const FIRST_TIME_KEYS_SRC = [
|
|
|
2
2
|
'#/------------------!DOTENV_PRIVATE_KEYS!-------------------/',
|
|
3
3
|
'#/ private decryption keys. DO NOT commit to source control /',
|
|
4
4
|
'#/ [how it works](https://dotenvx.com/encryption) /',
|
|
5
|
-
|
|
5
|
+
'#/ ⛨ ARMORED KEYS: `dotenvx armor up` /',
|
|
6
6
|
'#/----------------------------------------------------------/'
|
|
7
7
|
].join('\n')
|
|
8
8
|
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
const mutateSrc = require('./mutateSrc')
|
|
2
2
|
const mutateKeysSrc = require('./mutateKeysSrc')
|
|
3
|
-
const
|
|
3
|
+
const vltKeypair = require('./vltKeypair')
|
|
4
4
|
const localKeypair = require('./localKeypair')
|
|
5
5
|
const { keyNames } = require('../keyResolution')
|
|
6
6
|
|
|
7
|
-
async function provision ({ envSrc, envFilepath, keysFilepath,
|
|
8
|
-
|
|
9
|
-
if (!
|
|
10
|
-
|
|
7
|
+
async function provision ({ envSrc, envFilepath, keysFilepath, noVlt, token, keypairHooks, selectKeyStorage }) {
|
|
8
|
+
noVlt = noVlt !== false
|
|
9
|
+
if (!noVlt && selectKeyStorage) {
|
|
10
|
+
noVlt = await selectKeyStorage() !== 'armored'
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
const { publicKeyName, privateKeyName } = keyNames(envFilepath)
|
|
@@ -19,12 +19,12 @@ async function provision ({ envSrc, envFilepath, keysFilepath, noOps, token, key
|
|
|
19
19
|
let localPrivateKeyAdded = false
|
|
20
20
|
let remotePrivateKeyAdded = false
|
|
21
21
|
|
|
22
|
-
if (
|
|
22
|
+
if (noVlt) {
|
|
23
23
|
const kp = localKeypair()
|
|
24
24
|
publicKey = kp.publicKey
|
|
25
25
|
privateKey = kp.privateKey
|
|
26
26
|
} else {
|
|
27
|
-
const kp = await
|
|
27
|
+
const kp = await vltKeypair(undefined, { token, envFilepath, hooks: keypairHooks })
|
|
28
28
|
publicKey = kp.publicKey
|
|
29
29
|
privateKey = kp.privateKey
|
|
30
30
|
}
|
|
@@ -32,7 +32,7 @@ async function provision ({ envSrc, envFilepath, keysFilepath, noOps, token, key
|
|
|
32
32
|
const mutated = mutateSrc({ envSrc, envFilepath, keysFilepath, publicKeyName, publicKeyValue: publicKey })
|
|
33
33
|
envSrc = mutated.envSrc
|
|
34
34
|
|
|
35
|
-
if (
|
|
35
|
+
if (noVlt) {
|
|
36
36
|
const mutated = await mutateKeysSrc({ envFilepath, keysFilepath, privateKeyName, privateKeyValue: privateKey })
|
|
37
37
|
keysSrc = mutated.keysSrc
|
|
38
38
|
envKeysFilepath = mutated.envKeysFilepath
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
const mutateSrc = require('./mutateSrc')
|
|
2
2
|
const mutateKeysSrcSync = require('./mutateKeysSrcSync')
|
|
3
|
-
const
|
|
3
|
+
const vltKeypairSync = require('./vltKeypairSync')
|
|
4
4
|
const localKeypair = require('./localKeypair')
|
|
5
5
|
const { keyNames } = require('../keyResolution')
|
|
6
6
|
|
|
7
|
-
function provisionSync ({ envSrc, envFilepath, keysFilepath,
|
|
8
|
-
|
|
7
|
+
function provisionSync ({ envSrc, envFilepath, keysFilepath, noVlt }) {
|
|
8
|
+
noVlt = noVlt !== false
|
|
9
9
|
const { publicKeyName, privateKeyName } = keyNames(envFilepath)
|
|
10
10
|
|
|
11
11
|
let publicKey
|
|
@@ -15,12 +15,12 @@ function provisionSync ({ envSrc, envFilepath, keysFilepath, noOps }) {
|
|
|
15
15
|
let localPrivateKeyAdded = false
|
|
16
16
|
let remotePrivateKeyAdded = false
|
|
17
17
|
|
|
18
|
-
if (
|
|
18
|
+
if (noVlt) {
|
|
19
19
|
const kp = localKeypair()
|
|
20
20
|
publicKey = kp.publicKey
|
|
21
21
|
privateKey = kp.privateKey
|
|
22
22
|
} else {
|
|
23
|
-
const kp =
|
|
23
|
+
const kp = vltKeypairSync(undefined, { envFilepath })
|
|
24
24
|
publicKey = kp.publicKey
|
|
25
25
|
privateKey = kp.privateKey
|
|
26
26
|
}
|
|
@@ -28,7 +28,7 @@ function provisionSync ({ envSrc, envFilepath, keysFilepath, noOps }) {
|
|
|
28
28
|
const mutated = mutateSrc({ envSrc, envFilepath, keysFilepath, publicKeyName, publicKeyValue: publicKey })
|
|
29
29
|
envSrc = mutated.envSrc
|
|
30
30
|
|
|
31
|
-
if (
|
|
31
|
+
if (noVlt) {
|
|
32
32
|
const mutated = mutateKeysSrcSync({ envFilepath, keysFilepath, privateKeyName, privateKeyValue: privateKey })
|
|
33
33
|
keysSrc = mutated.keysSrc
|
|
34
34
|
envKeysFilepath = mutated.envKeysFilepath
|
|
@@ -3,7 +3,7 @@ const mutateSrc = require('./mutateSrc')
|
|
|
3
3
|
const localKeypair = require('./localKeypair')
|
|
4
4
|
|
|
5
5
|
function provisionWithPrivateKey ({ envSrc, envFilepath, keysFilepath, privateKeyValue, publicKeyValue, publicKeyName }) {
|
|
6
|
-
const { publicKey, privateKey } = localKeypair(privateKeyValue) //
|
|
6
|
+
const { publicKey, privateKey } = localKeypair(privateKeyValue) // noVlt doesn't matter here since privateKeyValue was already discovered prior (via vlt and local) and passed as privateKeyValue
|
|
7
7
|
|
|
8
8
|
// if derivation doesn't match what's in the file (or preset in env)
|
|
9
9
|
if (publicKeyValue && publicKeyValue !== publicKey) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const Vlt = require('../../extensions/vlt')
|
|
2
2
|
|
|
3
|
-
async function
|
|
3
|
+
async function vltKeypair (existingPublicKey, options = {}) {
|
|
4
4
|
const hooks = options.hooks || {}
|
|
5
5
|
if (hooks.before) await hooks.before()
|
|
6
6
|
|
|
@@ -27,4 +27,4 @@ async function opsKeypair (existingPublicKey, options = {}) {
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
module.exports =
|
|
30
|
+
module.exports = vltKeypair
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const Vlt = require('../../extensions/vlt')
|
|
2
2
|
|
|
3
|
-
function
|
|
3
|
+
function vltKeypairSync (existingPublicKey, options = {}) {
|
|
4
4
|
const kp = new Vlt().keypairSync(existingPublicKey, options)
|
|
5
5
|
const publicKey = kp.public_key
|
|
6
6
|
const privateKey = kp.private_key
|
|
@@ -11,4 +11,4 @@ function opsKeypairSync (existingPublicKey, options = {}) {
|
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
module.exports =
|
|
14
|
+
module.exports = vltKeypairSync
|
|
@@ -2,50 +2,28 @@ const path = require('path')
|
|
|
2
2
|
const childProcess = require('child_process')
|
|
3
3
|
const { logger } = require('../../shared/logger')
|
|
4
4
|
|
|
5
|
-
function
|
|
6
|
-
return 'curl -sfS https://dotenvx.sh/ops | sh'
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
function installCommandForVlt () {
|
|
10
|
-
return 'curl -sfS https://dotenvx.sh/vlt | sh'
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
function opsBanner (installCommand) {
|
|
5
|
+
function vltBanner () {
|
|
14
6
|
const lines = [
|
|
7
|
+
' [www.dotenvx.com/vlt]',
|
|
8
|
+
'–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––',
|
|
15
9
|
'',
|
|
16
|
-
'
|
|
17
|
-
' ██╔═══██╗██╔══██╗██╔════╝',
|
|
18
|
-
' ██║ ██║██████╔╝███████╗',
|
|
19
|
-
' ██║ ██║██╔═══╝ ╚════██║ [www.dotenvx.com/ops]',
|
|
20
|
-
' ╚██████╔╝██║ ███████║',
|
|
21
|
-
' ╚═════╝ ╚═╝ ╚══════╝',
|
|
10
|
+
' Dotenvx + VLT ⛨',
|
|
22
11
|
'',
|
|
23
|
-
'
|
|
24
|
-
|
|
25
|
-
' ⮕ then run [dotenvx-ops login]'
|
|
26
|
-
]
|
|
27
|
-
|
|
28
|
-
const innerWidth = Math.max(67, ...lines.map((line) => line.length))
|
|
29
|
-
const top = ` ${'_'.repeat(innerWidth)}`
|
|
30
|
-
const middle = lines.map((line) => `|${line.padEnd(innerWidth)}|`).join('\n')
|
|
31
|
-
const bottom = `|${'_'.repeat(innerWidth)}|`
|
|
32
|
-
|
|
33
|
-
return `${top}\n${middle}\n${bottom}`
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function vltBanner (installCommand) {
|
|
37
|
-
const lines = [
|
|
12
|
+
' ARMORED KEYS',
|
|
13
|
+
' Private keys. Off device. Under guard.',
|
|
38
14
|
'',
|
|
39
|
-
'
|
|
40
|
-
' ██║ ██║██║ ╚══██╔══╝',
|
|
41
|
-
' ██║ ██║██║ ██║ ',
|
|
42
|
-
' ╚██╗ ██╔╝██║ ██║ [www.dotenvx.com/vlt]',
|
|
43
|
-
' ╚████╔╝ ███████╗██║ ',
|
|
44
|
-
' ╚═══╝ ╚══════╝╚═╝ ',
|
|
15
|
+
' -',
|
|
45
16
|
'',
|
|
46
|
-
'
|
|
47
|
-
|
|
48
|
-
'
|
|
17
|
+
' Install one',
|
|
18
|
+
' [curl -sfS https://dotenvx.sh/vlt | sh]',
|
|
19
|
+
' [npm i @dotenvx/dotenvx --save]',
|
|
20
|
+
'',
|
|
21
|
+
' -',
|
|
22
|
+
'',
|
|
23
|
+
' Then',
|
|
24
|
+
' [dotenvx armor up]',
|
|
25
|
+
' (sign in when prompted)',
|
|
26
|
+
''
|
|
49
27
|
]
|
|
50
28
|
|
|
51
29
|
const innerWidth = Math.max(67, ...lines.map((line) => line.length))
|
|
@@ -74,14 +52,18 @@ function executeDynamic (program, command, rawArgs) {
|
|
|
74
52
|
const newPath = `${binPath}:${process.env.PATH}`
|
|
75
53
|
const env = { ...process.env, PATH: newPath }
|
|
76
54
|
|
|
77
|
-
|
|
55
|
+
let spawnCommand = `dotenvx-${command}`
|
|
56
|
+
let result = childProcess.spawnSync(spawnCommand, forwardedArgs, { stdio: 'inherit', env })
|
|
57
|
+
if (command === 'ops' && result.error) {
|
|
58
|
+
spawnCommand = 'dotenvx-vlt'
|
|
59
|
+
result = childProcess.spawnSync(spawnCommand, forwardedArgs, { stdio: 'inherit', env })
|
|
60
|
+
}
|
|
61
|
+
|
|
78
62
|
if (result.error) {
|
|
79
63
|
if (command === 'vlt') {
|
|
80
|
-
|
|
81
|
-
console.log(vltBanner(installCommand))
|
|
64
|
+
console.log(vltBanner())
|
|
82
65
|
} else if (command === 'ops') {
|
|
83
|
-
|
|
84
|
-
console.log(opsBanner(installCommand))
|
|
66
|
+
console.log(vltBanner())
|
|
85
67
|
} else {
|
|
86
68
|
logger.info(`error: unknown command '${command}'`)
|
|
87
69
|
}
|
|
@@ -5,7 +5,7 @@ const dotenvParse = require('./../dotenvParse')
|
|
|
5
5
|
const keyNames = require('./keyNames')
|
|
6
6
|
const readProcessKey = require('./readProcessKey')
|
|
7
7
|
const readFileKey = require('./readFileKey')
|
|
8
|
-
const
|
|
8
|
+
const vltKeypair = require('../cryptography/vltKeypair')
|
|
9
9
|
|
|
10
10
|
async function invertForPrivateKeyName (filepath) {
|
|
11
11
|
const PUBLIC_KEY_SCHEMA = 'DOTENV_PUBLIC_KEY'
|
|
@@ -34,13 +34,14 @@ async function invertForPrivateKeyName (filepath) {
|
|
|
34
34
|
|
|
35
35
|
async function keyValues (filepath, opts = {}) {
|
|
36
36
|
let keysFilepath = opts.keysFilepath || null
|
|
37
|
-
const
|
|
37
|
+
const noVlt = opts.noVlt === true
|
|
38
38
|
const names = keyNames(filepath)
|
|
39
39
|
const publicKeyName = names.publicKeyName // DOTENV_PUBLIC_KEY_${ENVIRONMENT}
|
|
40
40
|
let privateKeyName = names.privateKeyName // DOTENV_PRIVATE_KEY_${ENVIRONMENT}
|
|
41
41
|
|
|
42
42
|
let publicKey = null
|
|
43
43
|
let privateKey = null
|
|
44
|
+
let privateKeySource = null
|
|
44
45
|
|
|
45
46
|
// public key: process.env first, then .env*
|
|
46
47
|
publicKey = readProcessKey(publicKeyName)
|
|
@@ -70,16 +71,22 @@ async function keyValues (filepath, opts = {}) {
|
|
|
70
71
|
}
|
|
71
72
|
}
|
|
72
73
|
|
|
73
|
-
//
|
|
74
|
-
if (!
|
|
75
|
-
const kp = await
|
|
74
|
+
// vlt
|
|
75
|
+
if (!noVlt && !privateKey && publicKey && publicKey.length > 0) {
|
|
76
|
+
const kp = await vltKeypair(publicKey, { envFilepath: filepath, hooks: opts.keypairHooks })
|
|
76
77
|
privateKey = kp.privateKey
|
|
78
|
+
privateKeySource = 'vlt'
|
|
77
79
|
}
|
|
78
80
|
|
|
79
|
-
|
|
81
|
+
const result = {
|
|
80
82
|
publicKeyValue: publicKey || null, // important to make sure name is rendered
|
|
81
83
|
privateKeyValue: privateKey || null // important to make sure name is rendered
|
|
82
84
|
}
|
|
85
|
+
if (privateKeySource) {
|
|
86
|
+
result.privateKeySource = privateKeySource
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return result
|
|
83
90
|
}
|
|
84
91
|
|
|
85
92
|
module.exports = keyValues
|
|
@@ -2,7 +2,7 @@ const path = require('path')
|
|
|
2
2
|
|
|
3
3
|
const dotenvParse = require('./../dotenvParse')
|
|
4
4
|
const readFileKeySync = require('./readFileKeySync')
|
|
5
|
-
const
|
|
5
|
+
const vltKeypairSync = require('../cryptography/vltKeypairSync')
|
|
6
6
|
|
|
7
7
|
const PUBLIC_KEY_SCHEMA = 'DOTENV_PUBLIC_KEY'
|
|
8
8
|
const PRIVATE_KEY_SCHEMA = 'DOTENV_PRIVATE_KEY'
|
|
@@ -25,7 +25,7 @@ function publicKeyNameFromEnvSrc (envParsed) {
|
|
|
25
25
|
|
|
26
26
|
function keyValuesFromEnvSrc (src, privateKeyName = null, opts = {}) {
|
|
27
27
|
let keysFilepath = opts.keysFilepath || null
|
|
28
|
-
const
|
|
28
|
+
const noVlt = opts.noVlt === true
|
|
29
29
|
const processEnv = opts.processEnv || process.env
|
|
30
30
|
const envParsed = dotenvParse(src)
|
|
31
31
|
|
|
@@ -37,6 +37,7 @@ function keyValuesFromEnvSrc (src, privateKeyName = null, opts = {}) {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
let privateKeyValue = null
|
|
40
|
+
let privateKeySource = null
|
|
40
41
|
if (privateKeyName) {
|
|
41
42
|
privateKeyValue = readProcessKey(processEnv, privateKeyName)
|
|
42
43
|
|
|
@@ -51,16 +52,22 @@ function keyValuesFromEnvSrc (src, privateKeyName = null, opts = {}) {
|
|
|
51
52
|
}
|
|
52
53
|
}
|
|
53
54
|
|
|
54
|
-
if (!
|
|
55
|
-
const kp =
|
|
55
|
+
if (!noVlt && !privateKeyValue && publicKeyValue && publicKeyValue.length > 0) {
|
|
56
|
+
const kp = vltKeypairSync(publicKeyValue)
|
|
56
57
|
privateKeyValue = kp.privateKey
|
|
58
|
+
privateKeySource = 'vlt'
|
|
57
59
|
}
|
|
58
60
|
|
|
59
|
-
|
|
61
|
+
const result = {
|
|
60
62
|
publicKeyValue: publicKeyValue || null,
|
|
61
63
|
privateKeyValue: privateKeyValue || null,
|
|
62
64
|
privateKeyName: privateKeyName || null
|
|
63
65
|
}
|
|
66
|
+
if (privateKeySource) {
|
|
67
|
+
result.privateKeySource = privateKeySource
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return result
|
|
64
71
|
}
|
|
65
72
|
|
|
66
73
|
module.exports = keyValuesFromEnvSrc
|
|
@@ -5,7 +5,7 @@ const dotenvParse = require('./../dotenvParse')
|
|
|
5
5
|
const keyNames = require('./keyNames')
|
|
6
6
|
const readProcessKey = require('./readProcessKey')
|
|
7
7
|
const readFileKeySync = require('./readFileKeySync')
|
|
8
|
-
const
|
|
8
|
+
const vltKeypairSync = require('../cryptography/vltKeypairSync')
|
|
9
9
|
|
|
10
10
|
function invertForPrivateKeyName (filepath) {
|
|
11
11
|
const PUBLIC_KEY_SCHEMA = 'DOTENV_PUBLIC_KEY'
|
|
@@ -34,13 +34,14 @@ function invertForPrivateKeyName (filepath) {
|
|
|
34
34
|
|
|
35
35
|
function keyValuesSync (filepath, opts = {}) {
|
|
36
36
|
let keysFilepath = opts.keysFilepath || null
|
|
37
|
-
const
|
|
37
|
+
const noVlt = opts.noVlt === true
|
|
38
38
|
const names = keyNames(filepath)
|
|
39
39
|
const publicKeyName = names.publicKeyName // DOTENV_PUBLIC_KEY_${ENVIRONMENT}
|
|
40
40
|
let privateKeyName = names.privateKeyName // DOTENV_PRIVATE_KEY_${ENVIRONMENT}
|
|
41
41
|
|
|
42
42
|
let publicKey = null
|
|
43
43
|
let privateKey = null
|
|
44
|
+
let privateKeySource = null
|
|
44
45
|
|
|
45
46
|
// public key: process.env first, then .env*
|
|
46
47
|
publicKey = readProcessKey(publicKeyName)
|
|
@@ -70,21 +71,27 @@ function keyValuesSync (filepath, opts = {}) {
|
|
|
70
71
|
}
|
|
71
72
|
}
|
|
72
73
|
|
|
73
|
-
//
|
|
74
|
-
if (!
|
|
75
|
-
const
|
|
74
|
+
// vlt
|
|
75
|
+
if (!noVlt && !privateKey && publicKey && publicKey.length > 0) {
|
|
76
|
+
const vltOptions = { envFilepath: filepath }
|
|
76
77
|
if (opts.noSpinner) {
|
|
77
|
-
|
|
78
|
+
vltOptions.noSpinner = true
|
|
78
79
|
}
|
|
79
80
|
|
|
80
|
-
const kp =
|
|
81
|
+
const kp = vltKeypairSync(publicKey, vltOptions)
|
|
81
82
|
privateKey = kp.privateKey
|
|
83
|
+
privateKeySource = 'vlt'
|
|
82
84
|
}
|
|
83
85
|
|
|
84
|
-
|
|
86
|
+
const result = {
|
|
85
87
|
publicKeyValue: publicKey || null, // important to make sure name is rendered
|
|
86
88
|
privateKeyValue: privateKey || null // important to make sure name is rendered
|
|
87
89
|
}
|
|
90
|
+
if (privateKeySource) {
|
|
91
|
+
result.privateKeySource = privateKeySource
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return result
|
|
88
95
|
}
|
|
89
96
|
|
|
90
97
|
module.exports = keyValuesSync
|
package/src/lib/main.js
CHANGED
|
@@ -20,7 +20,6 @@ const buildEnvs = require('./helpers/buildEnvs')
|
|
|
20
20
|
const { determine } = require('./helpers/envResolution')
|
|
21
21
|
const Parse = require('./helpers/parse')
|
|
22
22
|
const fsx = require('./helpers/fsx')
|
|
23
|
-
const localDisplayPath = require('./helpers/localDisplayPath')
|
|
24
23
|
|
|
25
24
|
/** @type {import('./main').config} */
|
|
26
25
|
const config = function (options = {}) {
|
|
@@ -48,8 +47,8 @@ const config = function (options = {}) {
|
|
|
48
47
|
setLogVersion(options)
|
|
49
48
|
}
|
|
50
49
|
|
|
51
|
-
// dotenvx-
|
|
52
|
-
const
|
|
50
|
+
// dotenvx-vlt related
|
|
51
|
+
const noVlt = resolveNoVlt(options)
|
|
53
52
|
|
|
54
53
|
try {
|
|
55
54
|
let envs = buildEnvs(options)
|
|
@@ -60,7 +59,7 @@ const config = function (options = {}) {
|
|
|
60
59
|
processedEnvs,
|
|
61
60
|
readableFilepaths,
|
|
62
61
|
uniqueInjectedKeys
|
|
63
|
-
} = new Run(envs, overload, processEnv, envKeysFile,
|
|
62
|
+
} = new Run(envs, overload, processEnv, envKeysFile, noVlt, {
|
|
64
63
|
noSpinner: options.noSpinner
|
|
65
64
|
}).runSync()
|
|
66
65
|
|
|
@@ -180,13 +179,13 @@ const set = function (key, value, options = {}) {
|
|
|
180
179
|
|
|
181
180
|
const envs = buildEnvs(options)
|
|
182
181
|
const envKeysFilepath = options.envKeysFile
|
|
183
|
-
const
|
|
182
|
+
const noVlt = resolveNoVlt(options)
|
|
184
183
|
|
|
185
184
|
const {
|
|
186
185
|
processedEnvs,
|
|
187
186
|
changedFilepaths,
|
|
188
187
|
unchangedFilepaths
|
|
189
|
-
} = new Sets(key, value, envs, encrypt, envKeysFilepath,
|
|
188
|
+
} = new Sets(key, value, envs, encrypt, envKeysFilepath, noVlt).runSync()
|
|
190
189
|
|
|
191
190
|
let withEncryption = ''
|
|
192
191
|
|
|
@@ -213,11 +212,8 @@ const set = function (key, value, options = {}) {
|
|
|
213
212
|
const localKeyAddedEnv = processedEnvs.find((processedEnv) => processedEnv.localPrivateKeyAdded)
|
|
214
213
|
const remoteKeyAddedEnv = processedEnvs.find((processedEnv) => processedEnv.remotePrivateKeyAdded)
|
|
215
214
|
|
|
216
|
-
if (localKeyAddedEnv) {
|
|
217
|
-
keyAddedSuffix = ` + local key (${localDisplayPath(localKeyAddedEnv.envKeysFilepath)})`
|
|
218
|
-
}
|
|
219
215
|
if (remoteKeyAddedEnv) {
|
|
220
|
-
keyAddedSuffix = '
|
|
216
|
+
keyAddedSuffix = ' · armored ⛨'
|
|
221
217
|
}
|
|
222
218
|
|
|
223
219
|
if (changedFilepaths.length > 0) {
|
|
@@ -247,12 +243,12 @@ const set = function (key, value, options = {}) {
|
|
|
247
243
|
/* @type {import('./main').get} */
|
|
248
244
|
const get = function (key, options = {}) {
|
|
249
245
|
const envs = buildEnvs(options)
|
|
250
|
-
const
|
|
246
|
+
const noVlt = resolveNoVlt(options)
|
|
251
247
|
|
|
252
248
|
// ignore
|
|
253
249
|
const ignore = options.ignore || []
|
|
254
250
|
|
|
255
|
-
const { parsed, errors } = new Get(key, envs, options.overload, options.all, options.envKeysFile,
|
|
251
|
+
const { parsed, errors } = new Get(key, envs, options.overload, options.all, options.envKeysFile, noVlt).runSync()
|
|
256
252
|
|
|
257
253
|
for (const error of errors || []) {
|
|
258
254
|
if (ignore.includes(error.code)) {
|
|
@@ -317,8 +313,8 @@ const genexample = function (directory, envFile) {
|
|
|
317
313
|
}
|
|
318
314
|
|
|
319
315
|
/** @type {import('./main').keypair} */
|
|
320
|
-
const keypair = function (envFile, key, envKeysFile = null,
|
|
321
|
-
const keypairs = new Keypair(envFile, envKeysFile,
|
|
316
|
+
const keypair = function (envFile, key, envKeysFile = null, noVlt = false) {
|
|
317
|
+
const keypairs = new Keypair(envFile, envKeysFile, noVlt).runSync()
|
|
322
318
|
if (key) {
|
|
323
319
|
return keypairs[key]
|
|
324
320
|
} else {
|
|
@@ -326,9 +322,9 @@ const keypair = function (envFile, key, envKeysFile = null, noOps = false) {
|
|
|
326
322
|
}
|
|
327
323
|
}
|
|
328
324
|
|
|
329
|
-
function
|
|
325
|
+
function resolveNoVlt (options = {}) {
|
|
330
326
|
const sesh = new Session()
|
|
331
|
-
return options.
|
|
327
|
+
return options.noVlt === true || options.noOps === true || sesh.noVltSync()
|
|
332
328
|
}
|
|
333
329
|
|
|
334
330
|
module.exports = {
|
|
@@ -25,12 +25,12 @@ const dotenvParse = require('./../helpers/dotenvParse')
|
|
|
25
25
|
const detectEncoding = require('./../helpers/detectEncoding')
|
|
26
26
|
|
|
27
27
|
class Decrypt {
|
|
28
|
-
constructor (envs = [], key = [], excludeKey = [], envKeysFilepath = null,
|
|
28
|
+
constructor (envs = [], key = [], excludeKey = [], envKeysFilepath = null, noVlt = false) {
|
|
29
29
|
this.envs = determine(envs, process.env)
|
|
30
30
|
this.key = key
|
|
31
31
|
this.excludeKey = excludeKey
|
|
32
32
|
this.envKeysFilepath = envKeysFilepath
|
|
33
|
-
this.
|
|
33
|
+
this.noVlt = noVlt
|
|
34
34
|
|
|
35
35
|
this.processedEnvs = []
|
|
36
36
|
this.changedFilepaths = new Set()
|
|
@@ -77,9 +77,11 @@ class Decrypt {
|
|
|
77
77
|
const envParsed = dotenvParse(envSrc, false, false, true)
|
|
78
78
|
|
|
79
79
|
const { privateKeyName } = keyNames(envFilepath)
|
|
80
|
-
const { privateKeyValue } = await keyValues(envFilepath, { keysFilepath: this.envKeysFilepath,
|
|
80
|
+
const { privateKeyValue, privateKeySource } = await keyValues(envFilepath, { keysFilepath: this.envKeysFilepath, noVlt: this.noVlt })
|
|
81
81
|
|
|
82
82
|
row.privateKey = privateKeyValue
|
|
83
|
+
row.privateKeySource = privateKeySource
|
|
84
|
+
row.armoredPrivateKeyUsed = privateKeySource === 'vlt'
|
|
83
85
|
row.privateKeyName = privateKeyName
|
|
84
86
|
row.changed = false // track possible changes
|
|
85
87
|
|
|
@@ -29,12 +29,12 @@ const detectEncoding = require('./../helpers/detectEncoding')
|
|
|
29
29
|
const SAMPLE_ENV_KIT = require('./../helpers/kits/sample')
|
|
30
30
|
|
|
31
31
|
class Encrypt {
|
|
32
|
-
constructor (envs = [], key = [], excludeKey = [], envKeysFilepath = null,
|
|
32
|
+
constructor (envs = [], key = [], excludeKey = [], envKeysFilepath = null, noVlt = false, noCreate = false, token = undefined, options = {}) {
|
|
33
33
|
this.envs = determine(envs, process.env)
|
|
34
34
|
this.key = key
|
|
35
35
|
this.excludeKey = excludeKey
|
|
36
36
|
this.envKeysFilepath = envKeysFilepath
|
|
37
|
-
this.
|
|
37
|
+
this.noVlt = noVlt
|
|
38
38
|
this.noCreate = noCreate
|
|
39
39
|
this.token = token
|
|
40
40
|
this.keypairHooks = options.keypairHooks
|
|
@@ -105,7 +105,7 @@ class Encrypt {
|
|
|
105
105
|
const { publicKeyName, privateKeyName } = keyNames(envFilepath)
|
|
106
106
|
const { publicKeyValue, privateKeyValue } = await keyValues(envFilepath, {
|
|
107
107
|
keysFilepath: this.envKeysFilepath,
|
|
108
|
-
|
|
108
|
+
noVlt: this.noVlt,
|
|
109
109
|
keypairHooks: this.keypairHooks
|
|
110
110
|
})
|
|
111
111
|
|
|
@@ -115,7 +115,7 @@ class Encrypt {
|
|
|
115
115
|
envSrc,
|
|
116
116
|
envFilepath,
|
|
117
117
|
keysFilepath: this.envKeysFilepath,
|
|
118
|
-
|
|
118
|
+
noVlt: this.noVlt,
|
|
119
119
|
token: this.token,
|
|
120
120
|
keypairHooks: this.keypairHooks,
|
|
121
121
|
selectKeyStorage: this.selectKeyStorage
|
package/src/lib/services/get.js
CHANGED
|
@@ -3,26 +3,26 @@ const Errors = require('./../helpers/errors')
|
|
|
3
3
|
const { determine } = require('./../helpers/envResolution')
|
|
4
4
|
|
|
5
5
|
class Get {
|
|
6
|
-
constructor (key, envs = [], overload = false, all = false, envKeysFilepath = null,
|
|
6
|
+
constructor (key, envs = [], overload = false, all = false, envKeysFilepath = null, noVlt = false) {
|
|
7
7
|
this.key = key
|
|
8
8
|
this.envs = envs
|
|
9
9
|
this.overload = overload
|
|
10
10
|
this.all = all
|
|
11
11
|
this.envKeysFilepath = envKeysFilepath
|
|
12
|
-
this.
|
|
12
|
+
this.noVlt = noVlt
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
runSync () {
|
|
16
16
|
const processEnv = { ...process.env }
|
|
17
17
|
const envs = determine(this.envs, processEnv)
|
|
18
|
-
const { processedEnvs } = new Run(envs, this.overload, processEnv, this.envKeysFilepath, this.
|
|
18
|
+
const { processedEnvs } = new Run(envs, this.overload, processEnv, this.envKeysFilepath, this.noVlt).runSync()
|
|
19
19
|
return this._result(processedEnvs, processEnv)
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
async run () {
|
|
23
23
|
const processEnv = { ...process.env }
|
|
24
24
|
const envs = determine(this.envs, processEnv)
|
|
25
|
-
const { processedEnvs } = await new Run(envs, this.overload, processEnv, this.envKeysFilepath, this.
|
|
25
|
+
const { processedEnvs } = await new Run(envs, this.overload, processEnv, this.envKeysFilepath, this.noVlt).run()
|
|
26
26
|
return this._result(processedEnvs, processEnv)
|
|
27
27
|
}
|
|
28
28
|
|
|
@@ -5,10 +5,10 @@ const {
|
|
|
5
5
|
} = require('./../helpers/keyResolution')
|
|
6
6
|
|
|
7
7
|
class Keypair {
|
|
8
|
-
constructor (envFile = '.env', envKeysFilepath = null,
|
|
8
|
+
constructor (envFile = '.env', envKeysFilepath = null, noVlt = false) {
|
|
9
9
|
this.envFile = envFile
|
|
10
10
|
this.envKeysFilepath = envKeysFilepath
|
|
11
|
-
this.
|
|
11
|
+
this.noVlt = noVlt
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
runSync () {
|
|
@@ -17,7 +17,7 @@ class Keypair {
|
|
|
17
17
|
const filepaths = this._filepaths()
|
|
18
18
|
for (const filepath of filepaths) {
|
|
19
19
|
const { publicKeyName, privateKeyName } = keyNames(filepath)
|
|
20
|
-
const { publicKeyValue, privateKeyValue } = keyValuesSync(filepath, { keysFilepath: this.envKeysFilepath,
|
|
20
|
+
const { publicKeyValue, privateKeyValue } = keyValuesSync(filepath, { keysFilepath: this.envKeysFilepath, noVlt: this.noVlt })
|
|
21
21
|
|
|
22
22
|
out[publicKeyName] = publicKeyValue
|
|
23
23
|
out[privateKeyName] = privateKeyValue
|
|
@@ -32,7 +32,7 @@ class Keypair {
|
|
|
32
32
|
const filepaths = this._filepaths()
|
|
33
33
|
for (const filepath of filepaths) {
|
|
34
34
|
const { publicKeyName, privateKeyName } = keyNames(filepath)
|
|
35
|
-
const { publicKeyValue, privateKeyValue } = await keyValues(filepath, { keysFilepath: this.envKeysFilepath,
|
|
35
|
+
const { publicKeyValue, privateKeyValue } = await keyValues(filepath, { keysFilepath: this.envKeysFilepath, noVlt: this.noVlt })
|
|
36
36
|
|
|
37
37
|
out[publicKeyName] = publicKeyValue
|
|
38
38
|
out[privateKeyName] = privateKeyValue
|
|
@@ -16,7 +16,7 @@ const {
|
|
|
16
16
|
} = require('./../helpers/keyResolution')
|
|
17
17
|
|
|
18
18
|
const {
|
|
19
|
-
|
|
19
|
+
vltKeypair,
|
|
20
20
|
localKeypair,
|
|
21
21
|
encryptValue,
|
|
22
22
|
decryptKeyValue,
|
|
@@ -29,12 +29,12 @@ const dotenvParse = require('./../helpers/dotenvParse')
|
|
|
29
29
|
const detectEncoding = require('./../helpers/detectEncoding')
|
|
30
30
|
|
|
31
31
|
class Rotate {
|
|
32
|
-
constructor (envs = [], key = [], excludeKey = [], envKeysFilepath = null,
|
|
32
|
+
constructor (envs = [], key = [], excludeKey = [], envKeysFilepath = null, noVlt = false) {
|
|
33
33
|
this.envs = determine(envs, process.env)
|
|
34
34
|
this.key = key
|
|
35
35
|
this.excludeKey = excludeKey
|
|
36
36
|
this.envKeysFilepath = envKeysFilepath
|
|
37
|
-
this.
|
|
37
|
+
this.noVlt = noVlt
|
|
38
38
|
|
|
39
39
|
this.processedEnvs = []
|
|
40
40
|
this.changedFilepaths = new Set()
|
|
@@ -83,15 +83,15 @@ class Rotate {
|
|
|
83
83
|
const envParsed = dotenvParse(envSrc, false, false, true)
|
|
84
84
|
|
|
85
85
|
const { publicKeyName, privateKeyName } = keyNames(envFilepath)
|
|
86
|
-
const { privateKeyValue } = await keyValues(envFilepath, { keysFilepath: this.envKeysFilepath,
|
|
86
|
+
const { privateKeyValue } = await keyValues(envFilepath, { keysFilepath: this.envKeysFilepath, noVlt: this.noVlt })
|
|
87
87
|
|
|
88
88
|
let newPublicKey
|
|
89
89
|
let newPrivateKey
|
|
90
90
|
let envKeysFilepath
|
|
91
91
|
let envKeysSrc
|
|
92
92
|
|
|
93
|
-
if (!this.
|
|
94
|
-
const kp = await
|
|
93
|
+
if (!this.noVlt) {
|
|
94
|
+
const kp = await vltKeypair()
|
|
95
95
|
newPublicKey = kp.publicKey
|
|
96
96
|
newPrivateKey = kp.privateKey
|
|
97
97
|
|
|
@@ -146,8 +146,8 @@ class Rotate {
|
|
|
146
146
|
row.privateKeyName = privateKeyName
|
|
147
147
|
row.privateKey = newPrivateKey
|
|
148
148
|
|
|
149
|
-
if (this.
|
|
150
|
-
// keys src only for
|
|
149
|
+
if (this.noVlt) {
|
|
150
|
+
// keys src only for vlt
|
|
151
151
|
envKeysSrc = append(envKeysSrc, privateKeyName, newPrivateKey) // append privateKey
|
|
152
152
|
this.envKeysSources[envKeysFilepath] = envKeysSrc
|
|
153
153
|
row.envKeysSrc = envKeysSrc
|
|
@@ -158,7 +158,7 @@ class Rotate {
|
|
|
158
158
|
if (e.code === 'ENOENT') {
|
|
159
159
|
const missingPath = e.path ? path.resolve(e.path) : null
|
|
160
160
|
const expectedEnvKeysPath = row.envKeysFilepath ? path.resolve(row.envKeysFilepath) : null
|
|
161
|
-
if (this.
|
|
161
|
+
if (this.noVlt && expectedEnvKeysPath && missingPath === expectedEnvKeysPath) {
|
|
162
162
|
row.error = new Errors({ envKeysFilepath: row.envKeysFilepath }).missingEnvKeysFile()
|
|
163
163
|
} else {
|
|
164
164
|
row.error = new Errors({ envFilepath, filepath }).missingEnvFile()
|
package/src/lib/services/run.js
CHANGED
|
@@ -17,12 +17,12 @@ const {
|
|
|
17
17
|
} = require('./../helpers/keyResolution')
|
|
18
18
|
|
|
19
19
|
class Run {
|
|
20
|
-
constructor (envs = [], overload = false, processEnv = process.env, envKeysFilepath = null,
|
|
20
|
+
constructor (envs = [], overload = false, processEnv = process.env, envKeysFilepath = null, noVlt = false, options = {}) {
|
|
21
21
|
this.envs = envs
|
|
22
22
|
this.overload = overload
|
|
23
23
|
this.processEnv = processEnv
|
|
24
24
|
this.envKeysFilepath = envKeysFilepath
|
|
25
|
-
this.
|
|
25
|
+
this.noVlt = noVlt
|
|
26
26
|
this.noSpinner = options.noSpinner
|
|
27
27
|
this.keypairHooks = options.keypairHooks
|
|
28
28
|
|
|
@@ -93,8 +93,9 @@ class Run {
|
|
|
93
93
|
try {
|
|
94
94
|
const {
|
|
95
95
|
privateKeyName: resolvedPrivateKeyName,
|
|
96
|
-
privateKeyValue
|
|
97
|
-
|
|
96
|
+
privateKeyValue,
|
|
97
|
+
privateKeySource
|
|
98
|
+
} = keyValuesFromEnvSrc(env, privateKeyName, { keysFilepath: this.envKeysFilepath, noVlt: this.noVlt, processEnv: this.processEnv })
|
|
98
99
|
|
|
99
100
|
const {
|
|
100
101
|
parsed,
|
|
@@ -105,6 +106,10 @@ class Run {
|
|
|
105
106
|
|
|
106
107
|
row.privateKeyName = resolvedPrivateKeyName
|
|
107
108
|
row.privateKey = privateKeyValue
|
|
109
|
+
if (privateKeySource) {
|
|
110
|
+
row.privateKeySource = privateKeySource
|
|
111
|
+
row.armoredPrivateKeyUsed = privateKeySource === 'vlt'
|
|
112
|
+
}
|
|
108
113
|
row.parsed = parsed
|
|
109
114
|
row.errors = errors
|
|
110
115
|
row.injected = injected
|
|
@@ -136,9 +141,9 @@ class Run {
|
|
|
136
141
|
this.readableFilepaths.add(envFilepath)
|
|
137
142
|
|
|
138
143
|
const { privateKeyName } = keyNames(filepath)
|
|
139
|
-
const { privateKeyValue } = keyValuesSync(filepath, {
|
|
144
|
+
const { privateKeyValue, privateKeySource } = keyValuesSync(filepath, {
|
|
140
145
|
keysFilepath: this.envKeysFilepath,
|
|
141
|
-
|
|
146
|
+
noVlt: this.noVlt,
|
|
142
147
|
noSpinner: this.noSpinner
|
|
143
148
|
})
|
|
144
149
|
|
|
@@ -151,6 +156,10 @@ class Run {
|
|
|
151
156
|
|
|
152
157
|
row.privateKeyName = privateKeyName
|
|
153
158
|
row.privateKey = privateKeyValue
|
|
159
|
+
if (privateKeySource) {
|
|
160
|
+
row.privateKeySource = privateKeySource
|
|
161
|
+
row.armoredPrivateKeyUsed = privateKeySource === 'vlt'
|
|
162
|
+
}
|
|
154
163
|
row.src = src
|
|
155
164
|
row.parsed = parsed
|
|
156
165
|
row.errors = errors
|
|
@@ -185,9 +194,9 @@ class Run {
|
|
|
185
194
|
this.readableFilepaths.add(envFilepath)
|
|
186
195
|
|
|
187
196
|
const { privateKeyName } = keyNames(filepath)
|
|
188
|
-
const { privateKeyValue } = await keyValues(filepath, {
|
|
197
|
+
const { privateKeyValue, privateKeySource } = await keyValues(filepath, {
|
|
189
198
|
keysFilepath: this.envKeysFilepath,
|
|
190
|
-
|
|
199
|
+
noVlt: this.noVlt,
|
|
191
200
|
keypairHooks: this.keypairHooks
|
|
192
201
|
})
|
|
193
202
|
|
|
@@ -200,6 +209,10 @@ class Run {
|
|
|
200
209
|
|
|
201
210
|
row.privateKeyName = privateKeyName
|
|
202
211
|
row.privateKey = privateKeyValue
|
|
212
|
+
if (privateKeySource) {
|
|
213
|
+
row.privateKeySource = privateKeySource
|
|
214
|
+
row.armoredPrivateKeyUsed = privateKeySource === 'vlt'
|
|
215
|
+
}
|
|
203
216
|
row.src = src
|
|
204
217
|
row.parsed = parsed
|
|
205
218
|
row.errors = errors
|
package/src/lib/services/sets.js
CHANGED
|
@@ -34,13 +34,13 @@ function allValuesForKey (envSrc, key) {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
class Sets {
|
|
37
|
-
constructor (key, value, envs = [], encrypt = true, envKeysFilepath = null,
|
|
37
|
+
constructor (key, value, envs = [], encrypt = true, envKeysFilepath = null, noVlt = false, noCreate = false) {
|
|
38
38
|
this.envs = determine(envs, process.env)
|
|
39
39
|
this.key = key
|
|
40
40
|
this.value = value
|
|
41
41
|
this.encrypt = encrypt
|
|
42
42
|
this.envKeysFilepath = envKeysFilepath
|
|
43
|
-
this.
|
|
43
|
+
this.noVlt = noVlt
|
|
44
44
|
this.noCreate = noCreate
|
|
45
45
|
|
|
46
46
|
this.processedEnvs = []
|
|
@@ -131,11 +131,11 @@ class Sets {
|
|
|
131
131
|
let privateKey
|
|
132
132
|
|
|
133
133
|
const { publicKeyName, privateKeyName } = keyNames(filepath)
|
|
134
|
-
const { publicKeyValue, privateKeyValue } = keyValuesSync(filepath, { keysFilepath: this.envKeysFilepath,
|
|
134
|
+
const { publicKeyValue, privateKeyValue } = keyValuesSync(filepath, { keysFilepath: this.envKeysFilepath, noVlt: this.noVlt })
|
|
135
135
|
|
|
136
136
|
// first pass - provisionSync
|
|
137
137
|
if (!privateKeyValue && !publicKeyValue) {
|
|
138
|
-
const prov = provisionSync({ envSrc, envFilepath, keysFilepath: this.envKeysFilepath,
|
|
138
|
+
const prov = provisionSync({ envSrc, envFilepath, keysFilepath: this.envKeysFilepath, noVlt: this.noVlt })
|
|
139
139
|
envSrc = prov.envSrc
|
|
140
140
|
publicKey = prov.publicKey
|
|
141
141
|
privateKey = prov.privateKey
|
|
@@ -238,11 +238,11 @@ class Sets {
|
|
|
238
238
|
let privateKey
|
|
239
239
|
|
|
240
240
|
const { publicKeyName, privateKeyName } = keyNames(filepath)
|
|
241
|
-
const { publicKeyValue, privateKeyValue } = await keyValues(filepath, { keysFilepath: this.envKeysFilepath,
|
|
241
|
+
const { publicKeyValue, privateKeyValue } = await keyValues(filepath, { keysFilepath: this.envKeysFilepath, noVlt: this.noVlt })
|
|
242
242
|
|
|
243
243
|
// first pass - provision
|
|
244
244
|
if (!privateKeyValue && !publicKeyValue) {
|
|
245
|
-
const prov = await provision({ envSrc, envFilepath, keysFilepath: this.envKeysFilepath,
|
|
245
|
+
const prov = await provision({ envSrc, envFilepath, keysFilepath: this.envKeysFilepath, noVlt: this.noVlt })
|
|
246
246
|
envSrc = prov.envSrc
|
|
247
247
|
publicKey = prov.publicKey
|
|
248
248
|
privateKey = prov.privateKey
|