Skip to main content
Version: 3.2.0

Box and web download of Tower deposits

Version: 3.2.0 Date: 2026-11-17

Goal: IP MagicBox and the web app can download a file Tower stored, without copying storage secrets to BCYIP.

Solution: POST /api/v1/files/presign accepts the Box/web Bearer token, asks neo once for document access (and companyId), checks that company against Tower activation, Heads the object with Tower credentials, and returns a short-lived GET URL. A disposable web token is only used on that single neo call.

Features:

  • S3 signed GET after HeadObject
  • Azure blob URL from the stored SAS after exists()
  • GCS v4 signed GET after exists()
  • FTP returns 409 (no HTTP signed URL)

Implementation Details:

  • Object key from remotefiles.remote, storage-path, or reconstruction from the loaded source template
  • CORS is enabled so the web app can call Tower from the browser
  • Company check uses companyId from GET /documents/:id, not a separate /user call

Files Modified:

  • src/protocol/files/files.service.ts — presign flow, one neo call, company match
  • src/protocol/files/files.controller.ts / files.module.ts — route
  • src/protocol/files/bcyip-user.guard.ts — activation required, no /user
  • src/protocol/bcyip/api.ts — fetchAccessibleDocument
  • src/protocol/storage/* — Head + sign per storage type
  • src/protocol/utils/deposit-fields.ts — resolve download object keys

Release fragment: feat-presign-download