Skip to main content

encrypt_credentials_if_available

Function encrypt_credentials_if_available 

Source
pub fn encrypt_credentials_if_available(secrets_dir: Option<&Path>) -> bool
Expand description

Encrypt all secrets from secrets_dir into the systemd user credstore (~/.config/credstore.encrypted/).

Returns true if at least one credential was encrypted successfully and the generated service unit should include ImportCredential= directives. Returns false if systemd-creds is unavailable or no secrets were found.

Pass None for secrets_dir to use the default: the instance-namespaced ~/.config/hyprstream[/instances/{inst}]/credentials.

§Best-effort defense-in-depth (#808)

The plaintext 0600 files in secrets_dir remain the authoritative copy and are NOT deleted: per-service LoadCredential= sources and CLI tooling read them directly. The encrypted credstore is an additional TPM2/host-key-bound copy consumed via ImportCredential= — protection here is best-effort defense-in-depth, not the sole at-rest control.