Files
metacrypt/internal
Kyle Isom 4469c650cc Cache issued tgz in memory for one-time download
Instead of streaming the tgz directly to the response (which was
fragile under server write timeouts), handleIssueCert now:
- Builds the tgz into a bytes.Buffer
- Stores it in a sync.Map (tgzCache) under a random 16-byte hex token
- Redirects the browser to /pki/download/{token}

handleTGZDownload serves the cached bytes via LoadAndDelete, so the
archive is removed from memory after the first (and only) download.
An unknown or already-used token returns 404.

Also adds TestHandleTGZDownload covering the one-time-use and
not-found cases, and wires issueCertFn into mockVault.

Co-authored-by: Junie <junie@jetbrains.com>
2026-03-15 13:44:32 -07:00
..
2026-03-15 10:36:35 -07:00
2026-03-15 10:36:35 -07:00
2026-03-15 13:07:42 -07:00
2026-03-15 10:36:35 -07:00
2026-03-15 10:36:35 -07:00
2026-03-15 10:36:35 -07:00