@dotenvx/dotenvx-ops 0.46.0 → 0.47.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,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.46.0...main)
5
+ [Unreleased](https://github.com/dotenvx/dotenvx-ops/compare/v0.47.0...main)
6
+
7
+ ## [0.47.0](https://github.com/dotenvx/dotenvx-ops/compare/v0.46.1...v0.47.0) (2026-05-20)
8
+
9
+ ### Added
10
+
11
+ * Add `--token` support to `armor` commands ([#76](https://github.com/dotenvx/dotenvx-ops/pull/76))
12
+
13
+ ## [0.46.1](https://github.com/dotenvx/dotenvx-ops/compare/v0.46.0...v0.46.1) (2026-05-13)
14
+
15
+ ### Changed
16
+
17
+ * Surface `--no-spinner` ([#72](https://github.com/dotenvx/dotenvx-ops/pull/72))
6
18
 
7
19
  ## [0.46.0](https://github.com/dotenvx/dotenvx-ops/compare/v0.45.3...v0.46.0) (2026-05-13)
8
20
 
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.46.0",
2
+ "version": "0.47.0",
3
3
  "name": "@dotenvx/dotenvx-ops",
4
4
  "description": "Secrets for agents–from the creator of `dotenv` and `dotenvx`",
5
5
  "author": "@motdotla",
@@ -1,18 +1,56 @@
1
1
  const { logger } = require('@dotenvx/dotenvx')
2
+ const prompts = require('@inquirer/prompts')
2
3
  const Session = require('./../../db/session')
3
4
  const createSpinner = require('../../lib/helpers/createSpinner2')
4
5
  const Keypair = require('../../lib/services/keypair')
6
+ const localKeypair = require('../../lib/helpers/localKeypair')
7
+
8
+ async function selectKeypairMode () {
9
+ return prompts.select({
10
+ message: 'Select key storage',
11
+ choices: [
12
+ { name: 'armored', value: 'armored' },
13
+ { name: 'local', value: 'local' }
14
+ ]
15
+ }, {
16
+ input: process.stdin,
17
+ output: process.stderr
18
+ })
19
+ }
20
+
21
+ function printKeypair (json, options) {
22
+ const output = {
23
+ public_key: json.public_key,
24
+ private_key: json.private_key
25
+ }
26
+
27
+ let space = 0
28
+ if (options.prettyPrint) {
29
+ space = 2
30
+ }
31
+
32
+ console.log(JSON.stringify(output, null, space))
33
+ }
5
34
 
6
35
  async function keypair (publicKey) {
7
36
  // debug opts
8
37
  const options = this.opts()
9
- const spinner = await createSpinner({ ...options, text: 'retrieving' })
10
38
 
11
39
  logger.debug(`options: ${JSON.stringify(options)}`)
12
40
  if (publicKey) {
13
41
  logger.debug(`publicKey: ${publicKey}`)
14
42
  }
15
43
 
44
+ let mode
45
+ if (!publicKey) {
46
+ mode = await selectKeypairMode()
47
+ if (mode === 'local') {
48
+ printKeypair(localKeypair(), options)
49
+ return
50
+ }
51
+ }
52
+
53
+ const spinner = await createSpinner({ ...options, text: 'retrieving' })
16
54
  const sesh = new Session()
17
55
  await sesh.notifyUpdate()
18
56
  const hostname = options.hostname || sesh.hostname()
@@ -22,18 +60,8 @@ async function keypair (publicKey) {
22
60
 
23
61
  const json = await new Keypair(hostname, token, devicePublicKey, publicKey, options.team).run()
24
62
 
25
- const output = {
26
- public_key: json.public_key,
27
- private_key: json.private_key
28
- }
29
-
30
- let space = 0
31
- if (options.prettyPrint) {
32
- space = 2
33
- }
34
-
35
63
  if (spinner) spinner.stop()
36
- console.log(JSON.stringify(output, null, space))
64
+ printKeypair(json, options)
37
65
  } catch (error) {
38
66
  if (spinner) spinner.stop()
39
67
  if (error.message) {
@@ -18,6 +18,7 @@ armor
18
18
  .command('up')
19
19
  .description('armor private key')
20
20
  .option('-f, --env-file <path>', 'path to your env file')
21
+ .option('--token <token>', 'set token')
21
22
  .option('--team <team>', 'team to armor private key for')
22
23
  .action(upAction)
23
24
 
@@ -27,6 +28,7 @@ armor
27
28
  .command('down')
28
29
  .description('dearmor private key')
29
30
  .option('-f, --env-file <path>', 'path to your env file')
31
+ .option('--token <token>', 'set token')
30
32
  .option('--team <team>', 'team to dearmor private key from')
31
33
  .action(downAction)
32
34
 
@@ -36,6 +38,7 @@ armor
36
38
  .command('push')
37
39
  .description('push armored key (from .env.keys)')
38
40
  .option('-f, --env-file <path>', 'path to your env file')
41
+ .option('--token <token>', 'set token')
39
42
  .option('--team <team>', 'team to push armored private key for')
40
43
  .action(pushAction)
41
44
 
@@ -45,6 +48,7 @@ armor
45
48
  .command('pull')
46
49
  .description('pull armored key (into .env.keys)')
47
50
  .option('-f, --env-file <path>', 'path to your env file')
51
+ .option('--token <token>', 'set token')
48
52
  .option('--team <team>', 'team to pull armored private key from')
49
53
  .action(pullAction)
50
54
 
@@ -54,6 +58,7 @@ armor
54
58
  .command('rotate')
55
59
  .description('rotate armored key and re-encrypt .env file')
56
60
  .option('-f, --env-file <path>', 'path to your env file')
61
+ .option('--token <token>', 'set token')
57
62
  .action(rotateAction)
58
63
 
59
64
  // dotenvx-ops armor move
@@ -62,6 +67,7 @@ armor
62
67
  .command('move')
63
68
  .description('move armored key (to other team)')
64
69
  .option('-f, --env-file <path>', 'path to your env file')
70
+ .option('--token <token>', 'set token')
65
71
  .action(moveAction)
66
72
 
67
73
  module.exports = armor
@@ -133,6 +133,7 @@ program
133
133
  .option('-h, --hostname <url>', 'set hostname')
134
134
  .option('--token <token>', 'set token')
135
135
  .option('--team <team>', 'team to generate keypair for')
136
+ .option('--no-spinner', 'disable spinner output')
136
137
  .option('--pp, --pretty-print', 'pretty print output')
137
138
  .action(keypairAction)
138
139
 
@@ -4,7 +4,7 @@ const FRAME_INTERVAL_MS = 80
4
4
  async function createSpinner2 (options = {}) {
5
5
  const stream = process.stderr
6
6
  const hasCursorControls = typeof stream.cursorTo === 'function' && typeof stream.clearLine === 'function'
7
- const enabled = Boolean(stream.isTTY && hasCursorControls && !options.quiet && !options.verbose && !options.debug)
7
+ const enabled = Boolean(stream.isTTY && hasCursorControls && options.spinner !== false && !options.quiet && !options.verbose && !options.debug)
8
8
  if (!enabled) return null
9
9
 
10
10
  const text = options.text || 'thinking'
@@ -0,0 +1,12 @@
1
+ const { PrivateKey } = require('eciesjs')
2
+
3
+ function localKeypair () {
4
+ const kp = new PrivateKey()
5
+
6
+ return {
7
+ public_key: kp.publicKey.toHex(),
8
+ private_key: kp.secret.toString('hex')
9
+ }
10
+ }
11
+
12
+ module.exports = localKeypair