Skip to content

fs

Enums

Functions

  • create_private_dir_all - Create path and all parents with mode 0700 on Unix (umask-independent).
  • write_private_file - Write contents to path with mode 0600 on Unix (owner read/write only, umask-independent).

firma_runtime_state::fs::CreatePrivateDirError

Section titled “firma_runtime_state::fs::CreatePrivateDirError”

Enum

Error returned by [create_private_dir_all].

Variants:

  • Create{ path: std::path::PathBuf, source: io::Error } - Directory creation failed.
  • Chmod{ path: std::path::PathBuf, source: io::Error } - Setting mode 0700 on an existing directory failed.

Trait Implementations:

  • Display
    • fn fmt(self: &Self, __formatter: & mut ::core::fmt::Formatter) -> ::core::fmt::Result
  • Error
    • fn source(self: &Self) -> ::core::option::Option<&dyn ::thiserror::__private18::Error>
  • Debug
    • fn fmt(self: &Self, f: & mut $crate::fmt::Formatter) -> $crate::fmt::Result

firma_runtime_state::fs::create_private_dir_all

Section titled “firma_runtime_state::fs::create_private_dir_all”

Function

Create path and all parents with mode 0700 on Unix (umask-independent). Also enforces 0700 on pre-existing directories. On Windows, falls back to create_dir_all without explicit mode.

Returns [CreatePrivateDirError::Create] if the directory cannot be created, or [CreatePrivateDirError::Chmod] if its permissions cannot be set to 0700.

fn create_private_dir_all(path: &std::path::Path) -> Result<(), CreatePrivateDirError>

firma_runtime_state::fs::write_private_file

Section titled “firma_runtime_state::fs::write_private_file”

Function

Write contents to path with mode 0600 on Unix (owner read/write only, umask-independent).

Uses O_CREAT | O_TRUNC so the mode is set atomically on creation with no write-then-chmod race. Falls back to [std::fs::write] on non-Unix platforms.

Returns an [io::Error] on any I/O failure.

fn write_private_file(path: &std::path::Path, contents: &[u8]) -> io::Result<()>