getmyenv 0.14.0 → 0.14.1
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/README.md +1 -1
- package/dist/commands/guest.js +5 -3
- package/dist/lib/fs.js +5 -5
- package/dist/lib/known-keys-cache.js +5 -3
- package/package.json +3 -3
package/README.md
CHANGED
package/dist/commands/guest.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { randomBytes } from "node:crypto";
|
|
2
|
+
import fs from "node:fs";
|
|
2
3
|
import path from "node:path";
|
|
3
4
|
import { pcErr as pc } from "../lib/colors.js";
|
|
4
5
|
import { createUserKeys, wipe } from "@getmyenv/crypto";
|
|
5
6
|
import { FACTS, TEMPLATE_FILE } from "@getmyenv/shared";
|
|
6
|
-
import { ensureGitignoreHasEnv,
|
|
7
|
+
import { ensureGitignoreHasEnv, claimFilePath, readProjectMeta, writeClaimFile, writeProjectMeta, } from "../lib/fs.js";
|
|
7
8
|
import { readFolderToken, writeFolderToken } from "../lib/credentials.js";
|
|
8
9
|
import { ApiClient, resolveApiUrl } from "../lib/api.js";
|
|
9
10
|
import { readTemplateFile } from "../lib/template-file.js";
|
|
@@ -23,8 +24,9 @@ export async function createGuestProject(opts = {}) {
|
|
|
23
24
|
const name = previous?.projectName ?? previous?.projectId;
|
|
24
25
|
throw new Error(`This folder is already linked${name ? ` to ${name}` : ""}. See it: npx getmyenv status. To start over: npx getmyenv unlink, then npx getmyenv guest`);
|
|
25
26
|
}
|
|
26
|
-
// claim.json is the only copy of a guest project's passphrase. Never write over
|
|
27
|
-
|
|
27
|
+
// claim.json is the only copy of a guest project's passphrase. Never write over
|
|
28
|
+
// it, even when it does not parse.
|
|
29
|
+
if (fs.existsSync(claimFilePath())) {
|
|
28
30
|
throw new Error("This folder has a guest project (claim.json) but no token on this machine. Claim it: npx getmyenv claim");
|
|
29
31
|
}
|
|
30
32
|
const apiUrl = resolveApiUrl(opts.apiUrl);
|
package/dist/lib/fs.js
CHANGED
|
@@ -291,7 +291,9 @@ export function readClaimFile(cwd = process.cwd()) {
|
|
|
291
291
|
const raw = JSON.parse(readTextFile(file));
|
|
292
292
|
if (typeof raw.claimCode !== "string" ||
|
|
293
293
|
typeof raw.passphrase !== "string" ||
|
|
294
|
-
typeof raw.projectId !== "string"
|
|
294
|
+
typeof raw.projectId !== "string" ||
|
|
295
|
+
typeof raw.projectName !== "string" ||
|
|
296
|
+
typeof raw.guestExpiresAt !== "string") {
|
|
295
297
|
return null;
|
|
296
298
|
}
|
|
297
299
|
return {
|
|
@@ -299,10 +301,8 @@ export function readClaimFile(cwd = process.cwd()) {
|
|
|
299
301
|
claimCode: raw.claimCode,
|
|
300
302
|
passphrase: raw.passphrase,
|
|
301
303
|
projectId: raw.projectId,
|
|
302
|
-
projectName:
|
|
303
|
-
guestExpiresAt:
|
|
304
|
-
? raw.guestExpiresAt
|
|
305
|
-
: new Date().toISOString(),
|
|
304
|
+
projectName: raw.projectName,
|
|
305
|
+
guestExpiresAt: raw.guestExpiresAt,
|
|
306
306
|
};
|
|
307
307
|
}
|
|
308
308
|
catch {
|
|
@@ -18,7 +18,10 @@ function cachePath() {
|
|
|
18
18
|
function readCache() {
|
|
19
19
|
try {
|
|
20
20
|
const data = JSON.parse(fs.readFileSync(cachePath(), "utf8"));
|
|
21
|
-
if (typeof data.apiUrl !== "string" ||
|
|
21
|
+
if (typeof data.apiUrl !== "string" ||
|
|
22
|
+
typeof data.checkedAt !== "string" ||
|
|
23
|
+
!Array.isArray(data.entries) ||
|
|
24
|
+
!Array.isArray(data.disabled)) {
|
|
22
25
|
return null;
|
|
23
26
|
}
|
|
24
27
|
return {
|
|
@@ -26,8 +29,7 @@ function readCache() {
|
|
|
26
29
|
etag: typeof data.etag === "string" ? data.etag : null,
|
|
27
30
|
checkedAt: data.checkedAt,
|
|
28
31
|
entries: data.entries,
|
|
29
|
-
|
|
30
|
-
disabled: Array.isArray(data.disabled) ? data.disabled : [],
|
|
32
|
+
disabled: data.disabled,
|
|
31
33
|
};
|
|
32
34
|
}
|
|
33
35
|
catch {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "getmyenv",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.1",
|
|
4
4
|
"description": "CLI for getmyenv, an encrypted store for environment variables and secrets. We store ciphertext only.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"access": "public"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@getmyenv/crypto": "0.6.
|
|
44
|
-
"@getmyenv/shared": "0.13.
|
|
43
|
+
"@getmyenv/crypto": "0.6.2",
|
|
44
|
+
"@getmyenv/shared": "0.13.1",
|
|
45
45
|
"@napi-rs/keyring": "^2.1.0",
|
|
46
46
|
"commander": "^15.0.0",
|
|
47
47
|
"dotenv": "^16.4.7",
|