@dotenvx/dotenvx 2.18.0 → 2.19.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 +11 -1
- package/README.md +41 -3
- package/package.json +8 -4
- package/src/cli/actions/armor/open.js +28 -0
- package/src/cli/commands/armor.js +9 -0
- package/src/lib/helpers/buildApiError.js +4 -1
- package/src/lib/services/armorOpen.js +26 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,7 +2,17 @@
|
|
|
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/v2.
|
|
5
|
+
[Unreleased](https://github.com/dotenvx/dotenvx/compare/v2.19.0...main)
|
|
6
|
+
|
|
7
|
+
## [2.19.0](https://github.com/dotenvx/dotenvx/compare/v2.18.1...v2.19.0) (2026-07-27)
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
* Add `dotenvx armor open` to open armored key details in browser ([#930](https://github.com/dotenvx/dotenvx/pull/930))
|
|
12
|
+
|
|
13
|
+
## [2.18.1](https://github.com/dotenvx/dotenvx/compare/v2.18.0...v2.18.1) (2026-07-26)
|
|
14
|
+
|
|
15
|
+
* Patch injected message when preset `encrypted:` value ([#927](https://github.com/dotenvx/dotenvx/issues/927))
|
|
6
16
|
|
|
7
17
|
## [2.18.0](https://github.com/dotenvx/dotenvx/compare/v2.17.4...v2.18.0) (2026-07-25)
|
|
8
18
|
|
package/README.md
CHANGED
|
@@ -3497,11 +3497,11 @@ Set `mask: 0` to fully mask values.
|
|
|
3497
3497
|
|
|
3498
3498
|
|
|
3499
3499
|
|
|
3500
|
-
###
|
|
3500
|
+
### More
|
|
3501
3501
|
|
|
3502
|
-
|
|
3502
|
+
<details><summary>Settings ⚙️</summary><br>
|
|
3503
3503
|
|
|
3504
|
-
|
|
3504
|
+
There are global settings available that can be configured as environment variables.
|
|
3505
3505
|
|
|
3506
3506
|
```ini
|
|
3507
3507
|
# config
|
|
@@ -3521,6 +3521,44 @@ DOTENVX_NO_BITWARDEN= # set to "true" to turn off Bitwarden support
|
|
|
3521
3521
|
BW_SESSION= # set to bitwarden session token to bypass password prompt
|
|
3522
3522
|
```
|
|
3523
3523
|
|
|
3524
|
+
</details>
|
|
3525
|
+
<details><summary>Error Codes 🚨</summary><br>
|
|
3526
|
+
|
|
3527
|
+
Dotenvx errors begin with a stable code in square brackets like `[MISSING_ENV_FILE]`.
|
|
3528
|
+
|
|
3529
|
+
```ini
|
|
3530
|
+
# error codes
|
|
3531
|
+
1PASSWORD_FAILED= # a value could not be resolved with the 1Password CLI
|
|
3532
|
+
ACCESS_APPROVAL_TIMEOUT= # an Armor access-approval request timed out
|
|
3533
|
+
BITWARDEN_FAILED= # a value could not be resolved with the Bitwarden CLI
|
|
3534
|
+
COMMAND_EXITED_WITH_CODE= # the command run by dotenvx exited with a non-zero status
|
|
3535
|
+
COMMAND_SUBSTITUTION_FAILED= # a $(command) expression in an environment value could not be evaluated
|
|
3536
|
+
DECRYPTION_FAILED= # an encrypted value could not be decrypted
|
|
3537
|
+
FILE_NOT_WRITABLE= # dotenvx could not write to the target file
|
|
3538
|
+
INVALID_COLOR= # the requested terminal color is invalid
|
|
3539
|
+
INVALID_CONVENTION= # the requested environment-file convention is invalid
|
|
3540
|
+
INVALID_PASSPHRASE= # a locked private key could not be unlocked with the supplied passphrase
|
|
3541
|
+
INVALID_PRIVATE_KEY= # a private key is malformed or otherwise invalid
|
|
3542
|
+
INVALID_PUBLIC_KEY= # a public key is malformed or otherwise invalid
|
|
3543
|
+
MALFORMED_ENCRYPTED_DATA= # the encrypted value is malformed
|
|
3544
|
+
MISPAIRED_PRIVATE_KEY= # a private key does not match the existing public key
|
|
3545
|
+
MISSING_DIRECTORY= # the requested directory does not exist
|
|
3546
|
+
MISSING_ENV_EXAMPLE= # the required .env.example file does not exist
|
|
3547
|
+
MISSING_ENV_FILE= # a requested environment file does not exist
|
|
3548
|
+
MISSING_ENV_FILES= # no .env* files were found
|
|
3549
|
+
MISSING_ENV_KEYS_FILE= # the requested .env.keys file does not exist
|
|
3550
|
+
MISSING_KEY= # a requested environment key does not exist
|
|
3551
|
+
MISSING_LOG_LEVEL= # the requested log level is not supported
|
|
3552
|
+
MISSING_PRIVATE_KEY= # the private key required to decrypt a value is missing
|
|
3553
|
+
MISSING_PUBLIC_KEY= # the public key required to encrypt a value is missing
|
|
3554
|
+
MISSING_REQUIRED= # validation detail for which required variables are missing; surfaced by VALIDATION_FAILED
|
|
3555
|
+
MISSING_VALUE= # no value was supplied for a key
|
|
3556
|
+
NOT_FOUND= # a private key was not found in the native secret store
|
|
3557
|
+
PRECOMMIT_HOOK_MODIFY_FAILED= # dotenvx could not update the pre-commit hook
|
|
3558
|
+
VALIDATION_FAILED= # one or more required variables declared by .env.example are missing
|
|
3559
|
+
WRONG_PRIVATE_KEY= # the supplied private key cannot decrypt the value
|
|
3560
|
+
```
|
|
3561
|
+
|
|
3524
3562
|
</details>
|
|
3525
3563
|
|
|
3526
3564
|
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "2.
|
|
2
|
+
"version": "2.19.0",
|
|
3
3
|
"name": "@dotenvx/dotenvx",
|
|
4
4
|
"description": "a secure dotenv–from the creator of `dotenv`",
|
|
5
5
|
"author": "@motdotla",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
},
|
|
53
53
|
"funding": "https://dotenvx.com",
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@dotenvx/primitives": "^2.1.
|
|
55
|
+
"@dotenvx/primitives": "^2.1.1",
|
|
56
56
|
"@dotenvx/tooling": "^1.0.3",
|
|
57
57
|
"yocto-spinner": "^1.2.1"
|
|
58
58
|
},
|
|
@@ -62,9 +62,13 @@
|
|
|
62
62
|
"esbuild": "^0.28.1",
|
|
63
63
|
"proxyquire": "^2.1.3",
|
|
64
64
|
"sinon": "^14.0.1",
|
|
65
|
-
"standard": "^17.1.
|
|
65
|
+
"standard": "^17.1.2",
|
|
66
66
|
"standard-version": "^9.5.0",
|
|
67
|
-
"tap": "^21.
|
|
67
|
+
"tap": "^21.7.4"
|
|
68
|
+
},
|
|
69
|
+
"overrides": {
|
|
70
|
+
"brace-expansion": "^5.0.8",
|
|
71
|
+
"minimatch": "^10.2.5"
|
|
68
72
|
},
|
|
69
73
|
"publishConfig": {
|
|
70
74
|
"access": "public",
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
const { logger } = require('../../../shared/logger')
|
|
2
|
+
const Session = require('./../../../db/session')
|
|
3
|
+
const ArmorOpen = require('./../../../lib/services/armorOpen')
|
|
4
|
+
const openUrl = require('../../../lib/helpers/openUrl')
|
|
5
|
+
const armoredKeyDisplay = require('../../../lib/helpers/armoredKeyDisplay')
|
|
6
|
+
|
|
7
|
+
async function open () {
|
|
8
|
+
const options = this.opts()
|
|
9
|
+
|
|
10
|
+
logger.debug(`options: ${JSON.stringify(options)}`)
|
|
11
|
+
|
|
12
|
+
const sesh = new Session()
|
|
13
|
+
await sesh.notifyUpdate()
|
|
14
|
+
const hostname = options.hostname || sesh.hostname()
|
|
15
|
+
|
|
16
|
+
try {
|
|
17
|
+
const { url, publicKeyValue } = new ArmorOpen(hostname, options.envFile).run()
|
|
18
|
+
const keyDisplay = armoredKeyDisplay(publicKeyValue)
|
|
19
|
+
|
|
20
|
+
await openUrl(url)
|
|
21
|
+
logger.success(`◌ opened (${keyDisplay})`)
|
|
22
|
+
} catch (error) {
|
|
23
|
+
logger.error(error.message)
|
|
24
|
+
process.exit(1)
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
module.exports = open
|
|
@@ -61,6 +61,15 @@ function configureArmorCommand (armor) {
|
|
|
61
61
|
return require('./../actions/armor/pull').apply(this, args)
|
|
62
62
|
})
|
|
63
63
|
|
|
64
|
+
// dotenvx armor open
|
|
65
|
+
armor
|
|
66
|
+
.command('open')
|
|
67
|
+
.description('open armored key (in browser)')
|
|
68
|
+
.option('-f, --env-file <path>', 'path to your env file')
|
|
69
|
+
.action(function (...args) {
|
|
70
|
+
return require('./../actions/armor/open').apply(this, args)
|
|
71
|
+
})
|
|
72
|
+
|
|
64
73
|
// dotenvx armor move
|
|
65
74
|
armor
|
|
66
75
|
.command('move')
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
function buildApiError (statusCode, json) {
|
|
2
2
|
const code = json.error.code || statusCode.toString()
|
|
3
3
|
const message = `[${code}] ${json.error.message}`
|
|
4
|
-
const help = `[${
|
|
4
|
+
const help = json.error.help ? `fix: [${json.error.help}]` : `[${code}] ${JSON.stringify(json)}`
|
|
5
5
|
const meta = json.error.meta
|
|
6
6
|
|
|
7
7
|
const error = new Error(message)
|
|
8
8
|
error.code = code
|
|
9
9
|
error.help = help
|
|
10
|
+
if (json.error.help) {
|
|
11
|
+
error.messageWithHelp = `${message}. ${help}`
|
|
12
|
+
}
|
|
10
13
|
error.meta = meta
|
|
11
14
|
error.json = json
|
|
12
15
|
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
const keynames = require('../conventions/keynames')
|
|
2
|
+
const readEnvKey = require('../helpers/readEnvKey')
|
|
3
|
+
|
|
4
|
+
class ArmorOpen {
|
|
5
|
+
constructor (hostname, envFile = '.env') {
|
|
6
|
+
this.hostname = hostname
|
|
7
|
+
this.envFile = envFile
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
run () {
|
|
11
|
+
const hostname = this.hostname
|
|
12
|
+
const envFile = this.envFile
|
|
13
|
+
|
|
14
|
+
const { publicKeyName } = keynames(envFile)
|
|
15
|
+
const publicKey = readEnvKey(publicKeyName, envFile, { strict: true })
|
|
16
|
+
const url = `${hostname}/go/arm_${publicKey}`
|
|
17
|
+
|
|
18
|
+
return {
|
|
19
|
+
url,
|
|
20
|
+
publicKeyName,
|
|
21
|
+
publicKeyValue: publicKey
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
module.exports = ArmorOpen
|