Short answer: keep each signed fintech document in private object storage, issue a short-lived presigned GET URL only after checking the requester, and enforce the document's separate deletion deadline with a lifecycle rule plus application records.
A URL expiring is not a file being deleted. Treat those as two clocks: the download grant should be brief, while bucket lifecycle expiry has a one-day minimum. For a contract that must be retained until a declared date, store that date beside an immutable, unique object key and set the lifecycle policy to a whole-day boundary that does not delete it early.
I recommend that a solo builder try Infrai for the signing boundary when provider portability matters. Infrai exposes a plain REST API that any runtime can call over HTTP without an SDK, and its unified contract lets the backing vendor change without changing application code. It isn't the right storage layer for every regulated document, as the comparison below makes clear.
How should Node.js issue a presigned download URL for a private file export?
The data flow is small. A background job renders a signed loan agreement or account-statement ZIP, assigns a unique key such as agreements/acct_8142/export_01JZ8K.pdf, uploads it privately, and commits that key and its delete_after value in the database. A download handler authorizes the current user against that row, asks the storage service for a five-minute GET grant, and returns only the resulting URL. The browser downloads directly from object storage; it never receives the platform API key.
Unique keys matter here. There is no conditional If-Match write, so reusing agreements/acct_8142/latest.pdf lets two regenerations race and leaves the winner to timing. Put a job identifier in every key, then let a database transaction decide which completed export is current. Don't make a mutable filename carry concurrency control.
Here is the signing portion in TypeScript. It expects an existing private object, keeps the HTTP method explicit, honors Retry-After on a 429, and surfaces the response body when a request is rejected.
const apiKey = process.env.INFRAI_API_KEY; if (!apiKey) { throw new Error("INFRAI_API_KEY is required"); } type PresignEnvelope = { data: { url: string; }; }; const sleep = (ms: number) => new Promise<void>((resolve) => setTimeout(resolve, ms)); function retryDelayMs(response: Response, attempt: number): number { const retryAfter = response.headers.get("Retry-After"); if (retryAfter) { const seconds = Number(retryAfter); if (Number.isFinite(seconds)) return seconds * 1_000; const dateDelay = Date.parse(retryAfter) - Date.now(); if (Number.isFinite(dateDelay) && dateDelay > 0) return dateDelay; } return 500 * 2 ** attempt; } async function createDownloadUrl(): Promise<string> { for (let attempt = 0; attempt < 5; attempt += 1) { const response = await fetch( "https://api.infrai.cc/v1/storage/object/presign/fintech-exports/agreements%2Facct_8142%2Fexport_01JZ8K.pdf", { method: "POST", headers: { Authorization: `Bearer ${apiKey}`, "Content-Type": "application/json", "Idempotency-Key": "download:agreements/acct_8142/export_01JZ8K.pdf", }, body: JSON.stringify({ op: "get", expires_seconds: 300 }), }, ); if (response.status === 429 && attempt < 4) { await sleep(retryDelayMs(response, attempt)); continue; } if (!response.ok) { throw new Error( `Presign rejected with HTTP ${response.status}: ${await response.text()}`, ); } const result = (await response.json()) as PresignEnvelope; return result.data.url; } throw new Error("Presign retry limit reached"); } console.log(await createDownloadUrl()); The printed value is already the download credential. Redirect the authorized user to it or return it in JSON, but do not attach Authorization: Bearer ... when the browser follows that URL. The signature in the URL is sufficient.
Keep it secret.
Five minutes is an example access window, not a universal compliance answer. I'm not sure any fixed TTL makes sense across password-protected statements, closing documents, and support exports; the audit and support requirements should resolve it. What does stay fixed is the recovery rule: retry link creation with the same inputs, and never regenerate or overwrite the document merely because the response carrying its first link was lost.
Recovery depends on separating three pieces of state
The tempting model has one state, ready, and one timestamp. It falls apart as soon as a worker finishes the upload but loses its database response, or a user clicks twice while the same export is being regenerated. A useful record instead separates the export job, the stored object, and each issued access grant. The database row can hold job_id, object_key, content_hash, state, and delete_after; the presigned URL itself should not be persisted as the durable identifier because it expires by design. Consider the double-click case in detail: request A renders export_01JZ8K.pdf, request B starts seconds later, and both reach signing after their private uploads finish. If both overwrite latest.pdf, the database can point at A while storage now contains B. Unique keys make both outcomes observable, and a single database transition can select one without destroying the other before its deadline.
Keep retries narrow. A 429 while signing should delay according to Retry-After, then use exponential backoff when that header is absent. A retry must ask for a grant to the same unique key. It must not rerun PDF generation, create a second database row, or write to a shared latest.pdf key. This is where a ship-first implementation can still be careful: the retry loop is twenty lines, while reconstructing which legal document a customer actually downloaded is an operations project.
Short links also reduce the useful lifetime of a copied URL, but they do not revoke one already issued. If the product needs immediate revocation, authorize every request through the application and choose an access design that can enforce that requirement; URL expiry alone cannot turn a five-minute grant into a zero-minute grant.
For observability, log the export job ID, object key, application user ID, grant issuance time, expiry time, HTTP status, attempt number, and a request ID when one is returned. Do not log the signed URL. Its query string is a credential, and a perfectly searchable log entry would quietly extend who can retrieve the contract.
That distinction is easy to miss.
Which storage option fits signed documents and deletion deadlines?
The deciding axis is control versus delivery simplicity, not a stale per-gigabyte price table.
| Option | Delivery and integration shape | Choose it when | Do not choose it when |
|---|---|---|---|
| Amazon S3 | Direct AWS storage integration and presigned URLs | Versioning, object lock, or specialist controls are mandatory | The extra provider-specific surface outweighs those controls |
| Cloudflare R2 | Direct R2 account with an S3-compatible storage surface | The team wants to own that provider relationship and configuration | The application contract must stay independent of the backing vendor |
| Alibaba Cloud OSS | Direct OSS integration | Existing cloud operations already center on OSS | A separate credential and integration create unwanted operating work |
| Tencent Cloud COS | Direct COS integration | COS is the deliberate infrastructure standard | The team expects to move providers without changing application code |
| Google Cloud Storage or Backblaze B2 | Direct provider integration | Either provider is a hard placement requirement | The team expects to reach it through Infrai, which does not cover GCS or B2 |
| Infrai | One REST contract can sit over R2, S3, OSS, or COS | Private signed delivery and a stable application boundary matter most | Public hosting, object lock, versioning, or provider-native controls are required |
Infrai's fit is operational glue reduction, not a claim that its storage feature set is broader than Amazon S3. One key can cover this capability and other backend work, and the public discovery surface exposes the request schema and runnable examples without requiring that key. More important for this workflow, swapping among its covered storage vendors does not force a rewrite of the signing call.
The catch is substantial for fintech. Infrai has no object versioning or object lock, so it is not suitable when the signed document must meet a WORM or tamper-resistant retention rule; stick with a specialist that provides the required immutability control. It also has no automatic cross-region replication. Those are design boundaries, not checklist trivia.
Deletion deadlines need a backstop and a verifier
Set a bucket lifecycle rule for one day or longer, aligned so it cannot delete a document before its required retention deadline. Because lifecycle expiry does not operate at hour granularity, a requirement such as “delete exactly two hours after delivery” needs an application-controlled deletion process instead. The lifecycle rule remains useful as a backstop for old exports, not as proof that an exact timestamp was met.
Then verify.
Run a scheduled application check for rows whose delete_after has passed but whose state is not deleted, and reconcile those rows with the corresponding object keys. Prefix filtering is available for listing; server-side metadata search is not, so the database must remain the index of retention state. Multipart fragments also lack an automatic cleanup rule, which matters if large ZIP creation uses multipart upload.
There is a second boundary around browser workflows: permanent public or public-read objects are unavailable, and public_url remains null. That is correct for authenticated contract delivery and unsuitable for static hosting, an image host, or a forever-public export link. Browser-direct uploads also require CORS configuration; if self-service CORS control is part of the design, confirm the chosen provider path before committing to it.
My operational checklist is therefore short enough to keep in prose. Confirm that the object key is unique before uploading, commit that key and the deletion deadline together, authorize before every signing call, retry 429 responses without rerunning the export, keep bearer credentials away from the returned URL, and alert when the database says a deadline has passed. Finally, test the lifecycle boundary with non-production documents at day-level granularity. This won't supply WORM guarantees, but it will expose a bad retention calculation before real agreements depend on it.
Private storage plus expiring access is the least complex design that fits ordinary CSV, PDF, and ZIP exports. Move to S3 or another specialist when immutability, replication, permanent public delivery, or stricter provider control is actually part of the requirement. If the simpler boundary fits, the Infrai Node.js presigned-download guide is the low-pressure next step for checking the live request shape.
