nodio-cli 1.0.10 → 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.10",
3
+ "version": "1.0.12",
4
4
  "description": "Nodio distributed storage network",
5
5
  "main": "src/server/index.js",
6
6
  "type": "commonjs",
@@ -263,11 +263,13 @@ function buildRoutes(config) {
263
263
  });
264
264
  }
265
265
 
266
+ const relayTasks = await claimPendingRelayTasks(nodeId, 10);
267
+
266
268
  res.json({
267
269
  ok: true,
268
270
  now: new Date().toISOString(),
269
271
  replicationTasks: tasksWithSourceUrl,
270
- relayTasks: []
272
+ relayTasks
271
273
  });
272
274
  } catch (error) {
273
275
  next(error);
@@ -112,8 +112,8 @@ async function uploadFile(options) {
112
112
  if (!Number.isFinite(shardSizeMb) || shardSizeMb <= 0) {
113
113
  throw new Error('shard-size-mb must be greater than 0');
114
114
  }
115
- if (!Number.isInteger(replicas) || replicas < 5) {
116
- throw new Error('replicas must be an integer >= 5');
115
+ if (!Number.isInteger(replicas) || replicas < 1) {
116
+ throw new Error('replicas must be an integer >= 1');
117
117
  }
118
118
  if (!Number.isFinite(directTimeoutMs) || directTimeoutMs <= 0) {
119
119
  throw new Error('direct-timeout-ms must be greater than 0');
@@ -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);
package/src/user/index.js CHANGED
@@ -44,6 +44,11 @@ program
44
44
  });
45
45
 
46
46
  program.parseAsync(process.argv).catch((error) => {
47
- console.error('[nodio]', error.message);
47
+ const apiErrorMessage = error.response?.data?.error;
48
+ if (apiErrorMessage) {
49
+ console.error('[nodio]', apiErrorMessage);
50
+ } else {
51
+ console.error('[nodio]', error.message);
52
+ }
48
53
  process.exit(1);
49
54
  });