@dotenvx/dotenvx 1.69.1 → 1.70.0

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.
Files changed (38) hide show
  1. package/CHANGELOG.md +13 -1
  2. package/README.md +21 -15
  3. package/package.json +7 -6
  4. package/src/cli/actions/decrypt.js +8 -6
  5. package/src/cli/actions/encrypt.js +16 -22
  6. package/src/cli/actions/get.js +4 -4
  7. package/src/cli/actions/keypair.js +4 -4
  8. package/src/cli/actions/normalizeArmorOptions.js +11 -0
  9. package/src/cli/actions/rotate.js +6 -12
  10. package/src/cli/actions/run.js +8 -8
  11. package/src/cli/actions/set.js +6 -10
  12. package/src/cli/commands/ext.js +1 -1
  13. package/src/cli/dotenvx.js +33 -35
  14. package/src/db/session.js +9 -9
  15. package/src/lib/extensions/{vlt.js → armor.js} +4 -4
  16. package/src/lib/helpers/cryptography/{vltKeypair.js → armorKeypair.js} +4 -4
  17. package/src/lib/helpers/cryptography/armorKeypairSync.js +14 -0
  18. package/src/lib/helpers/cryptography/index.js +2 -2
  19. package/src/lib/helpers/cryptography/mutateKeysSrc.js +2 -2
  20. package/src/lib/helpers/cryptography/mutateKeysSrcSync.js +2 -2
  21. package/src/lib/helpers/cryptography/provision.js +8 -8
  22. package/src/lib/helpers/cryptography/provisionSync.js +6 -6
  23. package/src/lib/helpers/cryptography/provisionWithPrivateKey.js +1 -1
  24. package/src/lib/helpers/executeDynamic.js +57 -19
  25. package/src/lib/helpers/keyResolution/keyValues.js +13 -6
  26. package/src/lib/helpers/keyResolution/keyValuesFromEnvSrc.js +12 -5
  27. package/src/lib/helpers/keyResolution/keyValuesSync.js +15 -8
  28. package/src/lib/main.d.ts +37 -13
  29. package/src/lib/main.js +12 -16
  30. package/src/lib/services/decrypt.js +5 -3
  31. package/src/lib/services/encrypt.js +4 -4
  32. package/src/lib/services/get.js +4 -4
  33. package/src/lib/services/keypair.js +4 -4
  34. package/src/lib/services/rotate.js +9 -9
  35. package/src/lib/services/run.js +21 -8
  36. package/src/lib/services/sets.js +6 -6
  37. package/src/cli/actions/normalizeVltOptions.js +0 -10
  38. package/src/lib/helpers/cryptography/vltKeypairSync.js +0 -14
package/src/lib/main.d.ts CHANGED
@@ -147,7 +147,7 @@ export interface DotenvConfigOptions {
147
147
  quiet?: boolean;
148
148
 
149
149
  /**
150
- * Disable spinner output from child Dotenvx Ops commands.
150
+ * Disable spinner output from child Dotenvx Armor commands.
151
151
  *
152
152
  * @default false
153
153
  * @example require('@dotenvx/dotenvx').config({ noSpinner: true })
@@ -165,21 +165,29 @@ export interface DotenvConfigOptions {
165
165
  | 'debug';
166
166
 
167
167
  /**
168
- * Turn off Dotenvx Vlt Ops features. Alias for `noVlt`.
168
+ * Turn off Dotenvx Armor features.
169
169
  *
170
170
  * @default false
171
- * @example require('@dotenvx/dotenvx').config({ noOps: true })
171
+ * @example require('@dotenvx/dotenvx').config({ noArmor: true })
172
172
  */
173
- noOps?: boolean;
173
+ noArmor?: boolean;
174
174
 
175
175
  /**
176
- * Turn off Dotenvx Vlt Ops features.
176
+ * Turn off Dotenvx Armor features. Alias for `noArmor`.
177
177
  *
178
178
  * @default false
179
179
  * @example require('@dotenvx/dotenvx').config({ noVlt: true })
180
180
  */
181
181
  noVlt?: boolean;
182
182
 
183
+ /**
184
+ * Turn off Dotenvx Armor features. Alias for `noArmor`.
185
+ *
186
+ * @default false
187
+ * @example require('@dotenvx/dotenvx').config({ noOps: true })
188
+ */
189
+ noOps?: boolean;
190
+
183
191
  }
184
192
 
185
193
  export type DotenvConfigEnv =
@@ -248,21 +256,29 @@ export interface SetOptions {
248
256
  encrypt?: boolean;
249
257
 
250
258
  /**
251
- * Turn off Dotenvx Vlt Ops features. Alias for `noVlt`.
259
+ * Turn off Dotenvx Armor features.
252
260
  *
253
261
  * @default false
254
- * @example require('@dotenvx/dotenvx').set(key, value, { noOps: true })
262
+ * @example require('@dotenvx/dotenvx').set(key, value, { noArmor: true })
255
263
  */
256
- noOps?: boolean;
264
+ noArmor?: boolean;
257
265
 
258
266
  /**
259
- * Turn off Dotenvx Vlt Ops features.
267
+ * Turn off Dotenvx Armor features. Alias for `noArmor`.
260
268
  *
261
269
  * @default false
262
270
  * @example require('@dotenvx/dotenvx').set(key, value, { noVlt: true })
263
271
  */
264
272
  noVlt?: boolean;
265
273
 
274
+ /**
275
+ * Turn off Dotenvx Armor features. Alias for `noArmor`.
276
+ *
277
+ * @default false
278
+ * @example require('@dotenvx/dotenvx').set(key, value, { noOps: true })
279
+ */
280
+ noOps?: boolean;
281
+
266
282
  }
267
283
 
268
284
  export type SetProcessedEnv = {
@@ -333,21 +349,29 @@ export interface GetOptions {
333
349
  strict?: boolean;
334
350
 
335
351
  /**
336
- * Turn off Dotenvx Vlt Ops features. Alias for `noVlt`.
352
+ * Turn off Dotenvx Armor features.
337
353
  *
338
354
  * @default false
339
- * @example require('@dotenvx/dotenvx').get('KEY', { noOps: true })
355
+ * @example require('@dotenvx/dotenvx').get('KEY', { noArmor: true })
340
356
  */
341
- noOps?: boolean;
357
+ noArmor?: boolean;
342
358
 
343
359
  /**
344
- * Turn off Dotenvx Vlt Ops features.
360
+ * Turn off Dotenvx Armor features. Alias for `noArmor`.
345
361
  *
346
362
  * @default false
347
363
  * @example require('@dotenvx/dotenvx').get('KEY', { noVlt: true })
348
364
  */
349
365
  noVlt?: boolean;
350
366
 
367
+ /**
368
+ * Turn off Dotenvx Armor features. Alias for `noArmor`.
369
+ *
370
+ * @default false
371
+ * @example require('@dotenvx/dotenvx').get('KEY', { noOps: true })
372
+ */
373
+ noOps?: boolean;
374
+
351
375
  }
352
376
 
353
377
  /**
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-vlt related
52
- const noVlt = resolveNoVlt(options)
50
+ // dotenvx-armor related
51
+ const noArmor = resolveNoArmor(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, noVlt, {
62
+ } = new Run(envs, overload, processEnv, envKeysFile, noArmor, {
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 noVlt = resolveNoVlt(options)
182
+ const noArmor = resolveNoArmor(options)
184
183
 
185
184
  const {
186
185
  processedEnvs,
187
186
  changedFilepaths,
188
187
  unchangedFilepaths
189
- } = new Sets(key, value, envs, encrypt, envKeysFilepath, noVlt).runSync()
188
+ } = new Sets(key, value, envs, encrypt, envKeysFilepath, noArmor).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 = ' + armored key ⛨'
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 noVlt = resolveNoVlt(options)
246
+ const noArmor = resolveNoArmor(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, noVlt).runSync()
251
+ const { parsed, errors } = new Get(key, envs, options.overload, options.all, options.envKeysFile, noArmor).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, noVlt = false) {
321
- const keypairs = new Keypair(envFile, envKeysFile, noVlt).runSync()
316
+ const keypair = function (envFile, key, envKeysFile = null, noArmor = false) {
317
+ const keypairs = new Keypair(envFile, envKeysFile, noArmor).runSync()
322
318
  if (key) {
323
319
  return keypairs[key]
324
320
  } else {
@@ -326,9 +322,9 @@ const keypair = function (envFile, key, envKeysFile = null, noVlt = false) {
326
322
  }
327
323
  }
328
324
 
329
- function resolveNoVlt (options = {}) {
325
+ function resolveNoArmor (options = {}) {
330
326
  const sesh = new Session()
331
- return options.noVlt === true || options.noOps === true || sesh.noVltSync()
327
+ return options.noArmor === true || options.noVlt === true || options.noOps === true || sesh.noArmorSync()
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, noVlt = false) {
28
+ constructor (envs = [], key = [], excludeKey = [], envKeysFilepath = null, noArmor = 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.noVlt = noVlt
33
+ this.noArmor = noArmor
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, noVlt: this.noVlt })
80
+ const { privateKeyValue, privateKeySource } = await keyValues(envFilepath, { keysFilepath: this.envKeysFilepath, noArmor: this.noArmor })
81
81
 
82
82
  row.privateKey = privateKeyValue
83
+ row.privateKeySource = privateKeySource
84
+ row.armoredPrivateKeyUsed = privateKeySource === 'armor'
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, noVlt = false, noCreate = false, token = undefined, options = {}) {
32
+ constructor (envs = [], key = [], excludeKey = [], envKeysFilepath = null, noArmor = 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.noVlt = noVlt
37
+ this.noArmor = noArmor
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
- noVlt: this.noVlt,
108
+ noArmor: this.noArmor,
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
- noVlt: this.noVlt,
118
+ noArmor: this.noArmor,
119
119
  token: this.token,
120
120
  keypairHooks: this.keypairHooks,
121
121
  selectKeyStorage: this.selectKeyStorage
@@ -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, noVlt = false) {
6
+ constructor (key, envs = [], overload = false, all = false, envKeysFilepath = null, noArmor = 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.noVlt = noVlt
12
+ this.noArmor = noArmor
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.noVlt).runSync()
18
+ const { processedEnvs } = new Run(envs, this.overload, processEnv, this.envKeysFilepath, this.noArmor).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.noVlt).run()
25
+ const { processedEnvs } = await new Run(envs, this.overload, processEnv, this.envKeysFilepath, this.noArmor).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, noVlt = false) {
8
+ constructor (envFile = '.env', envKeysFilepath = null, noArmor = false) {
9
9
  this.envFile = envFile
10
10
  this.envKeysFilepath = envKeysFilepath
11
- this.noVlt = noVlt
11
+ this.noArmor = noArmor
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, noVlt: this.noVlt })
20
+ const { publicKeyValue, privateKeyValue } = keyValuesSync(filepath, { keysFilepath: this.envKeysFilepath, noArmor: this.noArmor })
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, noVlt: this.noVlt })
35
+ const { publicKeyValue, privateKeyValue } = await keyValues(filepath, { keysFilepath: this.envKeysFilepath, noArmor: this.noArmor })
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
- vltKeypair,
19
+ armorKeypair,
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, noVlt = false) {
32
+ constructor (envs = [], key = [], excludeKey = [], envKeysFilepath = null, noArmor = 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.noVlt = noVlt
37
+ this.noArmor = noArmor
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, noVlt: this.noVlt })
86
+ const { privateKeyValue } = await keyValues(envFilepath, { keysFilepath: this.envKeysFilepath, noArmor: this.noArmor })
87
87
 
88
88
  let newPublicKey
89
89
  let newPrivateKey
90
90
  let envKeysFilepath
91
91
  let envKeysSrc
92
92
 
93
- if (!this.noVlt) {
94
- const kp = await vltKeypair()
93
+ if (!this.noArmor) {
94
+ const kp = await armorKeypair()
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.noVlt) {
150
- // keys src only for vlt
149
+ if (this.noArmor) {
150
+ // keys src only for local key storage
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.noVlt && expectedEnvKeysPath && missingPath === expectedEnvKeysPath) {
161
+ if (this.noArmor && 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()
@@ -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, noVlt = false, options = {}) {
20
+ constructor (envs = [], overload = false, processEnv = process.env, envKeysFilepath = null, noArmor = false, options = {}) {
21
21
  this.envs = envs
22
22
  this.overload = overload
23
23
  this.processEnv = processEnv
24
24
  this.envKeysFilepath = envKeysFilepath
25
- this.noVlt = noVlt
25
+ this.noArmor = noArmor
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
- } = keyValuesFromEnvSrc(env, privateKeyName, { keysFilepath: this.envKeysFilepath, noVlt: this.noVlt, processEnv: this.processEnv })
96
+ privateKeyValue,
97
+ privateKeySource
98
+ } = keyValuesFromEnvSrc(env, privateKeyName, { keysFilepath: this.envKeysFilepath, noArmor: this.noArmor, 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 === 'armor'
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
- noVlt: this.noVlt,
146
+ noArmor: this.noArmor,
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 === 'armor'
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
- noVlt: this.noVlt,
199
+ noArmor: this.noArmor,
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 === 'armor'
215
+ }
203
216
  row.src = src
204
217
  row.parsed = parsed
205
218
  row.errors = errors
@@ -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, noVlt = false, noCreate = false) {
37
+ constructor (key, value, envs = [], encrypt = true, envKeysFilepath = null, noArmor = 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.noVlt = noVlt
43
+ this.noArmor = noArmor
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, noVlt: this.noVlt })
134
+ const { publicKeyValue, privateKeyValue } = keyValuesSync(filepath, { keysFilepath: this.envKeysFilepath, noArmor: this.noArmor })
135
135
 
136
136
  // first pass - provisionSync
137
137
  if (!privateKeyValue && !publicKeyValue) {
138
- const prov = provisionSync({ envSrc, envFilepath, keysFilepath: this.envKeysFilepath, noVlt: this.noVlt })
138
+ const prov = provisionSync({ envSrc, envFilepath, keysFilepath: this.envKeysFilepath, noArmor: this.noArmor })
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, noVlt: this.noVlt })
241
+ const { publicKeyValue, privateKeyValue } = await keyValues(filepath, { keysFilepath: this.envKeysFilepath, noArmor: this.noArmor })
242
242
 
243
243
  // first pass - provision
244
244
  if (!privateKeyValue && !publicKeyValue) {
245
- const prov = await provision({ envSrc, envFilepath, keysFilepath: this.envKeysFilepath, noVlt: this.noVlt })
245
+ const prov = await provision({ envSrc, envFilepath, keysFilepath: this.envKeysFilepath, noArmor: this.noArmor })
246
246
  envSrc = prov.envSrc
247
247
  publicKey = prov.publicKey
248
248
  privateKey = prov.privateKey
@@ -1,10 +0,0 @@
1
- function normalizeVltOptions (options) {
2
- if (options.ops === false || options.vlt === false) {
3
- options.ops = false
4
- options.vlt = false
5
- }
6
-
7
- return options
8
- }
9
-
10
- module.exports = normalizeVltOptions
@@ -1,14 +0,0 @@
1
- const Vlt = require('../../extensions/vlt')
2
-
3
- function vltKeypairSync (existingPublicKey, options = {}) {
4
- const kp = new Vlt().keypairSync(existingPublicKey, options)
5
- const publicKey = kp.public_key
6
- const privateKey = kp.private_key
7
-
8
- return {
9
- publicKey,
10
- privateKey
11
- }
12
- }
13
-
14
- module.exports = vltKeypairSync