@dotenvx/dotenvx-vlt 0.50.0 → 0.51.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 +13 -1
- package/LICENSE +9 -9
- package/README.md +4 -4
- package/package.json +5 -5
- package/src/cli/actions/rotate/github/connect.js +1 -1
- package/src/cli/actions/rotate/npm/connect.js +1 -1
- package/src/cli/actions/rotate/openai/connect.js +1 -1
- package/src/cli/actions/rotate.js +1 -1
- package/src/cli/actions/settings/device.js +1 -1
- package/src/cli/actions/settings/hostname.js +1 -1
- package/src/cli/actions/settings/off.js +2 -2
- package/src/cli/actions/settings/on.js +2 -2
- package/src/cli/actions/settings/path.js +1 -1
- package/src/cli/actions/settings/token.js +1 -1
- package/src/cli/actions/sync.js +1 -1
- package/src/cli/commands/armor.js +6 -6
- package/src/cli/commands/gateway.js +1 -1
- package/src/cli/commands/rotate.js +1 -1
- package/src/cli/commands/settings.js +9 -9
- package/src/cli/{dotenvx-ops.js → dotenvx-vlt.js} +12 -21
- package/src/lib/api/getVersion.js +1 -1
- package/src/lib/helpers/likelyUpdateCommand.js +8 -8
- package/src/lib/main.d.ts +4 -4
- package/src/lib/services/armorDown.js +1 -1
- package/src/lib/services/armorMove.js +1 -1
- package/src/lib/services/armorPull.js +1 -1
- package/src/lib/services/armorPush.js +1 -1
- package/src/lib/services/armorUp.js +2 -2
- package/src/cli/actions/backup.js +0 -93
- package/src/cli/postinstall.js +0 -16
- package/src/lib/api/postBackup.js +0 -68
- package/src/lib/services/backup.js +0 -105
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-ops/compare/v0.
|
|
5
|
+
[Unreleased](https://github.com/dotenvx/dotenvx-ops/compare/v0.51.0...main)
|
|
6
|
+
|
|
7
|
+
## [0.51.0](https://github.com/dotenvx/dotenvx-ops/compare/v0.50.1...v0.51.0) (2026-05-25)
|
|
8
|
+
|
|
9
|
+
### Removed
|
|
10
|
+
|
|
11
|
+
* Remove `backup` command ([#101](https://github.com/dotenvx/dotenvx-ops/pull/101))
|
|
12
|
+
|
|
13
|
+
## [0.50.1](https://github.com/dotenvx/dotenvx-ops/compare/v0.50.0...v0.50.1) (2026-05-25)
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
|
|
17
|
+
* Internals renamed to `vlt` ([#100](https://github.com/dotenvx/dotenvx-ops/pull/100))
|
|
6
18
|
|
|
7
19
|
## [0.50.0](https://github.com/dotenvx/dotenvx-ops/compare/v0.49.2...v0.50.0) (2026-05-25)
|
|
8
20
|
|
package/LICENSE
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
Dotenvx
|
|
1
|
+
Dotenvx Vlt End-User License Agreement (EULA)
|
|
2
2
|
|
|
3
|
-
Applies to: Dotenvx
|
|
3
|
+
Applies to: Dotenvx Vlt (CLI, SDKs, and related software)
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
Summary
|
|
8
8
|
|
|
9
|
-
Dotenvx
|
|
9
|
+
Dotenvx Vlt is a commercial product. This agreement outlines your rights to use the software, and our expectations in return. It’s written to be understandable, developer-friendly, and fair.
|
|
10
10
|
|
|
11
|
-
By installing, accessing, or using Dotenvx
|
|
11
|
+
By installing, accessing, or using Dotenvx Vlt, you agree to these terms.
|
|
12
12
|
|
|
13
13
|
---
|
|
14
14
|
|
|
15
15
|
1. License
|
|
16
16
|
|
|
17
|
-
You are granted a non-exclusive, non-transferable, revocable license to use Dotenvx
|
|
17
|
+
You are granted a non-exclusive, non-transferable, revocable license to use Dotenvx Vlt as long as:
|
|
18
18
|
- You have an active license (via paid subscription or evaluation, including time-limited free trials)
|
|
19
19
|
- You do not distribute or sublicense the software
|
|
20
20
|
- You do not attempt to bypass license enforcement or API restrictions
|
|
@@ -24,7 +24,7 @@ You are granted a non-exclusive, non-transferable, revocable license to use Dote
|
|
|
24
24
|
2. Use
|
|
25
25
|
|
|
26
26
|
You may:
|
|
27
|
-
- Use Dotenvx
|
|
27
|
+
- Use Dotenvx Vlt internally for your own development or production workflows
|
|
28
28
|
- Install the CLI or SDKs on machines you or your team control
|
|
29
29
|
|
|
30
30
|
You may not:
|
|
@@ -36,7 +36,7 @@ You may not:
|
|
|
36
36
|
|
|
37
37
|
3. Ownership
|
|
38
38
|
|
|
39
|
-
All rights, title, and interest in Dotenvx
|
|
39
|
+
All rights, title, and interest in Dotenvx Vlt remain with DOTENVX LLC. You’re granted limited usage rights, not ownership.
|
|
40
40
|
|
|
41
41
|
---
|
|
42
42
|
|
|
@@ -52,7 +52,7 @@ You must stop using the software immediately if your license is terminated.
|
|
|
52
52
|
|
|
53
53
|
5. Warranty Disclaimer
|
|
54
54
|
|
|
55
|
-
Dotenvx
|
|
55
|
+
Dotenvx Vlt is provided as-is, with no guarantees that it will work for your specific use case. You assume all risk.
|
|
56
56
|
|
|
57
57
|
---
|
|
58
58
|
|
|
@@ -64,7 +64,7 @@ We are not liable for any indirect or consequential damages, including loss of d
|
|
|
64
64
|
|
|
65
65
|
7. Contact
|
|
66
66
|
|
|
67
|
-
Have questions? Email us at
|
|
67
|
+
Have questions? Email us at vlt@dotenvx.com
|
|
68
68
|
|
|
69
69
|
---
|
|
70
70
|
|
package/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
[](https://dotenvx.com/vlt)
|
|
2
2
|
|
|
3
3
|
```
|
|
4
4
|
⛨ ARMORED KEYS: Harden your private keys.
|
|
5
|
-
⮕ install [curl -sfS https://dotenvx.sh/
|
|
6
|
-
⮕ then run [dotenvx-
|
|
5
|
+
⮕ install [curl -sfS https://dotenvx.sh/vlt | sh]
|
|
6
|
+
⮕ then run [dotenvx-vlt login]
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
[Learn more](https://dotenvx.com/
|
|
9
|
+
[Learn more](https://dotenvx.com/vlt)
|
|
10
10
|
|
|
11
11
|
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.
|
|
2
|
+
"version": "0.51.0",
|
|
3
3
|
"name": "@dotenvx/dotenvx-vlt",
|
|
4
4
|
"description": "Secrets for agents–from the creator of `dotenv` and `dotenvx`",
|
|
5
5
|
"author": "@motdotla",
|
|
@@ -11,10 +11,10 @@
|
|
|
11
11
|
"vault",
|
|
12
12
|
"env"
|
|
13
13
|
],
|
|
14
|
-
"homepage": "https://dotenvx.com/
|
|
14
|
+
"homepage": "https://dotenvx.com/vlt",
|
|
15
15
|
"repository": {
|
|
16
16
|
"type": "git",
|
|
17
|
-
"url": "git+https://github.com/dotenvx/dotenvx-
|
|
17
|
+
"url": "git+https://github.com/dotenvx/dotenvx-vlt.git"
|
|
18
18
|
},
|
|
19
19
|
"license": "See LICENSE",
|
|
20
20
|
"files": [
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"./package.json": "./package.json"
|
|
32
32
|
},
|
|
33
33
|
"bin": {
|
|
34
|
-
"dotenvx-ops": "./src/cli/dotenvx-
|
|
35
|
-
"dotenvx-vlt": "./src/cli/dotenvx-
|
|
34
|
+
"dotenvx-ops": "./src/cli/dotenvx-vlt.js",
|
|
35
|
+
"dotenvx-vlt": "./src/cli/dotenvx-vlt.js"
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
|
38
38
|
"build": "node esbuild.js",
|
|
@@ -63,7 +63,7 @@ async function connect () {
|
|
|
63
63
|
spinner.stop()
|
|
64
64
|
|
|
65
65
|
logger.success(`✔ connected [${url}]`)
|
|
66
|
-
logger.help(`⮕ next run [dotenvx
|
|
66
|
+
logger.help(`⮕ next run [dotenvx vlt rotate dotenvx://${uid}]`)
|
|
67
67
|
} catch (error) {
|
|
68
68
|
spinner.stop()
|
|
69
69
|
if (error.message) {
|
|
@@ -63,7 +63,7 @@ async function connect () {
|
|
|
63
63
|
spinner.stop()
|
|
64
64
|
|
|
65
65
|
logger.success(`✔ connected [${url}]`)
|
|
66
|
-
logger.help(`⮕ next run [dotenvx
|
|
66
|
+
logger.help(`⮕ next run [dotenvx vlt rotate dotenvx://${uid}]`)
|
|
67
67
|
} catch (error) {
|
|
68
68
|
spinner.stop()
|
|
69
69
|
if (error.message) {
|
|
@@ -63,7 +63,7 @@ async function connect () {
|
|
|
63
63
|
spinner.stop()
|
|
64
64
|
|
|
65
65
|
logger.success(`✔ connected [${url}]`)
|
|
66
|
-
logger.help(`⮕ next run [dotenvx
|
|
66
|
+
logger.help(`⮕ next run [dotenvx vlt rotate dotenvx://${uid}]`)
|
|
67
67
|
} catch (error) {
|
|
68
68
|
spinner.stop()
|
|
69
69
|
if (error.message) {
|
|
@@ -23,7 +23,7 @@ async function rotate (uri) {
|
|
|
23
23
|
if (spinner) spinner.stop()
|
|
24
24
|
|
|
25
25
|
logger.success(`⟳ rotated [${url}]`)
|
|
26
|
-
logger.help(`⮕ next run [dotenvx
|
|
26
|
+
logger.help(`⮕ next run [dotenvx vlt get dotenvx://${rotUid}]`)
|
|
27
27
|
} catch (error) {
|
|
28
28
|
if (spinner) spinner.stop()
|
|
29
29
|
if (error.message) {
|
|
@@ -12,7 +12,7 @@ function device () {
|
|
|
12
12
|
if (devicePublicKey && devicePublicKey.length > 1) {
|
|
13
13
|
console.log(smartMask(devicePublicKey, options.unmask, 6))
|
|
14
14
|
} else {
|
|
15
|
-
logger.error('missing device. Try generating one with [dotenvx
|
|
15
|
+
logger.error('missing device. Try generating one with [dotenvx vlt login].')
|
|
16
16
|
process.exit(1)
|
|
17
17
|
}
|
|
18
18
|
} catch (error) {
|
|
@@ -8,7 +8,7 @@ function hostname () {
|
|
|
8
8
|
if (_hostname && _hostname.length > 1) {
|
|
9
9
|
console.log(_hostname)
|
|
10
10
|
} else {
|
|
11
|
-
logger.error('missing hostname. Try running [dotenvx
|
|
11
|
+
logger.error('missing hostname. Try running [dotenvx vlt login].')
|
|
12
12
|
process.exit(1)
|
|
13
13
|
}
|
|
14
14
|
} catch (error) {
|
|
@@ -6,8 +6,8 @@ function off () {
|
|
|
6
6
|
try {
|
|
7
7
|
const sesh = new Session()
|
|
8
8
|
sesh.turnOff()
|
|
9
|
-
logger.success('✔
|
|
10
|
-
logger.help('⮕ check status with [dotenvx
|
|
9
|
+
logger.success('✔ vlt: off')
|
|
10
|
+
logger.help('⮕ check status with [dotenvx vlt status]')
|
|
11
11
|
} catch (error) {
|
|
12
12
|
logger.error(error.message)
|
|
13
13
|
process.exit(1)
|
|
@@ -6,8 +6,8 @@ function on () {
|
|
|
6
6
|
try {
|
|
7
7
|
const sesh = new Session()
|
|
8
8
|
sesh.turnOn()
|
|
9
|
-
logger.success('✔
|
|
10
|
-
logger.help('⮕ check status with [dotenvx
|
|
9
|
+
logger.success('✔ vlt: on')
|
|
10
|
+
logger.help('⮕ check status with [dotenvx vlt status]')
|
|
11
11
|
} catch (error) {
|
|
12
12
|
logger.error(error.message)
|
|
13
13
|
process.exit(1)
|
|
@@ -9,7 +9,7 @@ function path () {
|
|
|
9
9
|
if (path && path.length > 1) {
|
|
10
10
|
console.log(path)
|
|
11
11
|
} else {
|
|
12
|
-
logger.error('missing path. Try generating one with [dotenvx
|
|
12
|
+
logger.error('missing path. Try generating one with [dotenvx vlt login].')
|
|
13
13
|
process.exit(1)
|
|
14
14
|
}
|
|
15
15
|
} catch (error) {
|
|
@@ -12,7 +12,7 @@ function token () {
|
|
|
12
12
|
if (token && token.length > 1) {
|
|
13
13
|
console.log(smartMask(token, options.unmask, 10))
|
|
14
14
|
} else {
|
|
15
|
-
logger.error('missing token. Try generating one with [dotenvx
|
|
15
|
+
logger.error('missing token. Try generating one with [dotenvx vlt login].')
|
|
16
16
|
process.exit(1)
|
|
17
17
|
}
|
|
18
18
|
} catch (error) {
|
package/src/cli/actions/sync.js
CHANGED
|
@@ -80,7 +80,7 @@ async function sync () {
|
|
|
80
80
|
console.log(conflictedFile.diffAnsi)
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
logger.info(`Review and edit the ${pluralize('file', conflictedFiles.length)} as needed, then confirm your version with [dotenvx
|
|
83
|
+
logger.info(`Review and edit the ${pluralize('file', conflictedFiles.length)} as needed, then confirm your version with [dotenvx vlt sync --force]`)
|
|
84
84
|
}
|
|
85
85
|
} catch (error) {
|
|
86
86
|
spinner.stop()
|
|
@@ -12,7 +12,7 @@ armor
|
|
|
12
12
|
this.help()
|
|
13
13
|
})
|
|
14
14
|
|
|
15
|
-
// dotenvx-
|
|
15
|
+
// dotenvx-vlt armor up
|
|
16
16
|
const upAction = require('./../actions/armor/up')
|
|
17
17
|
armor
|
|
18
18
|
.command('up')
|
|
@@ -22,7 +22,7 @@ armor
|
|
|
22
22
|
.option('--team <team>', 'team to armor private key for')
|
|
23
23
|
.action(upAction)
|
|
24
24
|
|
|
25
|
-
// dotenvx-
|
|
25
|
+
// dotenvx-vlt armor down
|
|
26
26
|
const downAction = require('./../actions/armor/down')
|
|
27
27
|
armor
|
|
28
28
|
.command('down')
|
|
@@ -32,7 +32,7 @@ armor
|
|
|
32
32
|
.option('--team <team>', 'team to dearmor private key from')
|
|
33
33
|
.action(downAction)
|
|
34
34
|
|
|
35
|
-
// dotenvx-
|
|
35
|
+
// dotenvx-vlt armor push
|
|
36
36
|
const pushAction = require('./../actions/armor/push')
|
|
37
37
|
armor
|
|
38
38
|
.command('push')
|
|
@@ -42,7 +42,7 @@ armor
|
|
|
42
42
|
.option('--team <team>', 'team to push armored private key for')
|
|
43
43
|
.action(pushAction)
|
|
44
44
|
|
|
45
|
-
// dotenvx-
|
|
45
|
+
// dotenvx-vlt armor pull
|
|
46
46
|
const pullAction = require('./../actions/armor/pull')
|
|
47
47
|
armor
|
|
48
48
|
.command('pull')
|
|
@@ -52,7 +52,7 @@ armor
|
|
|
52
52
|
.option('--team <team>', 'team to pull armored private key from')
|
|
53
53
|
.action(pullAction)
|
|
54
54
|
|
|
55
|
-
// dotenvx-
|
|
55
|
+
// dotenvx-vlt armor rotate
|
|
56
56
|
const rotateAction = require('./../actions/armor/rotate')
|
|
57
57
|
armor
|
|
58
58
|
.command('rotate')
|
|
@@ -61,7 +61,7 @@ armor
|
|
|
61
61
|
.option('--token <token>', 'set token')
|
|
62
62
|
.action(rotateAction)
|
|
63
63
|
|
|
64
|
-
// dotenvx-
|
|
64
|
+
// dotenvx-vlt armor move
|
|
65
65
|
const moveAction = require('./../actions/armor/move')
|
|
66
66
|
armor
|
|
67
67
|
.command('move')
|
|
@@ -13,7 +13,7 @@ rotate.addCommand(require('./rotate/github'))
|
|
|
13
13
|
rotate.addCommand(require('./rotate/npm'))
|
|
14
14
|
rotate.addCommand(require('./rotate/openai'))
|
|
15
15
|
|
|
16
|
-
// dotenvx
|
|
16
|
+
// dotenvx vlt rotate (fallback positional argument handler)
|
|
17
17
|
const rotateAction = require('../actions/rotate')
|
|
18
18
|
rotate
|
|
19
19
|
.argument('[URI]', 'URI') // brackets = optional
|
|
@@ -6,14 +6,14 @@ settings
|
|
|
6
6
|
.description('settings')
|
|
7
7
|
.allowUnknownOption()
|
|
8
8
|
|
|
9
|
-
// dotenvx-
|
|
9
|
+
// dotenvx-vlt settings username
|
|
10
10
|
const usernameAction = require('./../actions/settings/username')
|
|
11
11
|
settings
|
|
12
12
|
.command('username')
|
|
13
13
|
.description('print your username')
|
|
14
14
|
.action(usernameAction)
|
|
15
15
|
|
|
16
|
-
// dotenvx-
|
|
16
|
+
// dotenvx-vlt settings token
|
|
17
17
|
const tokenAction = require('./../actions/settings/token')
|
|
18
18
|
settings
|
|
19
19
|
.command('token')
|
|
@@ -21,7 +21,7 @@ settings
|
|
|
21
21
|
.option('--unmask', 'unmask access token')
|
|
22
22
|
.action(tokenAction)
|
|
23
23
|
|
|
24
|
-
// dotenvx-
|
|
24
|
+
// dotenvx-vlt settings device
|
|
25
25
|
const deviceAction = require('./../actions/settings/device')
|
|
26
26
|
settings
|
|
27
27
|
.command('device')
|
|
@@ -29,32 +29,32 @@ settings
|
|
|
29
29
|
.option('--unmask', 'unmask device pubkey')
|
|
30
30
|
.action(deviceAction)
|
|
31
31
|
|
|
32
|
-
// dotenvx-
|
|
32
|
+
// dotenvx-vlt settings hostname
|
|
33
33
|
const hostnameAction = require('./../actions/settings/hostname')
|
|
34
34
|
settings
|
|
35
35
|
.command('hostname')
|
|
36
36
|
.description('print hostname')
|
|
37
37
|
.action(hostnameAction)
|
|
38
38
|
|
|
39
|
-
// dotenvx-
|
|
39
|
+
// dotenvx-vlt settings path
|
|
40
40
|
const pathAction = require('./../actions/settings/path')
|
|
41
41
|
settings
|
|
42
42
|
.command('path')
|
|
43
43
|
.description('print path to settings file')
|
|
44
44
|
.action(pathAction)
|
|
45
45
|
|
|
46
|
-
// dotenvx-
|
|
46
|
+
// dotenvx-vlt settings on
|
|
47
47
|
const onAction = require('./../actions/settings/on')
|
|
48
48
|
settings
|
|
49
49
|
.command('on')
|
|
50
|
-
.description('turn
|
|
50
|
+
.description('turn vlt on')
|
|
51
51
|
.action(onAction)
|
|
52
52
|
|
|
53
|
-
// dotenvx-
|
|
53
|
+
// dotenvx-vlt settings off
|
|
54
54
|
const offAction = require('./../actions/settings/off')
|
|
55
55
|
settings
|
|
56
56
|
.command('off')
|
|
57
|
-
.description('turn
|
|
57
|
+
.description('turn vlt off')
|
|
58
58
|
.action(offAction)
|
|
59
59
|
|
|
60
60
|
module.exports = settings
|
|
@@ -26,21 +26,12 @@ program
|
|
|
26
26
|
|
|
27
27
|
// cli
|
|
28
28
|
program
|
|
29
|
-
.name('dotenvx-
|
|
29
|
+
.name('dotenvx-vlt')
|
|
30
30
|
.description(packageJson.description)
|
|
31
31
|
.version(packageJson.version)
|
|
32
32
|
.allowUnknownOption()
|
|
33
33
|
|
|
34
|
-
// dotenvx-
|
|
35
|
-
const backupAction = require('./actions/backup')
|
|
36
|
-
program
|
|
37
|
-
.command('backup')
|
|
38
|
-
.description('[INTERNAL] back up .env.keys')
|
|
39
|
-
.option('--org <organizationSlug>')
|
|
40
|
-
.option('-h, --hostname <url>', 'set hostname')
|
|
41
|
-
.action(backupAction)
|
|
42
|
-
|
|
43
|
-
// dotenvx-ops open
|
|
34
|
+
// dotenvx-vlt open
|
|
44
35
|
const openAction = require('./actions/open')
|
|
45
36
|
program
|
|
46
37
|
.command('open')
|
|
@@ -48,7 +39,7 @@ program
|
|
|
48
39
|
.option('-h, --hostname <url>', 'set hostname')
|
|
49
40
|
.action(openAction)
|
|
50
41
|
|
|
51
|
-
// dotenvx-
|
|
42
|
+
// dotenvx-vlt observe base64String
|
|
52
43
|
const observeAction = require('./actions/observe')
|
|
53
44
|
program.command('observe')
|
|
54
45
|
.usage('<BASE64> [options]')
|
|
@@ -62,7 +53,7 @@ program.command('observe')
|
|
|
62
53
|
observeAction.apply(this, args)
|
|
63
54
|
})
|
|
64
55
|
|
|
65
|
-
// dotenvx-
|
|
56
|
+
// dotenvx-vlt sync
|
|
66
57
|
const syncAction = require('./actions/sync')
|
|
67
58
|
program
|
|
68
59
|
.command('sync')
|
|
@@ -71,7 +62,7 @@ program
|
|
|
71
62
|
.option('--force', 'force changes')
|
|
72
63
|
.action(syncAction)
|
|
73
64
|
|
|
74
|
-
// dotenvx-
|
|
65
|
+
// dotenvx-vlt get
|
|
75
66
|
const getAction = require('./actions/get')
|
|
76
67
|
program
|
|
77
68
|
.command('get')
|
|
@@ -81,7 +72,7 @@ program
|
|
|
81
72
|
.option('--token <token>', 'set token')
|
|
82
73
|
.action(getAction)
|
|
83
74
|
|
|
84
|
-
// dotenvx-
|
|
75
|
+
// dotenvx-vlt set
|
|
85
76
|
const setAction = require('./actions/set')
|
|
86
77
|
program
|
|
87
78
|
.command('set')
|
|
@@ -92,16 +83,16 @@ program
|
|
|
92
83
|
.option('--token <token>', 'set token')
|
|
93
84
|
.action(setAction)
|
|
94
85
|
|
|
95
|
-
// dotenvx-
|
|
86
|
+
// dotenvx-vlt rotate
|
|
96
87
|
const shouldLoadRotateCommand = firstArg === 'rotate' || firstArg === 'help' || firstArg === '--help' || firstArg === '-h'
|
|
97
88
|
if (shouldLoadRotateCommand) {
|
|
98
89
|
program.addCommand(require('./commands/rotate'))
|
|
99
90
|
}
|
|
100
91
|
|
|
101
|
-
// dotenvx-
|
|
92
|
+
// dotenvx-vlt armor
|
|
102
93
|
program.addCommand(require('./commands/armor'))
|
|
103
94
|
|
|
104
|
-
// dotenvx-
|
|
95
|
+
// dotenvx-vlt login
|
|
105
96
|
const loginAction = require('./actions/login')
|
|
106
97
|
program
|
|
107
98
|
.command('login')
|
|
@@ -109,7 +100,7 @@ program
|
|
|
109
100
|
.option('--hostname <url>', 'set hostname')
|
|
110
101
|
.action(loginAction)
|
|
111
102
|
|
|
112
|
-
// dotenvx-
|
|
103
|
+
// dotenvx-vlt logout
|
|
113
104
|
const logoutAction = require('./actions/logout')
|
|
114
105
|
program
|
|
115
106
|
.command('logout')
|
|
@@ -117,14 +108,14 @@ program
|
|
|
117
108
|
.option('--hostname <url>', 'set hostname')
|
|
118
109
|
.action(logoutAction)
|
|
119
110
|
|
|
120
|
-
// dotenvx-
|
|
111
|
+
// dotenvx-vlt status
|
|
121
112
|
const statusAction = require('./actions/status')
|
|
122
113
|
program
|
|
123
114
|
.command('status')
|
|
124
115
|
.description('[INTERNAL] status')
|
|
125
116
|
.action(statusAction)
|
|
126
117
|
|
|
127
|
-
// dotenvx-
|
|
118
|
+
// dotenvx-vlt keypair
|
|
128
119
|
const keypairAction = require('./actions/keypair')
|
|
129
120
|
program
|
|
130
121
|
.command('keypair')
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const normalizePath = require('./normalizePath')
|
|
2
2
|
const safeRealpath = require('./safeRealpath')
|
|
3
3
|
|
|
4
|
-
const NPM_COMMAND = 'npm i @dotenvx/dotenvx-
|
|
5
|
-
const CURL_COMMAND = 'curl -sfS https://dotenvx.sh/
|
|
4
|
+
const NPM_COMMAND = 'npm i @dotenvx/dotenvx-vlt'
|
|
5
|
+
const CURL_COMMAND = 'curl -sfS https://dotenvx.sh/vlt | sh'
|
|
6
6
|
|
|
7
7
|
function likelyUpdateCommand () {
|
|
8
8
|
const isPackaged = Boolean(process.pkg)
|
|
@@ -11,18 +11,18 @@ function likelyUpdateCommand () {
|
|
|
11
11
|
const normalizedPath = normalizePath(resolvedExecutablePath || executablePath || '')
|
|
12
12
|
|
|
13
13
|
if (
|
|
14
|
-
normalizedPath.includes('/node_modules/@dotenvx/dotenvx-
|
|
15
|
-
normalizedPath.includes('/node_modules/.bin/dotenvx-
|
|
14
|
+
normalizedPath.includes('/node_modules/@dotenvx/dotenvx-vlt/') ||
|
|
15
|
+
normalizedPath.includes('/node_modules/.bin/dotenvx-vlt')
|
|
16
16
|
) {
|
|
17
17
|
return NPM_COMMAND
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
if (
|
|
21
21
|
isPackaged ||
|
|
22
|
-
normalizedPath.endsWith('/usr/local/bin/dotenvx-
|
|
23
|
-
normalizedPath.endsWith('/opt/homebrew/bin/dotenvx-
|
|
24
|
-
normalizedPath.endsWith('/usr/bin/dotenvx-
|
|
25
|
-
normalizedPath.endsWith('/bin/dotenvx-
|
|
22
|
+
normalizedPath.endsWith('/usr/local/bin/dotenvx-vlt') ||
|
|
23
|
+
normalizedPath.endsWith('/opt/homebrew/bin/dotenvx-vlt') ||
|
|
24
|
+
normalizedPath.endsWith('/usr/bin/dotenvx-vlt') ||
|
|
25
|
+
normalizedPath.endsWith('/bin/dotenvx-vlt')
|
|
26
26
|
) {
|
|
27
27
|
return CURL_COMMAND
|
|
28
28
|
}
|
package/src/lib/main.d.ts
CHANGED
|
@@ -9,16 +9,16 @@ import type { URL } from 'url';
|
|
|
9
9
|
*/
|
|
10
10
|
export function observe(payload: string): string;
|
|
11
11
|
|
|
12
|
-
export interface
|
|
12
|
+
export interface DotenvVltOptions {
|
|
13
13
|
hostname?: string;
|
|
14
14
|
token?: string;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
export interface
|
|
17
|
+
export interface DotenvVltKeypairOptions extends DotenvVltOptions {
|
|
18
18
|
team?: string;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
export interface
|
|
21
|
+
export interface DotenvVltKeypairOutput {
|
|
22
22
|
publicKey: string;
|
|
23
23
|
privateKey: string;
|
|
24
24
|
}
|
|
@@ -30,7 +30,7 @@ export interface DotenvOpsKeypairOutput {
|
|
|
30
30
|
* @param options - optional hostname/token/team overrides
|
|
31
31
|
* @returns generated public and private keys
|
|
32
32
|
*/
|
|
33
|
-
export function keypair(publicKey?: string, options?:
|
|
33
|
+
export function keypair(publicKey?: string, options?: DotenvVltKeypairOptions): Promise<DotenvVltKeypairOutput>;
|
|
34
34
|
|
|
35
35
|
export interface DotenvConfigOptions {
|
|
36
36
|
/**
|
|
@@ -32,7 +32,7 @@ class ArmorDown {
|
|
|
32
32
|
privateKeyName
|
|
33
33
|
} = keyNamesForEnvFile(envFile)
|
|
34
34
|
|
|
35
|
-
const publicKey = dotenvx.get(publicKeyName, { path: envFile, strict: true, ignore: ['MISSING_PRIVATE_KEY'], noOps: true })
|
|
35
|
+
const publicKey = dotenvx.get(publicKeyName, { path: envFile, strict: true, ignore: ['MISSING_PRIVATE_KEY'], noOps: true, noVlt: true })
|
|
36
36
|
let json
|
|
37
37
|
|
|
38
38
|
if (team) {
|
|
@@ -25,7 +25,7 @@ class ArmorMove {
|
|
|
25
25
|
publicKeyName,
|
|
26
26
|
privateKeyName
|
|
27
27
|
} = keyNamesForEnvFile(envFile)
|
|
28
|
-
const publicKey = dotenvx.get(publicKeyName, { path: envFile, strict: true, ignore: ['MISSING_PRIVATE_KEY'], noOps: true })
|
|
28
|
+
const publicKey = dotenvx.get(publicKeyName, { path: envFile, strict: true, ignore: ['MISSING_PRIVATE_KEY'], noOps: true, noVlt: true })
|
|
29
29
|
|
|
30
30
|
const accountJson = await new GetAccount(hostname, token).run()
|
|
31
31
|
const choices = accountJson.organizations.map(o => ({
|
|
@@ -32,7 +32,7 @@ class ArmorPull {
|
|
|
32
32
|
privateKeyName
|
|
33
33
|
} = keyNamesForEnvFile(envFile)
|
|
34
34
|
|
|
35
|
-
const publicKey = dotenvx.get(publicKeyName, { path: envFile, strict: true, ignore: ['MISSING_PRIVATE_KEY'], noOps: true })
|
|
35
|
+
const publicKey = dotenvx.get(publicKeyName, { path: envFile, strict: true, ignore: ['MISSING_PRIVATE_KEY'], noOps: true, noVlt: true })
|
|
36
36
|
let json
|
|
37
37
|
|
|
38
38
|
if (team) {
|
|
@@ -37,7 +37,7 @@ class ArmorPush {
|
|
|
37
37
|
|
|
38
38
|
const { privateKeyName } = keyNamesForEnvFile(envFile)
|
|
39
39
|
|
|
40
|
-
const privateKey = dotenvx.get(privateKeyName, { path: '.env.keys', strict: true, noOps: true })
|
|
40
|
+
const privateKey = dotenvx.get(privateKeyName, { path: '.env.keys', strict: true, noOps: true, noVlt: true })
|
|
41
41
|
const publicKey = publicKeyFromPrivateKey(privateKey)
|
|
42
42
|
|
|
43
43
|
let json
|
|
@@ -32,8 +32,8 @@ class ArmorUp {
|
|
|
32
32
|
privateKeyName
|
|
33
33
|
} = keyNamesForEnvFile(envFile)
|
|
34
34
|
|
|
35
|
-
const publicKey = dotenvx.get(publicKeyName, { path: envFile, strict: true, ignore: ['MISSING_PRIVATE_KEY'], noOps: true })
|
|
36
|
-
const privateKey = dotenvx.get(privateKeyName, { path: '.env.keys', strict: true, ignore: ['MISSING_KEY'], noOps: true })
|
|
35
|
+
const publicKey = dotenvx.get(publicKeyName, { path: envFile, strict: true, ignore: ['MISSING_PRIVATE_KEY'], noOps: true, noVlt: true })
|
|
36
|
+
const privateKey = dotenvx.get(privateKeyName, { path: '.env.keys', strict: true, ignore: ['MISSING_KEY'], noOps: true, noVlt: true })
|
|
37
37
|
|
|
38
38
|
let json
|
|
39
39
|
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
const fs = require('fs')
|
|
2
|
-
|
|
3
|
-
const { logger } = require('@dotenvx/dotenvx')
|
|
4
|
-
const Session = require('./../../db/session')
|
|
5
|
-
|
|
6
|
-
const { createSpinner } = require('./../../lib/helpers/createSpinner')
|
|
7
|
-
const clipboardy = require('./../../lib/helpers/clipboardy')
|
|
8
|
-
const confirm = require('./../../lib/helpers/confirm')
|
|
9
|
-
const formatCode = require('./../../lib/helpers/formatCode')
|
|
10
|
-
const truncate = require('./../../lib/helpers/truncate')
|
|
11
|
-
const openUrl = require('./../../lib/helpers/openUrl')
|
|
12
|
-
|
|
13
|
-
const LoggedIn = require('./../../lib/services/loggedIn')
|
|
14
|
-
const Login = require('./../../lib/services/login')
|
|
15
|
-
const LoginPoll = require('./../../lib/services/loginPoll')
|
|
16
|
-
const Backup = require('./../../lib/services/backup')
|
|
17
|
-
|
|
18
|
-
const spinner = createSpinner('waiting on browser authorization')
|
|
19
|
-
|
|
20
|
-
async function backup () {
|
|
21
|
-
const options = this.opts()
|
|
22
|
-
|
|
23
|
-
const sesh = new Session()
|
|
24
|
-
const hostname = options.hostname || sesh.hostname()
|
|
25
|
-
|
|
26
|
-
try {
|
|
27
|
-
logger.debug(`options: ${JSON.stringify(options)}`)
|
|
28
|
-
|
|
29
|
-
const loggedIn = await new LoggedIn(hostname).run()
|
|
30
|
-
if (!loggedIn) {
|
|
31
|
-
const {
|
|
32
|
-
deviceCode,
|
|
33
|
-
userCode,
|
|
34
|
-
verificationUri,
|
|
35
|
-
verificationUriComplete,
|
|
36
|
-
interval
|
|
37
|
-
} = await new Login(hostname).run()
|
|
38
|
-
|
|
39
|
-
try { clipboardy.writeSync(userCode) } catch (_e) {}
|
|
40
|
-
|
|
41
|
-
logger.debug(`POST ${hostname} with deviceCode ${deviceCode} at interval ${interval}`)
|
|
42
|
-
logger.info(`press Enter to open [${verificationUri}] and enter code [${formatCode(userCode)}]...`)
|
|
43
|
-
|
|
44
|
-
// begin polling
|
|
45
|
-
const pollPromise = new LoginPoll(hostname, deviceCode, interval).run()
|
|
46
|
-
spinner.start()
|
|
47
|
-
|
|
48
|
-
// optionally allow user to open browser
|
|
49
|
-
confirm({ message: `press Enter to open [${verificationUri}] and enter code [${formatCode(userCode)}]...` })
|
|
50
|
-
.then(answer => answer && openUrl(verificationUriComplete))
|
|
51
|
-
.catch(() => {}) // ignore
|
|
52
|
-
|
|
53
|
-
const data = await pollPromise
|
|
54
|
-
spinner.succeed(`logged in [${data.username}] to this device and activated token [${truncate(data.access_token, 11)}]`)
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
spinner.start('backing up')
|
|
58
|
-
|
|
59
|
-
const {
|
|
60
|
-
projectUsernameName,
|
|
61
|
-
projectEnvXSrc,
|
|
62
|
-
projectEnvXFileNeedsWrite
|
|
63
|
-
} = await new Backup(hostname, options.org).run()
|
|
64
|
-
|
|
65
|
-
// write .env.x
|
|
66
|
-
if (projectEnvXFileNeedsWrite) {
|
|
67
|
-
logger.debug('writing .env.x')
|
|
68
|
-
fs.writeFileSync('.env.x', projectEnvXSrc, 'utf8')
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
spinner.stop()
|
|
72
|
-
|
|
73
|
-
logger.success(`✔ backed up [${projectUsernameName}]`)
|
|
74
|
-
logger.help('⮕ next run [dotenvx-ops open] to view')
|
|
75
|
-
} catch (error) {
|
|
76
|
-
spinner.stop()
|
|
77
|
-
if (error.message) {
|
|
78
|
-
logger.error(error.message)
|
|
79
|
-
} else {
|
|
80
|
-
logger.error(error)
|
|
81
|
-
}
|
|
82
|
-
if (error.help) {
|
|
83
|
-
logger.help(error.help)
|
|
84
|
-
}
|
|
85
|
-
if (error.stack) {
|
|
86
|
-
logger.debug(error.stack)
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
process.exit(1)
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
module.exports = backup
|
package/src/cli/postinstall.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
const packageJson = require('./../lib/helpers/packageJson')
|
|
2
|
-
const path = require('path')
|
|
3
|
-
|
|
4
|
-
const commandName = 'dotenvx-ops'
|
|
5
|
-
const isGlobalInstall = process.env.npm_config_global === 'true' || process.env.npm_config_location === 'global'
|
|
6
|
-
|
|
7
|
-
let installPath = commandName
|
|
8
|
-
if (isGlobalInstall && process.env.npm_config_prefix) {
|
|
9
|
-
const binaryName = process.platform === 'win32' ? `${commandName}.cmd` : commandName
|
|
10
|
-
installPath = process.platform === 'win32'
|
|
11
|
-
? path.join(process.env.npm_config_prefix, binaryName)
|
|
12
|
-
: path.join(process.env.npm_config_prefix, 'bin', binaryName)
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
console.log(`⛨ installed (${packageJson.version}:${installPath})`)
|
|
16
|
-
console.log('⮕ next run [dotenvx-ops login] and then [dotenvx encrypt]')
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
const { http } = require('../../lib/helpers/http')
|
|
2
|
-
const buildApiError = require('../../lib/helpers/buildApiError')
|
|
3
|
-
const packageJson = require('../../lib/helpers/packageJson')
|
|
4
|
-
|
|
5
|
-
class PostBackup {
|
|
6
|
-
constructor (hostname, token, devicePublicKey, encoded, dotenvxProjectId = null, org = null, pwd = null, gitUrl = null, gitBranch = null, systemUuid = null, osPlatform = null, osArch = null) {
|
|
7
|
-
this.hostname = hostname || 'https://vlt.dotenvx.com'
|
|
8
|
-
this.token = token
|
|
9
|
-
this.devicePublicKey = devicePublicKey
|
|
10
|
-
this.encoded = encoded
|
|
11
|
-
this.dotenvxProjectId = dotenvxProjectId
|
|
12
|
-
this.org = org
|
|
13
|
-
this.pwd = pwd
|
|
14
|
-
this.gitUrl = gitUrl
|
|
15
|
-
this.gitBranch = gitBranch
|
|
16
|
-
this.systemUuid = systemUuid
|
|
17
|
-
this.osPlatform = osPlatform
|
|
18
|
-
this.osArch = osArch
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
async run () {
|
|
22
|
-
const token = this.token
|
|
23
|
-
const devicePublicKey = this.devicePublicKey
|
|
24
|
-
const url = `${this.hostname}/api/backup`
|
|
25
|
-
const encoded = this.encoded
|
|
26
|
-
const dotenvxProjectId = this.dotenvxProjectId
|
|
27
|
-
const org = this.org
|
|
28
|
-
const backedupAt = new Date().toISOString()
|
|
29
|
-
const pwd = this.pwd
|
|
30
|
-
const gitUrl = this.gitUrl
|
|
31
|
-
const gitBranch = this.gitBranch
|
|
32
|
-
const systemUuid = this.systemUuid
|
|
33
|
-
const osPlatform = this.osPlatform
|
|
34
|
-
const osArch = this.osArch
|
|
35
|
-
|
|
36
|
-
const resp = await http(url, {
|
|
37
|
-
method: 'POST',
|
|
38
|
-
headers: {
|
|
39
|
-
Authorization: `Bearer ${token}`,
|
|
40
|
-
'Content-Type': 'application/json'
|
|
41
|
-
},
|
|
42
|
-
body: JSON.stringify({
|
|
43
|
-
device_public_key: devicePublicKey,
|
|
44
|
-
encoded,
|
|
45
|
-
dotenvx_project_id: dotenvxProjectId,
|
|
46
|
-
org,
|
|
47
|
-
backedup_at: backedupAt,
|
|
48
|
-
pwd,
|
|
49
|
-
git_url: gitUrl,
|
|
50
|
-
git_branch: gitBranch,
|
|
51
|
-
system_uuid: systemUuid,
|
|
52
|
-
os_platform: osPlatform,
|
|
53
|
-
os_arch: osArch,
|
|
54
|
-
cli_version: packageJson.version
|
|
55
|
-
})
|
|
56
|
-
})
|
|
57
|
-
|
|
58
|
-
const json = await resp.body.json()
|
|
59
|
-
|
|
60
|
-
if (resp.statusCode >= 400) {
|
|
61
|
-
throw buildApiError(resp.statusCode, json)
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
return json
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
module.exports = PostBackup
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
const fs = require('fs')
|
|
2
|
-
const path = require('path')
|
|
3
|
-
const si = require('systeminformation')
|
|
4
|
-
const dotenvx = require('@dotenvx/dotenvx')
|
|
5
|
-
const prompts = require('../helpers/prompts')
|
|
6
|
-
|
|
7
|
-
const Session = require('./../../db/session')
|
|
8
|
-
|
|
9
|
-
const gitUrl = require('./../helpers/gitUrl')
|
|
10
|
-
const gitBranch = require('./../helpers/gitBranch')
|
|
11
|
-
const dotenvxProjectId = require('./../helpers/dotenvxProjectId')
|
|
12
|
-
|
|
13
|
-
// api calls
|
|
14
|
-
const GetAccount = require('./../api/getAccount')
|
|
15
|
-
const PostBackup = require('./../api/postBackup')
|
|
16
|
-
|
|
17
|
-
class Backup {
|
|
18
|
-
constructor (hostname, org = null) {
|
|
19
|
-
this.hostname = hostname
|
|
20
|
-
this.org = org
|
|
21
|
-
this.cwd = process.cwd()
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
async run () {
|
|
25
|
-
const sesh = new Session()
|
|
26
|
-
const token = sesh.token()
|
|
27
|
-
const devicePublicKey = sesh.devicePublicKey()
|
|
28
|
-
let _org = this.org
|
|
29
|
-
let projectEnvXFileNeedsWrite = false
|
|
30
|
-
|
|
31
|
-
// required
|
|
32
|
-
const files = this._files()
|
|
33
|
-
const payload = { files }
|
|
34
|
-
const encoded = Buffer.from(JSON.stringify(payload)).toString('base64')
|
|
35
|
-
|
|
36
|
-
// user must be logged in to use feature
|
|
37
|
-
const accountJson = await new GetAccount(this.hostname, token).run()
|
|
38
|
-
|
|
39
|
-
// optional project id
|
|
40
|
-
const _dotenvxProjectId = dotenvxProjectId(this.cwd, false)
|
|
41
|
-
|
|
42
|
-
// missing .env.x file
|
|
43
|
-
if (!_dotenvxProjectId) {
|
|
44
|
-
projectEnvXFileNeedsWrite = true // for writing
|
|
45
|
-
|
|
46
|
-
// set org
|
|
47
|
-
if (!_org) {
|
|
48
|
-
const choices = accountJson.organizations.map(o => ({
|
|
49
|
-
name: o.provider_slug,
|
|
50
|
-
value: o.provider_slug
|
|
51
|
-
}))
|
|
52
|
-
|
|
53
|
-
if (choices.length === 1) {
|
|
54
|
-
_org = choices[0].value // just use first choice
|
|
55
|
-
} else {
|
|
56
|
-
_org = await prompts.select({
|
|
57
|
-
message: 'Select org',
|
|
58
|
-
choices
|
|
59
|
-
}, {
|
|
60
|
-
input: process.stdin,
|
|
61
|
-
output: process.stderr
|
|
62
|
-
})
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// optional
|
|
68
|
-
const _pwd = this.cwd
|
|
69
|
-
const _gitUrl = gitUrl()
|
|
70
|
-
const _gitBranch = gitBranch()
|
|
71
|
-
|
|
72
|
-
const system = await si.system()
|
|
73
|
-
const _systemUuid = system.uuid
|
|
74
|
-
|
|
75
|
-
const osInfo = await si.osInfo()
|
|
76
|
-
const _osPlatform = osInfo.platform
|
|
77
|
-
const _osArch = osInfo.arch
|
|
78
|
-
|
|
79
|
-
const data = await new PostBackup(this.hostname, token, devicePublicKey, encoded, _dotenvxProjectId, _org, _pwd, _gitUrl, _gitBranch, _systemUuid, _osPlatform, _osArch).run()
|
|
80
|
-
|
|
81
|
-
return {
|
|
82
|
-
id: data.id,
|
|
83
|
-
dotenvxProjectId: data.dotenvx_project_id,
|
|
84
|
-
projectUsernameName: data.project_username_name,
|
|
85
|
-
projectEnvXSrc: data.project_env_x_src,
|
|
86
|
-
projectEnvXFileNeedsWrite,
|
|
87
|
-
files: data.files
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
_files () {
|
|
92
|
-
const out = []
|
|
93
|
-
const filepaths = dotenvx.ls(this.cwd, '.env.keys*')
|
|
94
|
-
|
|
95
|
-
for (const fp of filepaths) {
|
|
96
|
-
const abs = path.join(this.cwd, fp)
|
|
97
|
-
const src = fs.readFileSync(abs, 'utf8')
|
|
98
|
-
out.push({ filepath: fp, src })
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
return out
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
module.exports = Backup
|