lsh-framework 2.2.2 → 2.2.3

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.
@@ -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.3",
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": {