feat-presign-download
✨ New Features
Box and web download of Tower deposits
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
companyIdfromGET /documents/:id, not a separate/usercall
Files Modified:
src/protocol/files/files.service.ts— presign flow, one neo call, company matchsrc/protocol/files/files.controller.ts/files.module.ts— routesrc/protocol/files/bcyip-user.guard.ts— activation required, no/usersrc/protocol/bcyip/api.ts—fetchAccessibleDocumentsrc/protocol/storage/*— Head + sign per storage typesrc/protocol/utils/deposit-fields.ts— resolve download object keys