lsh-framework 2.2.2 → 2.2.4

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.
@@ -661,7 +661,7 @@ LSH_SECRETS_KEY=${this.encryptionKey}
661
661
  out('⬇️ Cloud secrets available but no local file');
662
662
  if (autoExecute) {
663
663
  out(' Pulling from cloud...');
664
- await this.pull(envFilePath, effectiveEnv, false);
664
+ await this.pull(envFilePath, environment, false); // Use raw environment, not effectiveEnv
665
665
  out('✅ Secrets pulled from cloud!');
666
666
  }
667
667
  else {
@@ -712,7 +712,7 @@ LSH_SECRETS_KEY=${this.encryptionKey}
712
712
  out(` Cloud: ${status.cloudModified.toLocaleString()}`);
713
713
  if (autoExecute) {
714
714
  out(' Pulling from cloud (backup created)...');
715
- await this.pull(envFilePath, effectiveEnv, false);
715
+ await this.pull(envFilePath, environment, false); // Use raw environment, not effectiveEnv
716
716
  out('✅ Secrets synced from cloud!');
717
717
  }
718
718
  else {
@@ -282,7 +282,8 @@ export class StorachaClient {
282
282
  cursor: '',
283
283
  size: pageSize,
284
284
  });
285
- // Check recent uploads for registry file
285
+ // Collect all registry files for this repo
286
+ const registries = [];
286
287
  for (const upload of results.results) {
287
288
  try {
288
289
  const cid = upload.root.toString();
@@ -297,9 +298,12 @@ export class StorachaClient {
297
298
  // Try to parse as JSON
298
299
  const json = JSON.parse(content.toString('utf-8'));
299
300
  // Check if it's an LSH registry file for our repo
300
- if (json.repoName === repoName && json.version && json.cid) {
301
- logger.debug(`✅ Found latest CID for ${repoName}: ${json.cid}`);
302
- return json.cid;
301
+ if (json.repoName === repoName && json.version && json.cid && json.timestamp) {
302
+ registries.push({
303
+ cid: cid,
304
+ timestamp: json.timestamp,
305
+ secretsCid: json.cid,
306
+ });
303
307
  }
304
308
  }
305
309
  catch {
@@ -307,6 +311,13 @@ export class StorachaClient {
307
311
  continue;
308
312
  }
309
313
  }
314
+ // Sort by timestamp (newest first) and return the most recent secrets CID
315
+ if (registries.length > 0) {
316
+ registries.sort((a, b) => new Date(b.timestamp).getTime() - new Date(a.timestamp).getTime());
317
+ const latest = registries[0];
318
+ logger.debug(`✅ Found latest CID for ${repoName}: ${latest.secretsCid} (timestamp: ${latest.timestamp})`);
319
+ return latest.secretsCid;
320
+ }
310
321
  // No registry found
311
322
  return null;
312
323
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lsh-framework",
3
- "version": "2.2.2",
3
+ "version": "2.2.4",
4
4
  "description": "Simple, cross-platform encrypted secrets manager with automatic sync, IPFS audit logs, and multi-environment support. Just run lsh sync and start managing your secrets.",
5
5
  "main": "dist/app.js",
6
6
  "bin": {