@dotenvx/dotenvx-ops 0.33.0 → 0.35.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/README.md +1 -1
- package/package.json +2 -2
- package/src/cli/actions/keypair.js +2 -3
- package/src/cli/actions/login.js +1 -1
- package/src/cli/dotenvx-ops.js +1 -0
- package/src/lib/api/postKeypair.js +13 -5
- package/src/lib/main.d.ts +21 -0
- package/src/lib/main.js +2 -2
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.35.0...main)
|
|
6
|
+
|
|
7
|
+
## [0.35.0](https://github.com/dotenvx/dotenvx-ops/compare/v0.34.0...v0.35.0) (2026-03-13)
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
* Change description to `KEYS OFF COMPUTER`
|
|
12
|
+
|
|
13
|
+
## [0.34.0](https://github.com/dotenvx/dotenvx-ops/compare/v0.33.0...v0.34.0) (2026-03-12)
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
|
|
17
|
+
* Run keypair against existing `public_key` as a lookup mechanism ([#28](https://github.com/dotenvx/dotenvx-ops/pull/28))
|
|
6
18
|
|
|
7
19
|
## [0.33.0](https://github.com/dotenvx/dotenvx-ops/compare/v0.32.0...v0.33.0) (2026-03-11)
|
|
8
20
|
|
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -2,16 +2,15 @@ const { logger } = require('@dotenvx/dotenvx')
|
|
|
2
2
|
|
|
3
3
|
const main = require('./../../lib/main')
|
|
4
4
|
|
|
5
|
-
async function keypair () {
|
|
5
|
+
async function keypair (publicKey) {
|
|
6
6
|
// debug opts
|
|
7
7
|
const options = this.opts()
|
|
8
8
|
logger.debug(`options: ${JSON.stringify(options)}`)
|
|
9
9
|
|
|
10
10
|
const hostname = options.hostname
|
|
11
11
|
const token = options.token
|
|
12
|
-
|
|
13
12
|
try {
|
|
14
|
-
const kp = await main.keypair({ hostname, token })
|
|
13
|
+
const kp = await main.keypair(publicKey, { hostname, token })
|
|
15
14
|
const output = {
|
|
16
15
|
public_key: kp.publicKey,
|
|
17
16
|
private_key: kp.privateKey
|
package/src/cli/actions/login.js
CHANGED
|
@@ -43,7 +43,7 @@ async function login () {
|
|
|
43
43
|
|
|
44
44
|
const data = await pollPromise
|
|
45
45
|
spinner.succeed(`logged in [${data.username}] to this device and activated token [${truncate(data.access_token, 11)}]`)
|
|
46
|
-
logger.help('⮕ next run [dotenvx-ops backup]')
|
|
46
|
+
// logger.help('⮕ next run [dotenvx-ops backup]')
|
|
47
47
|
process.exit(0)
|
|
48
48
|
} catch (error) {
|
|
49
49
|
spinner.stop()
|
package/src/cli/dotenvx-ops.js
CHANGED
|
@@ -122,6 +122,7 @@ const keypairAction = require('./actions/keypair')
|
|
|
122
122
|
program
|
|
123
123
|
.command('keypair')
|
|
124
124
|
.description('[INTERNAL] generate keypair')
|
|
125
|
+
.argument('[publicKey]', 'existing public key')
|
|
125
126
|
.option('-h, --hostname <url>', 'set hostname', sesh.hostname())
|
|
126
127
|
.option('--token <token>', 'set token')
|
|
127
128
|
.option('--pp, --pretty-print', 'pretty print output')
|
|
@@ -3,27 +3,35 @@ const buildApiError = require('../../lib/helpers/buildApiError')
|
|
|
3
3
|
const packageJson = require('../../lib/helpers/packageJson')
|
|
4
4
|
|
|
5
5
|
class PostKeypair {
|
|
6
|
-
constructor (hostname, token, devicePublicKey) {
|
|
6
|
+
constructor (hostname, token, devicePublicKey, publicKey) {
|
|
7
7
|
this.hostname = hostname || 'https://ops.dotenvx.com'
|
|
8
8
|
this.token = token
|
|
9
9
|
this.devicePublicKey = devicePublicKey
|
|
10
|
+
this.publicKey = publicKey
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
async run () {
|
|
13
14
|
const token = this.token
|
|
14
15
|
const devicePublicKey = this.devicePublicKey
|
|
16
|
+
const publicKey = this.publicKey
|
|
15
17
|
const url = `${this.hostname}/api/keypair`
|
|
16
18
|
|
|
19
|
+
const body = {
|
|
20
|
+
device_public_key: devicePublicKey,
|
|
21
|
+
cli_version: packageJson.version
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (publicKey) {
|
|
25
|
+
body.public_key = publicKey
|
|
26
|
+
}
|
|
27
|
+
|
|
17
28
|
const resp = await http(url, {
|
|
18
29
|
method: 'POST',
|
|
19
30
|
headers: {
|
|
20
31
|
Authorization: `Bearer ${token}`,
|
|
21
32
|
'Content-Type': 'application/json'
|
|
22
33
|
},
|
|
23
|
-
body: JSON.stringify(
|
|
24
|
-
device_public_key: devicePublicKey,
|
|
25
|
-
cli_version: packageJson.version
|
|
26
|
-
})
|
|
34
|
+
body: JSON.stringify(body)
|
|
27
35
|
})
|
|
28
36
|
|
|
29
37
|
const json = await resp.body.json()
|
package/src/lib/main.d.ts
CHANGED
|
@@ -9,6 +9,27 @@ import type { URL } from 'url';
|
|
|
9
9
|
*/
|
|
10
10
|
export function observe(payload: string): string;
|
|
11
11
|
|
|
12
|
+
export interface DotenvOpsOptions {
|
|
13
|
+
hostname?: string;
|
|
14
|
+
token?: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type DotenvOpsKeypairOptions = DotenvOpsOptions;
|
|
18
|
+
|
|
19
|
+
export interface DotenvOpsKeypairOutput {
|
|
20
|
+
publicKey: string;
|
|
21
|
+
privateKey: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Creates a remote keypair for the current authenticated device.
|
|
26
|
+
*
|
|
27
|
+
* @param publicKey - optional existing public key to fetch
|
|
28
|
+
* @param options - optional hostname/token overrides
|
|
29
|
+
* @returns generated public and private keys
|
|
30
|
+
*/
|
|
31
|
+
export function keypair(publicKey?: string, options?: DotenvOpsKeypairOptions): Promise<DotenvOpsKeypairOutput>;
|
|
32
|
+
|
|
12
33
|
export interface DotenvConfigOptions {
|
|
13
34
|
/**
|
|
14
35
|
* Specify a custom path if your file containing environment variables is located elsewhere.
|
package/src/lib/main.js
CHANGED
|
@@ -77,7 +77,7 @@ const set = async function (uri, value, options = {}) {
|
|
|
77
77
|
return await new PostSet(hostname, token, devicePublicKey, uri, value).run()
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
const keypair = async function (options = {}) {
|
|
80
|
+
const keypair = async function (publicKey, options = {}) {
|
|
81
81
|
const sesh = new Session() // TODO: handle scenario where constructor fails
|
|
82
82
|
|
|
83
83
|
let hostname = process.env.DOTENVX_OPS_HOSTNAME || options.hostname
|
|
@@ -92,7 +92,7 @@ const keypair = async function (options = {}) {
|
|
|
92
92
|
|
|
93
93
|
const devicePublicKey = sesh.devicePublicKey()
|
|
94
94
|
|
|
95
|
-
const json = await new PostKeypair(hostname, token, devicePublicKey).run()
|
|
95
|
+
const json = await new PostKeypair(hostname, token, devicePublicKey, publicKey).run()
|
|
96
96
|
|
|
97
97
|
return {
|
|
98
98
|
publicKey: json.public_key,
|