pub fn load_secrets_auto(
data: &[u8],
password: Option<&str>,
format: Option<SecretsFormat>,
force_plaintext: bool,
) -> Result<((PatternCompileResult, Vec<String>), 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 a secrets-related SanitizeError if decryption or parsing
fails, or if a password is required but not provided.
Returns ((patterns, warnings, allow_patterns), was_encrypted).
allow_patterns are the raw strings from kind: allow entries in the
secrets file — the caller should combine these with any --allow CLI
values and pass the merged list to AllowlistMatcher::new.