@envsave/cli 1.0.44 → 1.0.45
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 +11 -0
- package/dist/cli.js +47 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -161,6 +161,17 @@ envsave list
|
|
|
161
161
|
# Delete a secret (password required)
|
|
162
162
|
envsave delete OPENAI_API_KEY
|
|
163
163
|
|
|
164
|
+
# Rename a secret (password required)
|
|
165
|
+
# Creates a new opaque key derived from the new name, copies the value over,
|
|
166
|
+
# and deletes the old opaque key. The output prints OLD → NEW for easy
|
|
167
|
+
# search-and-replace in your code.
|
|
168
|
+
envsave rename CLERK_SECRET_KEY_THEHOTELAGENTS CLERK_SECRET_KEY_DIRECTBOOKAI
|
|
169
|
+
# Output:
|
|
170
|
+
# Renamed: CLERK_SECRET_KEY_THEHOTELAGENTS → CLERK_SECRET_KEY_DIRECTBOOKAI
|
|
171
|
+
# Replace in your code:
|
|
172
|
+
# OLD (deleted): es_7cXxcbsVaJQv...
|
|
173
|
+
# NEW (created): es_enLaxEjzTO5r...
|
|
174
|
+
|
|
164
175
|
# Bulk import from .env file (password required)
|
|
165
176
|
envsave import .env
|
|
166
177
|
|
package/dist/cli.js
CHANGED
|
@@ -100,6 +100,7 @@ __export(exports_vault, {
|
|
|
100
100
|
searchKeys: () => searchKeys,
|
|
101
101
|
revealKeysByPattern: () => revealKeysByPattern,
|
|
102
102
|
revealKey: () => revealKey,
|
|
103
|
+
renameSecret: () => renameSecret,
|
|
103
104
|
listKeys: () => listKeys,
|
|
104
105
|
initVault: () => initVault,
|
|
105
106
|
importEnv: () => importEnv,
|
|
@@ -446,6 +447,28 @@ function deleteSecret(key, password) {
|
|
|
446
447
|
writeSessionCache(vault.secrets, vault.registry);
|
|
447
448
|
return true;
|
|
448
449
|
}
|
|
450
|
+
function renameSecret(oldName, newName, password) {
|
|
451
|
+
if (oldName === newName) {
|
|
452
|
+
throw new Error("Old and new names are the same.");
|
|
453
|
+
}
|
|
454
|
+
const vault = readMainVault(password);
|
|
455
|
+
const sshKeyContent = loadSshKey(vault);
|
|
456
|
+
const oldOpaque = computeOpaqueName(vault.hmacSeed, oldName, sshKeyContent);
|
|
457
|
+
if (!vault.registry.includes(oldName) || !(oldOpaque in vault.secrets)) {
|
|
458
|
+
throw new Error(`Secret '${oldName}' not found.`);
|
|
459
|
+
}
|
|
460
|
+
if (vault.registry.includes(newName)) {
|
|
461
|
+
throw new Error(`Secret '${newName}' already exists.`);
|
|
462
|
+
}
|
|
463
|
+
const newOpaque = computeOpaqueName(vault.hmacSeed, newName, sshKeyContent);
|
|
464
|
+
const value = vault.secrets[oldOpaque];
|
|
465
|
+
vault.secrets[newOpaque] = value;
|
|
466
|
+
delete vault.secrets[oldOpaque];
|
|
467
|
+
vault.registry = vault.registry.map((k) => k === oldName ? newName : k);
|
|
468
|
+
writeMainVault(vault, password);
|
|
469
|
+
writeSessionCache(vault.secrets, vault.registry);
|
|
470
|
+
return { oldOpaque, newOpaque };
|
|
471
|
+
}
|
|
449
472
|
function listKeys(password) {
|
|
450
473
|
const vault = readMainVault(password);
|
|
451
474
|
writeSessionCache(vault.secrets, vault.registry);
|
|
@@ -836,7 +859,7 @@ async function checkLicense() {
|
|
|
836
859
|
// package.json
|
|
837
860
|
var package_default = {
|
|
838
861
|
name: "@envsave/cli",
|
|
839
|
-
version: "1.0.
|
|
862
|
+
version: "1.0.45",
|
|
840
863
|
description: "Local secret vault for LLM-safe environments — encrypted secrets that agents can't bulk-discover",
|
|
841
864
|
type: "module",
|
|
842
865
|
main: "dist/index.js",
|
|
@@ -922,6 +945,7 @@ Usage:
|
|
|
922
945
|
envsave show <key> Show real value by key name (password required)
|
|
923
946
|
envsave reveal <keyword> [keyword2]... Show opaque key(s) for any name matching keyword (password required)
|
|
924
947
|
envsave delete <key> Remove a secret (password required)
|
|
948
|
+
envsave rename <old> <new> Rename a secret (creates new opaque key, deletes old) (password required)
|
|
925
949
|
envsave search <keyword> Search keys matching keyword (no password)
|
|
926
950
|
envsave scan [dir] Scan project for env variable usage
|
|
927
951
|
envsave passwd Change master password
|
|
@@ -1168,6 +1192,28 @@ Use 'envsave reveal <KEY>' to get the opaque key for each secret.`);
|
|
|
1168
1192
|
}
|
|
1169
1193
|
break;
|
|
1170
1194
|
}
|
|
1195
|
+
case "rename": {
|
|
1196
|
+
const oldName = args[1];
|
|
1197
|
+
const newName = args[2];
|
|
1198
|
+
if (!oldName || !newName) {
|
|
1199
|
+
console.error("Usage: envsave rename <old> <new>");
|
|
1200
|
+
process.exit(1);
|
|
1201
|
+
}
|
|
1202
|
+
const password = await requirePassword();
|
|
1203
|
+
const { oldOpaque, newOpaque } = renameSecret(oldName, newName, password);
|
|
1204
|
+
console.log(`
|
|
1205
|
+
Renamed: ${oldName} → ${newName}`);
|
|
1206
|
+
console.log(`
|
|
1207
|
+
Replace in your code:`);
|
|
1208
|
+
console.log(` OLD (deleted): ${oldOpaque}`);
|
|
1209
|
+
console.log(` NEW (created): ${newOpaque}`);
|
|
1210
|
+
console.log(`
|
|
1211
|
+
Or replace the full call:`);
|
|
1212
|
+
console.log(` envsave.get("${oldOpaque}")`);
|
|
1213
|
+
console.log(` envsave.get("${newOpaque}")
|
|
1214
|
+
`);
|
|
1215
|
+
break;
|
|
1216
|
+
}
|
|
1171
1217
|
case "config": {
|
|
1172
1218
|
const maxGets = getFlag("--max-gets");
|
|
1173
1219
|
if (!maxGets) {
|