pub fn redact_secrets(text: &str) -> StringExpand description
Mask credential-shaped substrings in text.
Recognizes:
Authorization: <scheme> <token>and bareBearer <token>x-api-key: <value>- OpenAI-style
sk-…keys (20+ word characters after the prefix) - JSON fields named
apiKey/api_key/apikeywith a string value
Returns the text with each matched secret replaced by [REDACTED], leaving
the surrounding key or scheme intact so the structure stays readable.