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

20 lines
1.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 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).