@dotenvx/dotenvx 1.70.0 → 1.71.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.
package/CHANGELOG.md CHANGED
@@ -2,7 +2,13 @@
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.70.0...main)
5
+ [Unreleased](https://github.com/dotenvx/dotenvx/compare/v1.71.0...main)
6
+
7
+ ## [1.71.0](https://github.com/dotenvx/dotenvx/compare/v1.70.0...v1.71.0) (2026-06-01)
8
+
9
+ ### Added
10
+
11
+ * Add optional automation `--token` support for Armor ⛨ users ([#831](https://github.com/dotenvx/dotenvx/pull/831))
6
12
 
7
13
  ## [1.70.0](https://github.com/dotenvx/dotenvx/compare/v1.69.2...v1.70.0) (2026-05-31)
8
14
 
package/README.md CHANGED
@@ -1286,6 +1286,15 @@ $ dotenvx set HELLO Dotenvx -fk .env.keys -f apps/app1/.env
1286
1286
  $ dotenvx run -fk .env.keys -f apps/app1/.env -- yourcommand
1287
1287
  ```
1288
1288
 
1289
+ </details>
1290
+ <details><summary>`run --token`</summary><br>
1291
+
1292
+ Set Armor ⛨ token for retrieving armored private keys.
1293
+
1294
+ ```sh
1295
+ $ dotenvx run --token "$DOTENVX_ARMOR_TOKEN" -- yourcommand
1296
+ ```
1297
+
1289
1298
  </details>
1290
1299
  <details><summary>`run --no-armor`</summary><br>
1291
1300
 
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.70.0",
2
+ "version": "1.71.0",
3
3
  "name": "@dotenvx/dotenvx",
4
4
  "description": "a secure dotenv–from the creator of `dotenv`",
5
5
  "author": "@motdotla",
@@ -22,7 +22,7 @@ async function run () {
22
22
  const ignore = options.ignore || []
23
23
 
24
24
  const sesh = new Session()
25
- const noArmor = options.armor === false || (await sesh.noArmor())
25
+ const noArmor = options.armor === false || (!options.token && (await sesh.noArmor()))
26
26
 
27
27
  if (commandArgs.length < 1) {
28
28
  if (spinner) spinner.stop()
@@ -55,6 +55,7 @@ async function run () {
55
55
  readableFilepaths,
56
56
  uniqueInjectedKeys
57
57
  } = await new Run(envs, options.overload, process.env, options.envKeysFile, noArmor, {
58
+ token: options.token,
58
59
  keypairHooks: {
59
60
  after: () => {
60
61
  if (spinner) spinner.start('injecting')
@@ -70,6 +70,7 @@ program.command('run')
70
70
  .option('--strict', 'process.exit(1) on any errors', false)
71
71
  .option('--convention <name>', 'load a .env convention (available conventions: [\'nextjs\', \'flow\'])')
72
72
  .option('--ignore <errorCodes...>', 'error code(s) to ignore (example: --ignore=MISSING_ENV_FILE)')
73
+ .option('--token <token>', 'set Armor ⛨ token')
73
74
  .option('--no-armor', 'disable dotenvx-armor features')
74
75
  .addOption(new Option('--no-vlt', 'disable dotenvx-vlt features (deprecated. use --no-armor)').hideHelp())
75
76
  .addOption(new Option('--no-ops', 'disable dotenvx-ops features (deprecated. use --no-armor)').hideHelp())
@@ -73,7 +73,11 @@ async function keyValues (filepath, opts = {}) {
73
73
 
74
74
  // armor
75
75
  if (!noArmor && !privateKey && publicKey && publicKey.length > 0) {
76
- const kp = await armorKeypair(publicKey, { envFilepath: filepath, hooks: opts.keypairHooks })
76
+ const armorOptions = { envFilepath: filepath, hooks: opts.keypairHooks }
77
+ if (opts.token) {
78
+ armorOptions.token = opts.token
79
+ }
80
+ const kp = await armorKeypair(publicKey, armorOptions)
77
81
  privateKey = kp.privateKey
78
82
  privateKeySource = 'armor'
79
83
  }
@@ -53,7 +53,11 @@ function keyValuesFromEnvSrc (src, privateKeyName = null, opts = {}) {
53
53
  }
54
54
 
55
55
  if (!noArmor && !privateKeyValue && publicKeyValue && publicKeyValue.length > 0) {
56
- const kp = armorKeypairSync(publicKeyValue)
56
+ const armorOptions = {}
57
+ if (opts.token) {
58
+ armorOptions.token = opts.token
59
+ }
60
+ const kp = armorKeypairSync(publicKeyValue, armorOptions)
57
61
  privateKeyValue = kp.privateKey
58
62
  privateKeySource = 'armor'
59
63
  }
@@ -74,6 +74,9 @@ function keyValuesSync (filepath, opts = {}) {
74
74
  // armor
75
75
  if (!noArmor && !privateKey && publicKey && publicKey.length > 0) {
76
76
  const armorOptions = { envFilepath: filepath }
77
+ if (opts.token) {
78
+ armorOptions.token = opts.token
79
+ }
77
80
  if (opts.noSpinner) {
78
81
  armorOptions.noSpinner = true
79
82
  }
package/src/lib/main.d.ts CHANGED
@@ -154,6 +154,13 @@ export interface DotenvConfigOptions {
154
154
  */
155
155
  noSpinner?: boolean;
156
156
 
157
+ /**
158
+ * Set Armor token.
159
+ *
160
+ * @example require('@dotenvx/dotenvx').config({ token: process.env.DOTENVX_ARMOR_TOKEN })
161
+ */
162
+ token?: string;
163
+
157
164
  logLevel?:
158
165
  | 'error'
159
166
  | 'warn'
package/src/lib/main.js CHANGED
@@ -60,7 +60,8 @@ const config = function (options = {}) {
60
60
  readableFilepaths,
61
61
  uniqueInjectedKeys
62
62
  } = new Run(envs, overload, processEnv, envKeysFile, noArmor, {
63
- noSpinner: options.noSpinner
63
+ noSpinner: options.noSpinner,
64
+ token: options.token
64
65
  }).runSync()
65
66
 
66
67
  let lastError
@@ -324,7 +325,7 @@ const keypair = function (envFile, key, envKeysFile = null, noArmor = false) {
324
325
 
325
326
  function resolveNoArmor (options = {}) {
326
327
  const sesh = new Session()
327
- return options.noArmor === true || options.noVlt === true || options.noOps === true || sesh.noArmorSync()
328
+ return options.noArmor === true || options.noVlt === true || options.noOps === true || (!options.token && sesh.noArmorSync())
328
329
  }
329
330
 
330
331
  module.exports = {
@@ -24,6 +24,7 @@ class Run {
24
24
  this.envKeysFilepath = envKeysFilepath
25
25
  this.noArmor = noArmor
26
26
  this.noSpinner = options.noSpinner
27
+ this.token = options.token
27
28
  this.keypairHooks = options.keypairHooks
28
29
 
29
30
  this.processedEnvs = []
@@ -95,7 +96,7 @@ class Run {
95
96
  privateKeyName: resolvedPrivateKeyName,
96
97
  privateKeyValue,
97
98
  privateKeySource
98
- } = keyValuesFromEnvSrc(env, privateKeyName, { keysFilepath: this.envKeysFilepath, noArmor: this.noArmor, processEnv: this.processEnv })
99
+ } = keyValuesFromEnvSrc(env, privateKeyName, { keysFilepath: this.envKeysFilepath, noArmor: this.noArmor, processEnv: this.processEnv, token: this.token })
99
100
 
100
101
  const {
101
102
  parsed,
@@ -144,7 +145,8 @@ class Run {
144
145
  const { privateKeyValue, privateKeySource } = keyValuesSync(filepath, {
145
146
  keysFilepath: this.envKeysFilepath,
146
147
  noArmor: this.noArmor,
147
- noSpinner: this.noSpinner
148
+ noSpinner: this.noSpinner,
149
+ token: this.token
148
150
  })
149
151
 
150
152
  const {
@@ -197,6 +199,7 @@ class Run {
197
199
  const { privateKeyValue, privateKeySource } = await keyValues(filepath, {
198
200
  keysFilepath: this.envKeysFilepath,
199
201
  noArmor: this.noArmor,
202
+ token: this.token,
200
203
  keypairHooks: this.keypairHooks
201
204
  })
202
205