squidcloudctl 3.0.6 → 3.0.7

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.
@@ -358,6 +358,26 @@ export async function downloadFile(target, destPath, onProgress) {
358
358
  const msg = e instanceof Error ? e.message : String(e);
359
359
  if (msg.startsWith('VAULT_KEY_DRIFT'))
360
360
  throw e;
361
+ if (msg.startsWith('WEB_SESSION_REQUIRED')) {
362
+ // No fresh web JWT — fall back to signed-mode + vault key (no JWT needed).
363
+ try {
364
+ const key0 = defaultKey || tagsKey || '';
365
+ const usable = key0 && !/^(managed_key|sha256:.*|byok_encrypted|byok_protected)$/.test(key0);
366
+ const vaultKey = usable ? key0 : await fetchVaultKey(target.id);
367
+ if (!vaultKey && !usable && encrypted)
368
+ throw new Error(msg);
369
+ const sres = await apiRaw(`/download/${target.id}?signed=true`);
370
+ if (!sres.ok)
371
+ throw new Error(`signed HTTP ${sres.status}`);
372
+ const smeta = (await sres.json());
373
+ if (!smeta?.success || !smeta.signed_urls?.length)
374
+ throw new Error('signed: empty');
375
+ return await fetchDecryptWrite(smeta.signed_urls, target, destPath, onProgress, vaultKey ?? undefined, chunks.length);
376
+ }
377
+ catch (e2) {
378
+ errors.push(`signed: ${e2 instanceof Error ? e2.message : String(e2)}`);
379
+ }
380
+ }
361
381
  errors.push(`cluster: ${msg}`);
362
382
  }
363
383
  }
@@ -380,7 +400,7 @@ async function resolveKey(fileId, tagsKey) {
380
400
  return tagsKey;
381
401
  return fetchVaultKey(fileId);
382
402
  }
383
- async function fetchDecryptWrite(urls, target, destPath, onProgress) {
403
+ async function fetchDecryptWrite(urls, target, destPath, onProgress, preKey, declaredChunks) {
384
404
  const totalChunks = urls.length;
385
405
  const finalPath = destPath || target.name;
386
406
  const out = fs.createWriteStream(finalPath);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "squidcloudctl",
3
- "version": "3.0.6",
3
+ "version": "3.0.7",
4
4
  "description": "SquidCloud CLI (squidcloudctl) — encrypted storage, shares and secrets from your terminal",
5
5
  "main": "dist/bin/squidcloud.js",
6
6
  "bin": {