@envsave/cli 1.0.38 → 1.0.39

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.
Files changed (2) hide show
  1. package/dist/cli.js +6 -5
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -514,7 +514,7 @@ function initVault(password, options) {
514
514
  const hmacSeed = randomBytes2(32).toString("hex");
515
515
  const sshKeyContent = options?.sshKeyPath ? readFileSync3(options.sshKeyPath, "utf8") : undefined;
516
516
  const vault = {
517
- version: 4,
517
+ version: 5,
518
518
  hmacSeed,
519
519
  sshKeyPath: options?.sshKeyPath,
520
520
  secrets: {},
@@ -544,7 +544,8 @@ function setSecret(key, value, password) {
544
544
  const vault = readMainVault(password);
545
545
  const sshKeyContent = loadSshKey(vault);
546
546
  const opaque = computeOpaqueName(vault.hmacSeed, key, sshKeyContent);
547
- if (!(opaque in vault.secrets) && !hasValidLicense()) {
547
+ const updated = opaque in vault.secrets;
548
+ if (!updated && !hasValidLicense()) {
548
549
  if (vault.registry.length >= FREE_TIER_MAX_SECRETS) {
549
550
  throw new Error(`Free tier limit: max ${FREE_TIER_MAX_SECRETS} secrets. Run 'envsave activate <token>' to unlock unlimited secrets.
550
551
  Get your license at https://api.envsave.com`);
@@ -556,7 +557,7 @@ Get your license at https://api.envsave.com`);
556
557
  }
557
558
  writeMainVault(vault, password);
558
559
  writeSessionCache(vault.secrets, vault.registry);
559
- return opaque;
560
+ return { opaque, updated };
560
561
  }
561
562
  function showSecret(cleanName, password) {
562
563
  const vault = readMainVault(password);
@@ -1041,9 +1042,9 @@ Use 'envsave reveal <KEY>' to get the opaque key for each secret.`);
1041
1042
  process.exit(1);
1042
1043
  }
1043
1044
  const password = await requirePassword();
1044
- const opaque = setSecret(key, value, password);
1045
+ const { opaque, updated } = setSecret(key, value, password);
1045
1046
  console.log(`
1046
- ${key} → ${opaque}
1047
+ ${updated ? "Updated" : "Added"}: ${key} → ${opaque}
1047
1048
  `);
1048
1049
  console.log(` Use this in your code to access ${key}:`);
1049
1050
  console.log(` envsave.get("${opaque}")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@envsave/cli",
3
- "version": "1.0.38",
3
+ "version": "1.0.39",
4
4
  "description": "Local secret vault for LLM-safe environments — encrypted secrets that agents can't bulk-discover",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",