Skip to main content

account_dir

Function account_dir 

Source
pub fn account_dir(npub: &str) -> Result<PathBuf, String>
Expand description

Single source of truth for per-account directories. Every per-account subsystem (DB, Tor state) resolves its path through this; compose further subpaths with .join(...) — never insert layers between <app_data> and <npub>.

Validates npub format before joining as defence-in-depth against path traversal: a crafted IPC input like "../../etc" would otherwise yield <app_data>/../../etc and downstream remove_dir_all (delete_account, logout) would walk arbitrary dirs.