nodio-cli 1.0.11 → 1.0.12

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodio-cli",
3
- "version": "1.0.11",
3
+ "version": "1.0.12",
4
4
  "description": "Nodio distributed storage network",
5
5
  "main": "src/server/index.js",
6
6
  "type": "commonjs",
@@ -340,8 +340,17 @@ async function downloadFile(options) {
340
340
  throw new Error(`failed to fetch valid replica for shard ${shard.shardId}`);
341
341
  }
342
342
 
343
- const plain = decryptAes256Gcm(encryptedBuffer, keyBuffer, shardMeta.iv, shardMeta.authTag);
344
- plainParts.push(plain);
343
+ try {
344
+ const plain = decryptAes256Gcm(encryptedBuffer, keyBuffer, shardMeta.iv, shardMeta.authTag);
345
+ plainParts.push(plain);
346
+ } catch (error) {
347
+ if (String(error.message || '').includes('unsupported state or unable to authenticate data')) {
348
+ throw new Error(
349
+ `decryption failed for shard ${shard.shardId}: key is incorrect or metadata/key mismatch (double-check key-base64 copy)`
350
+ );
351
+ }
352
+ throw error;
353
+ }
345
354
  }
346
355
 
347
356
  const reconstructed = Buffer.concat(plainParts);