@dotenvx/dotenvx-vlt 0.49.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 +652 -0
- package/LICENSE +71 -0
- package/README.md +11 -0
- package/package.json +77 -0
- package/src/cli/actions/armor/down.js +37 -0
- package/src/cli/actions/armor/move.js +42 -0
- package/src/cli/actions/armor/pull.js +37 -0
- package/src/cli/actions/armor/push.js +37 -0
- package/src/cli/actions/armor/rotate.js +25 -0
- package/src/cli/actions/armor/up.js +37 -0
- package/src/cli/actions/backup.js +93 -0
- package/src/cli/actions/gateway/start.js +17 -0
- package/src/cli/actions/get.js +34 -0
- package/src/cli/actions/keypair.js +59 -0
- package/src/cli/actions/login.js +110 -0
- package/src/cli/actions/logout.js +36 -0
- package/src/cli/actions/observe.js +36 -0
- package/src/cli/actions/open.js +37 -0
- package/src/cli/actions/rotate/github/connect.js +84 -0
- package/src/cli/actions/rotate/npm/connect.js +84 -0
- package/src/cli/actions/rotate/openai/connect.js +84 -0
- package/src/cli/actions/rotate.js +44 -0
- package/src/cli/actions/set.js +34 -0
- package/src/cli/actions/settings/device.js +24 -0
- package/src/cli/actions/settings/hostname.js +20 -0
- package/src/cli/actions/settings/off.js +17 -0
- package/src/cli/actions/settings/on.js +17 -0
- package/src/cli/actions/settings/path.js +21 -0
- package/src/cli/actions/settings/token.js +24 -0
- package/src/cli/actions/settings/username.js +22 -0
- package/src/cli/actions/status.js +13 -0
- package/src/cli/actions/sync.js +104 -0
- package/src/cli/commands/armor.js +73 -0
- package/src/cli/commands/gateway.js +16 -0
- package/src/cli/commands/rotate/github.js +26 -0
- package/src/cli/commands/rotate/npm.js +26 -0
- package/src/cli/commands/rotate/openai.js +26 -0
- package/src/cli/commands/rotate.js +32 -0
- package/src/cli/commands/settings.js +60 -0
- package/src/cli/dotenvx-ops.js +163 -0
- package/src/cli/postinstall.js +16 -0
- package/src/db/device.js +73 -0
- package/src/db/session.js +193 -0
- package/src/lib/api/getAccount.js +32 -0
- package/src/lib/api/getSynchronization.js +34 -0
- package/src/lib/api/getVersion.js +24 -0
- package/src/lib/api/postArmorDown.js +48 -0
- package/src/lib/api/postArmorMove.js +48 -0
- package/src/lib/api/postArmorPull.js +48 -0
- package/src/lib/api/postArmorPush.js +48 -0
- package/src/lib/api/postArmorUp.js +51 -0
- package/src/lib/api/postBackup.js +68 -0
- package/src/lib/api/postGet.js +37 -0
- package/src/lib/api/postKeypair.js +60 -0
- package/src/lib/api/postLogout.js +34 -0
- package/src/lib/api/postOauthDeviceCode.js +45 -0
- package/src/lib/api/postOauthToken.js +38 -0
- package/src/lib/api/postObserve.js +62 -0
- package/src/lib/api/postRotate.js +39 -0
- package/src/lib/api/postRotateConnect.js +54 -0
- package/src/lib/api/postSet.js +43 -0
- package/src/lib/api/postSync.js +68 -0
- package/src/lib/helpers/armoredKeyDisplay.js +10 -0
- package/src/lib/helpers/buildApiError.js +16 -0
- package/src/lib/helpers/buildOauthError.js +13 -0
- package/src/lib/helpers/canonicalEnvFilename.js +13 -0
- package/src/lib/helpers/clipboardy/fallbacks/linux/xsel +0 -0
- package/src/lib/helpers/clipboardy/fallbacks/windows/clipboard_i686.exe +0 -0
- package/src/lib/helpers/clipboardy/fallbacks/windows/clipboard_x86_64.exe +0 -0
- package/src/lib/helpers/clipboardy/linux.js +57 -0
- package/src/lib/helpers/clipboardy/macos.js +14 -0
- package/src/lib/helpers/clipboardy/termux.js +41 -0
- package/src/lib/helpers/clipboardy/windows.js +16 -0
- package/src/lib/helpers/clipboardy.js +51 -0
- package/src/lib/helpers/confirm.js +17 -0
- package/src/lib/helpers/createSpinner.js +101 -0
- package/src/lib/helpers/createSpinner2.js +24 -0
- package/src/lib/helpers/decryptValue.js +10 -0
- package/src/lib/helpers/dotenvxProjectId.js +36 -0
- package/src/lib/helpers/encryptValue.js +9 -0
- package/src/lib/helpers/errors.js +30 -0
- package/src/lib/helpers/formatCode.js +11 -0
- package/src/lib/helpers/gitBranch.js +13 -0
- package/src/lib/helpers/gitUrl.js +13 -0
- package/src/lib/helpers/http.js +17 -0
- package/src/lib/helpers/jsonToEnv.js +7 -0
- package/src/lib/helpers/keyNamesForEnvFile.js +43 -0
- package/src/lib/helpers/keypairMetadata.js +88 -0
- package/src/lib/helpers/likelyUpdateCommand.js +33 -0
- package/src/lib/helpers/localKeypair.js +12 -0
- package/src/lib/helpers/mask.js +12 -0
- package/src/lib/helpers/normalizePath.js +5 -0
- package/src/lib/helpers/normalizeToken.js +5 -0
- package/src/lib/helpers/openUrl.js +7 -0
- package/src/lib/helpers/packageJson.js +3 -0
- package/src/lib/helpers/playwrightConnect.js +29 -0
- package/src/lib/helpers/pluralize.js +10 -0
- package/src/lib/helpers/prompts.js +68 -0
- package/src/lib/helpers/removeEnvKey.js +50 -0
- package/src/lib/helpers/safeRealpath.js +13 -0
- package/src/lib/helpers/sha256File.js +9 -0
- package/src/lib/helpers/smartMask.js +11 -0
- package/src/lib/helpers/truncate.js +10 -0
- package/src/lib/helpers/upsertEnvKey.js +61 -0
- package/src/lib/main.d.ts +152 -0
- package/src/lib/main.js +114 -0
- package/src/lib/services/armorDown.js +77 -0
- package/src/lib/services/armorMove.js +54 -0
- package/src/lib/services/armorPull.js +77 -0
- package/src/lib/services/armorPush.js +82 -0
- package/src/lib/services/armorUp.js +79 -0
- package/src/lib/services/backup.js +105 -0
- package/src/lib/services/gatewayStart.js +132 -0
- package/src/lib/services/keypair.js +59 -0
- package/src/lib/services/loggedIn.js +24 -0
- package/src/lib/services/login.js +28 -0
- package/src/lib/services/loginPoll.js +43 -0
- package/src/lib/services/logout.js +28 -0
- package/src/lib/services/rotate.js +28 -0
- package/src/lib/services/rotateGithubConnect.js +56 -0
- package/src/lib/services/rotateNpmConnect.js +56 -0
- package/src/lib/services/rotateOpenaiConnect.js +60 -0
- package/src/lib/services/status.js +11 -0
- package/src/lib/services/sync.js +70 -0
- package/src/lib/services/syncConflict.js +36 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
Dotenvx Ops End-User License Agreement (EULA)
|
|
2
|
+
|
|
3
|
+
Applies to: Dotenvx Ops (CLI, SDKs, and related software)
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Summary
|
|
8
|
+
|
|
9
|
+
Dotenvx Ops 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
|
+
|
|
11
|
+
By installing, accessing, or using Dotenvx Ops, you agree to these terms.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
1. License
|
|
16
|
+
|
|
17
|
+
You are granted a non-exclusive, non-transferable, revocable license to use Dotenvx Ops as long as:
|
|
18
|
+
- You have an active license (via paid subscription or evaluation, including time-limited free trials)
|
|
19
|
+
- You do not distribute or sublicense the software
|
|
20
|
+
- You do not attempt to bypass license enforcement or API restrictions
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
2. Use
|
|
25
|
+
|
|
26
|
+
You may:
|
|
27
|
+
- Use Dotenvx Ops internally for your own development or production workflows
|
|
28
|
+
- Install the CLI or SDKs on machines you or your team control
|
|
29
|
+
|
|
30
|
+
You may not:
|
|
31
|
+
- Share the software or source with third parties
|
|
32
|
+
- Offer it as a hosted service, SaaS platform, or similar product
|
|
33
|
+
- Use it in a way that competes with dotenvx.com
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
3. Ownership
|
|
38
|
+
|
|
39
|
+
All rights, title, and interest in Dotenvx Ops remain with DOTENVX LLC. You’re granted limited usage rights, not ownership.
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
4. Termination
|
|
44
|
+
|
|
45
|
+
We may revoke your license if you:
|
|
46
|
+
- Violate these terms
|
|
47
|
+
- Fail to pay your subscription
|
|
48
|
+
|
|
49
|
+
You must stop using the software immediately if your license is terminated.
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
5. Warranty Disclaimer
|
|
54
|
+
|
|
55
|
+
Dotenvx Ops is provided as-is, with no guarantees that it will work for your specific use case. You assume all risk.
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
6. Limitation of Liability
|
|
60
|
+
|
|
61
|
+
We are not liable for any indirect or consequential damages, including loss of data, downtime, or lost profits. Our total liability is limited to the amount you paid us for your license.
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
7. Contact
|
|
66
|
+
|
|
67
|
+
Have questions? Email us at ops@dotenvx.com
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
© 2025 DOTENVX LLC. All rights reserved.
|
package/README.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
[](https://dotenvx.com/ops)
|
|
2
|
+
|
|
3
|
+
```
|
|
4
|
+
⛨ ARMORED KEYS: Harden your private keys.
|
|
5
|
+
⮕ install [curl -sfS https://dotenvx.sh/ops | sh]
|
|
6
|
+
⮕ then run [dotenvx-ops login]
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
[Learn more](https://dotenvx.com/ops)
|
|
10
|
+
|
|
11
|
+
|
package/package.json
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "0.49.0",
|
|
3
|
+
"name": "@dotenvx/dotenvx-vlt",
|
|
4
|
+
"description": "Secrets for agents–from the creator of `dotenv` and `dotenvx`",
|
|
5
|
+
"author": "@motdotla",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"dotenv",
|
|
8
|
+
"dotenvx",
|
|
9
|
+
"ops",
|
|
10
|
+
"vlt",
|
|
11
|
+
"vault",
|
|
12
|
+
"env"
|
|
13
|
+
],
|
|
14
|
+
"homepage": "https://dotenvx.com/ops",
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "git+https://github.com/dotenvx/dotenvx-ops.git"
|
|
18
|
+
},
|
|
19
|
+
"license": "See LICENSE",
|
|
20
|
+
"files": [
|
|
21
|
+
"src/**/*",
|
|
22
|
+
"CHANGELOG.md"
|
|
23
|
+
],
|
|
24
|
+
"main": "src/lib/main.js",
|
|
25
|
+
"exports": {
|
|
26
|
+
".": {
|
|
27
|
+
"types": "./src/lib/main.d.ts",
|
|
28
|
+
"require": "./src/lib/main.js",
|
|
29
|
+
"default": "./src/lib/main.js"
|
|
30
|
+
},
|
|
31
|
+
"./package.json": "./package.json"
|
|
32
|
+
},
|
|
33
|
+
"bin": {
|
|
34
|
+
"dotenvx-ops": "./src/cli/dotenvx-ops.js",
|
|
35
|
+
"dotenvx-vlt": "./src/cli/dotenvx-ops.js"
|
|
36
|
+
},
|
|
37
|
+
"scripts": {
|
|
38
|
+
"build": "node esbuild.js",
|
|
39
|
+
"build:minify": "node esbuild.js --minify",
|
|
40
|
+
"standard": "standard",
|
|
41
|
+
"standard:fix": "standard --fix",
|
|
42
|
+
"test": "tap run --allow-empty-coverage --disable-coverage --timeout=60000",
|
|
43
|
+
"test-coverage": "tap run --show-full-coverage --timeout=60000",
|
|
44
|
+
"prerelease": "npm test",
|
|
45
|
+
"release": "standard-version"
|
|
46
|
+
},
|
|
47
|
+
"dependencies": {
|
|
48
|
+
"@clack/core": "^0.4.2",
|
|
49
|
+
"@dotenvx/dotenvx": "^1.68.0",
|
|
50
|
+
"arch": "^2.1.1",
|
|
51
|
+
"commander": "^11.1.0",
|
|
52
|
+
"conf": "^10.2.0",
|
|
53
|
+
"dotenv": "^17.2.0",
|
|
54
|
+
"eciesjs": "^0.4.7",
|
|
55
|
+
"enquirer": "^2.4.1",
|
|
56
|
+
"execa": "^5.1.1",
|
|
57
|
+
"express": "^5.2.1",
|
|
58
|
+
"open": "^8.4.2",
|
|
59
|
+
"playwright": "^1.57.0",
|
|
60
|
+
"semver": "^7.7.4",
|
|
61
|
+
"systeminformation": "^5.22.11",
|
|
62
|
+
"undici": "^7.11.0",
|
|
63
|
+
"yocto-spinner": "^1.1.0"
|
|
64
|
+
},
|
|
65
|
+
"devDependencies": {
|
|
66
|
+
"@yao-pkg/pkg": "^6.14.2",
|
|
67
|
+
"capture-console": "^1.0.2",
|
|
68
|
+
"esbuild": "^0.25.8",
|
|
69
|
+
"sinon": "^14.0.1",
|
|
70
|
+
"standard": "^17.1.2",
|
|
71
|
+
"standard-version": "^9.5.0",
|
|
72
|
+
"tap": "^21.6.2"
|
|
73
|
+
},
|
|
74
|
+
"publishConfig": {
|
|
75
|
+
"access": "public"
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
const { logger } = require('@dotenvx/dotenvx')
|
|
2
|
+
const Session = require('./../../../db/session')
|
|
3
|
+
const ArmorDown = require('./../../../lib/services/armorDown')
|
|
4
|
+
const createSpinner = require('../../../lib/helpers/createSpinner2')
|
|
5
|
+
const armoredKeyDisplay = require('../../../lib/helpers/armoredKeyDisplay')
|
|
6
|
+
|
|
7
|
+
async function down () {
|
|
8
|
+
const options = this.opts()
|
|
9
|
+
const spinner = await createSpinner({ ...options, text: 'dearmoring' })
|
|
10
|
+
|
|
11
|
+
logger.debug(`options: ${JSON.stringify(options)}`)
|
|
12
|
+
|
|
13
|
+
const sesh = new Session()
|
|
14
|
+
await sesh.notifyUpdate()
|
|
15
|
+
const hostname = options.hostname || sesh.hostname()
|
|
16
|
+
const token = options.token || sesh.token()
|
|
17
|
+
|
|
18
|
+
try {
|
|
19
|
+
const devicePublicKey = sesh.devicePublicKey()
|
|
20
|
+
|
|
21
|
+
const { changed, privateKeyName, publicKeyValue } = await new ArmorDown(hostname, token, devicePublicKey, options.envFile, options.team).run()
|
|
22
|
+
const keyDisplay = armoredKeyDisplay(publicKeyValue) || privateKeyName
|
|
23
|
+
|
|
24
|
+
if (spinner) spinner.stop()
|
|
25
|
+
if (changed) {
|
|
26
|
+
logger.success(`◇ dearmored to .env.keys (${keyDisplay})`)
|
|
27
|
+
} else {
|
|
28
|
+
logger.info(`○ no change (${keyDisplay})`)
|
|
29
|
+
}
|
|
30
|
+
} catch (error) {
|
|
31
|
+
if (spinner) spinner.stop()
|
|
32
|
+
logger.error(error.message)
|
|
33
|
+
process.exit(1)
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
module.exports = down
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
const { logger } = require('@dotenvx/dotenvx')
|
|
2
|
+
const Session = require('./../../../db/session')
|
|
3
|
+
const ArmorMove = require('./../../../lib/services/armorMove')
|
|
4
|
+
const createSpinner = require('../../../lib/helpers/createSpinner2')
|
|
5
|
+
const armoredKeyDisplay = require('../../../lib/helpers/armoredKeyDisplay')
|
|
6
|
+
|
|
7
|
+
async function move () {
|
|
8
|
+
const options = this.opts()
|
|
9
|
+
const spinner = await createSpinner({ ...options, text: 'moving' })
|
|
10
|
+
|
|
11
|
+
logger.debug(`options: ${JSON.stringify(options)}`)
|
|
12
|
+
|
|
13
|
+
const sesh = new Session()
|
|
14
|
+
await sesh.notifyUpdate()
|
|
15
|
+
const hostname = options.hostname || sesh.hostname()
|
|
16
|
+
const token = options.token || sesh.token()
|
|
17
|
+
|
|
18
|
+
try {
|
|
19
|
+
const devicePublicKey = sesh.devicePublicKey()
|
|
20
|
+
|
|
21
|
+
const {
|
|
22
|
+
changed,
|
|
23
|
+
privateKeyName,
|
|
24
|
+
publicKeyValue,
|
|
25
|
+
team
|
|
26
|
+
} = await new ArmorMove(hostname, token, devicePublicKey, options.envFile).run()
|
|
27
|
+
const keyDisplay = armoredKeyDisplay(publicKeyValue) || privateKeyName
|
|
28
|
+
|
|
29
|
+
if (spinner) spinner.stop()
|
|
30
|
+
if (changed) {
|
|
31
|
+
logger.success(`⛨ moved to ${team} (${keyDisplay})`)
|
|
32
|
+
} else {
|
|
33
|
+
logger.info(`○ no change (${keyDisplay})`)
|
|
34
|
+
}
|
|
35
|
+
} catch (error) {
|
|
36
|
+
if (spinner) spinner.stop()
|
|
37
|
+
logger.error(error.message)
|
|
38
|
+
process.exit(1)
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
module.exports = move
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
const { logger } = require('@dotenvx/dotenvx')
|
|
2
|
+
const Session = require('./../../../db/session')
|
|
3
|
+
const ArmorPull = require('./../../../lib/services/armorPull')
|
|
4
|
+
const createSpinner = require('../../../lib/helpers/createSpinner2')
|
|
5
|
+
const armoredKeyDisplay = require('../../../lib/helpers/armoredKeyDisplay')
|
|
6
|
+
|
|
7
|
+
async function pull () {
|
|
8
|
+
const options = this.opts()
|
|
9
|
+
const spinner = await createSpinner({ ...options, text: 'pulling' })
|
|
10
|
+
|
|
11
|
+
logger.debug(`options: ${JSON.stringify(options)}`)
|
|
12
|
+
|
|
13
|
+
const sesh = new Session()
|
|
14
|
+
await sesh.notifyUpdate()
|
|
15
|
+
const hostname = options.hostname || sesh.hostname()
|
|
16
|
+
const token = options.token || sesh.token()
|
|
17
|
+
|
|
18
|
+
try {
|
|
19
|
+
const devicePublicKey = sesh.devicePublicKey()
|
|
20
|
+
|
|
21
|
+
const { changed, privateKeyName, publicKeyValue } = await new ArmorPull(hostname, token, devicePublicKey, options.envFile, options.team).run()
|
|
22
|
+
const keyDisplay = armoredKeyDisplay(publicKeyValue) || privateKeyName
|
|
23
|
+
|
|
24
|
+
if (spinner) spinner.stop()
|
|
25
|
+
if (changed) {
|
|
26
|
+
logger.success(`◇ pulled to .env.keys (${keyDisplay})`)
|
|
27
|
+
} else {
|
|
28
|
+
logger.info(`○ no change (${keyDisplay})`)
|
|
29
|
+
}
|
|
30
|
+
} catch (error) {
|
|
31
|
+
if (spinner) spinner.stop()
|
|
32
|
+
logger.error(error.message)
|
|
33
|
+
process.exit(1)
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
module.exports = pull
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
const { logger } = require('@dotenvx/dotenvx')
|
|
2
|
+
const Session = require('./../../../db/session')
|
|
3
|
+
const ArmorPush = require('./../../../lib/services/armorPush')
|
|
4
|
+
const createSpinner = require('../../../lib/helpers/createSpinner2')
|
|
5
|
+
const armoredKeyDisplay = require('../../../lib/helpers/armoredKeyDisplay')
|
|
6
|
+
|
|
7
|
+
async function push () {
|
|
8
|
+
const options = this.opts()
|
|
9
|
+
const spinner = await createSpinner({ ...options, text: 'pushing' })
|
|
10
|
+
|
|
11
|
+
logger.debug(`options: ${JSON.stringify(options)}`)
|
|
12
|
+
|
|
13
|
+
const sesh = new Session()
|
|
14
|
+
await sesh.notifyUpdate()
|
|
15
|
+
const hostname = options.hostname || sesh.hostname()
|
|
16
|
+
const token = options.token || sesh.token()
|
|
17
|
+
|
|
18
|
+
try {
|
|
19
|
+
const devicePublicKey = sesh.devicePublicKey()
|
|
20
|
+
|
|
21
|
+
const { changed, privateKeyName, publicKeyValue } = await new ArmorPush(hostname, token, devicePublicKey, options.envFile, options.team).run()
|
|
22
|
+
const keyDisplay = armoredKeyDisplay(publicKeyValue) || privateKeyName
|
|
23
|
+
|
|
24
|
+
if (spinner) spinner.stop()
|
|
25
|
+
if (changed) {
|
|
26
|
+
logger.success(`⛨ pushed (${keyDisplay})`)
|
|
27
|
+
} else {
|
|
28
|
+
logger.info(`○ no change (${keyDisplay})`)
|
|
29
|
+
}
|
|
30
|
+
} catch (error) {
|
|
31
|
+
if (spinner) spinner.stop()
|
|
32
|
+
logger.error(error.message)
|
|
33
|
+
process.exit(1)
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
module.exports = push
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const { logger } = require('@dotenvx/dotenvx')
|
|
2
|
+
const Session = require('./../../../db/session')
|
|
3
|
+
const createSpinner = require('../../../lib/helpers/createSpinner2')
|
|
4
|
+
|
|
5
|
+
async function rotate () {
|
|
6
|
+
const options = this.opts()
|
|
7
|
+
const spinner = await createSpinner({ ...options, text: 'rotating' })
|
|
8
|
+
|
|
9
|
+
logger.debug(`options: ${JSON.stringify(options)}`)
|
|
10
|
+
|
|
11
|
+
const sesh = new Session()
|
|
12
|
+
await sesh.notifyUpdate()
|
|
13
|
+
|
|
14
|
+
try {
|
|
15
|
+
if (spinner) spinner.stop()
|
|
16
|
+
|
|
17
|
+
logger.info('◇ coming soon')
|
|
18
|
+
} catch (error) {
|
|
19
|
+
if (spinner) spinner.stop()
|
|
20
|
+
logger.error(error.message)
|
|
21
|
+
process.exit(1)
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
module.exports = rotate
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
const { logger } = require('@dotenvx/dotenvx')
|
|
2
|
+
const Session = require('./../../../db/session')
|
|
3
|
+
const ArmorUp = require('./../../../lib/services/armorUp')
|
|
4
|
+
const createSpinner = require('../../../lib/helpers/createSpinner2')
|
|
5
|
+
const armoredKeyDisplay = require('../../../lib/helpers/armoredKeyDisplay')
|
|
6
|
+
|
|
7
|
+
async function up () {
|
|
8
|
+
const options = this.opts()
|
|
9
|
+
const spinner = await createSpinner({ ...options, text: 'armoring' })
|
|
10
|
+
|
|
11
|
+
logger.debug(`options: ${JSON.stringify(options)}`)
|
|
12
|
+
|
|
13
|
+
const sesh = new Session()
|
|
14
|
+
sesh.notifyUpdate()
|
|
15
|
+
const hostname = options.hostname || sesh.hostname()
|
|
16
|
+
const token = options.token || sesh.token()
|
|
17
|
+
|
|
18
|
+
try {
|
|
19
|
+
const devicePublicKey = sesh.devicePublicKey()
|
|
20
|
+
|
|
21
|
+
const { changed, privateKeyName, publicKeyValue } = await new ArmorUp(hostname, token, devicePublicKey, options.envFile, options.team).run()
|
|
22
|
+
const keyDisplay = armoredKeyDisplay(publicKeyValue) || privateKeyName
|
|
23
|
+
|
|
24
|
+
if (spinner) spinner.stop()
|
|
25
|
+
if (changed) {
|
|
26
|
+
logger.success(`⛨ armored (${keyDisplay})`)
|
|
27
|
+
} else {
|
|
28
|
+
logger.info(`○ no change (${keyDisplay})`)
|
|
29
|
+
}
|
|
30
|
+
} catch (error) {
|
|
31
|
+
if (spinner) spinner.stop()
|
|
32
|
+
logger.error(error.message)
|
|
33
|
+
process.exit(1)
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
module.exports = up
|
|
@@ -0,0 +1,93 @@
|
|
|
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
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const { logger } = require('@dotenvx/dotenvx')
|
|
2
|
+
|
|
3
|
+
const GatewayStart = require('./../../../lib/services/gatewayStart')
|
|
4
|
+
|
|
5
|
+
async function start () {
|
|
6
|
+
try {
|
|
7
|
+
const options = this.opts()
|
|
8
|
+
logger.debug(`options: ${JSON.stringify(options)}`)
|
|
9
|
+
|
|
10
|
+
await new GatewayStart({ port: options.port, hostname: options.hostname }).run()
|
|
11
|
+
} catch (error) {
|
|
12
|
+
logger.error(error.message)
|
|
13
|
+
process.exit(1)
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
module.exports = start
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const { logger } = require('@dotenvx/dotenvx')
|
|
2
|
+
const Session = require('./../../db/session')
|
|
3
|
+
|
|
4
|
+
const main = require('./../../lib/main')
|
|
5
|
+
|
|
6
|
+
async function get (uri) {
|
|
7
|
+
// debug opts
|
|
8
|
+
const options = this.opts()
|
|
9
|
+
logger.debug(`options: ${JSON.stringify(options)}`)
|
|
10
|
+
|
|
11
|
+
const sesh = new Session()
|
|
12
|
+
const hostname = options.hostname || sesh.hostname()
|
|
13
|
+
const token = options.token
|
|
14
|
+
|
|
15
|
+
try {
|
|
16
|
+
const value = await main.get(uri, { hostname, token })
|
|
17
|
+
console.log(value)
|
|
18
|
+
} catch (error) {
|
|
19
|
+
if (error.message) {
|
|
20
|
+
logger.error(error.message)
|
|
21
|
+
} else {
|
|
22
|
+
logger.error(error)
|
|
23
|
+
}
|
|
24
|
+
if (error.help) {
|
|
25
|
+
logger.help(error.help)
|
|
26
|
+
}
|
|
27
|
+
if (error.stack) {
|
|
28
|
+
logger.debug(error.stack)
|
|
29
|
+
}
|
|
30
|
+
process.exit(1)
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
module.exports = get
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
const { logger } = require('@dotenvx/dotenvx')
|
|
2
|
+
const Session = require('./../../db/session')
|
|
3
|
+
const createSpinner = require('../../lib/helpers/createSpinner2')
|
|
4
|
+
const Keypair = require('../../lib/services/keypair')
|
|
5
|
+
|
|
6
|
+
function printKeypair (json, options) {
|
|
7
|
+
const output = {
|
|
8
|
+
public_key: json.public_key,
|
|
9
|
+
private_key: json.private_key
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
let space = 0
|
|
13
|
+
if (options.prettyPrint) {
|
|
14
|
+
space = 2
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
console.log(JSON.stringify(output, null, space))
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
async function keypair (publicKey) {
|
|
21
|
+
// debug opts
|
|
22
|
+
const options = this.opts()
|
|
23
|
+
|
|
24
|
+
logger.debug(`options: ${JSON.stringify(options)}`)
|
|
25
|
+
if (publicKey) {
|
|
26
|
+
logger.debug(`publicKey: ${publicKey}`)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const spinner = await createSpinner({ ...options, text: 'retrieving' })
|
|
30
|
+
const sesh = new Session()
|
|
31
|
+
await sesh.notifyUpdate()
|
|
32
|
+
const hostname = options.hostname || sesh.hostname()
|
|
33
|
+
const token = options.token || sesh.token()
|
|
34
|
+
try {
|
|
35
|
+
const devicePublicKey = sesh.devicePublicKey()
|
|
36
|
+
|
|
37
|
+
const args = [hostname, token, devicePublicKey, publicKey, options.team]
|
|
38
|
+
if (options.envFile !== undefined) {
|
|
39
|
+
args.push(options.envFile)
|
|
40
|
+
}
|
|
41
|
+
const json = await new Keypair(...args).run()
|
|
42
|
+
|
|
43
|
+
if (spinner) spinner.stop()
|
|
44
|
+
printKeypair(json, options)
|
|
45
|
+
} catch (error) {
|
|
46
|
+
if (spinner) spinner.stop()
|
|
47
|
+
if (error.message) {
|
|
48
|
+
logger.error(error.message)
|
|
49
|
+
} else {
|
|
50
|
+
logger.error(error)
|
|
51
|
+
}
|
|
52
|
+
if (error.stack) {
|
|
53
|
+
logger.debug(error.stack)
|
|
54
|
+
}
|
|
55
|
+
process.exit(1)
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
module.exports = keypair
|