wealth/docs/decisions/0037-payout-receipts-throug...

1.0 KiB
Raw Permalink Blame History

0037 Payout receipts open through the creator's session, not signed URLs

Status: Proposed · Area: architecture · Date: 2026-10-08 · Decided by: agent

Context

C20 ۳.۷ opens a payout's receipt (an image in the lightbox, a PDF in a new tab) and downloads it "through a signed expiring URL". The API has no signed URLs; an admin uploads the receipt, so file-service's owner check would refuse the creator.

Decision

The API streams a receipt from GET /v1/payouts/me/payouts/:id/receipt after checking the payout is the creator's (?download=1 for an attachment). The browser loads it on its own origin through /api (0018), so the session cookie authorizes it; the repository maps each payout to receipt { url, downloadUrl, isImage }.

Alternatives

  • Signed expiring URLs: a signing secret and expiry handling in the gateway, for files that only their creator ever opens.

Consequences

A receipt link only works in a signed-in browser of that creator; nothing expires to regenerate (C20 ۳.۸'s "expired link" case cannot happen).