pub fn load_secrets_auto(
data: &[u8],
password: Option<&str>,
format: Option<SecretsFormat>,
force_plaintext: bool,
) -> Result<(PatternCompileResult, bool)>Expand description
Unified loader: auto-detect encrypted vs plaintext and load secret patterns accordingly.
When force_plaintext is true, decryption is skipped regardless
of file content. When false, the function uses looks_encrypted
to choose the path automatically.
§Arguments
data— raw bytes read from the secrets file.password— password for decryption (ignored when plaintext).format— optional format override.force_plaintext— iftrue, always treat as plaintext.
§Returns
(patterns, warnings, was_encrypted) — the compiled patterns,
any compile warnings, and a flag indicating which path was taken.
§Errors
Returns [SanitizeError::SecretsError] if decryption or parsing
fails, or if a password is required but not provided.