Add Technical_Decomp_Cache

Miguel Jacq 2025-12-27 20:35:53 -06:00
parent 9a6ba651c5
commit b900873405

25
Technical_Decomp_Cache.md Normal file

@ -0,0 +1,25 @@
## enroll/cache.py
### HarvestCache (frozen dataclass)
Purpose: a small wrapper around a directory path representing a locally stored harvest bundle.
#### Field:
dir: Path: the bundle directory.
#### Property:
state_json -> Path: returns dir / "state.json".
#### Lifecycle / where its used:
Created by `new_harvest_cache_dir(hint=...)` when the CLI wants a safe default output location (especially for SOPS encrypted outputs).
Its a "typed return value" so callers dont pass raw strings around.
#### Security behavior around it:
`new_harvest_cache_dir()` builds a directory under `~/.local/cache/enroll/harvest` (or `$XDG_CACHE_HOME/enroll/harvest`).
Uses mkdtemp() to avoid predictable paths and forces 0700 permissions (best-effort).