pub fn write_secret(dir: &Path, name: &str, value: &[u8]) -> Result<()>Expand description
Write a named secret to dir atomically (tempfile + rename).
Creates dir with mode 0700 if it does not exist. The resulting file has
mode 0600. Returns an error if the directory is not writable.
Uses NamedTempFile so the temporary file is automatically removed on any
failure path — no stale .{name}.tmp files are left on disk.