pub fn load_passphrase_from_secrets_file(
secret_handling: NonAdministrativeSecretHandling,
system_user: &User,
backend_user: &str,
) -> Result<Passphrase, Error>Expand description
Reads a secret from a secret file location of a user and returns it as a Passphrase.
The secret file location is established based on the chosen secret_handling, system_user and
backend_user.
§Notes
This function must be called using an unprivileged user, as the path is assumed to be in that
user’s home directory.
If systemd-creds(1) based encryption is used, then the same user used to encrypt the secret
must be used to decrypt the secret.
§Errors
Returns an error if
- the effective user ID of the calling user is that of root,
- the secret is a plaintext file, but reading it as a string fails,
- the secret is encrypted using systemd-creds(1), but
- systemd-creds(1) cannot be found,
- or the systemd-creds(1) command fails to execute,
- or the systemd-creds(1) command returned with a non-zero exit code,
- or the returned output cannot be converted into valid UTF-8 string