pub fn redact_secrets<'a, S: AsRef<str>>(
text: &'a str,
secrets: &[S],
) -> Cow<'a, str>Expand description
Replace every occurrence of each of secrets in text with SECRET_MASK.
Longer secrets are replaced first, so a secret that contains another one is
masked as a whole. Values shorter than MIN_SCRUB_LEN are ignored.
use graphrt_core::redact::redact_secrets;
let message = redact_secrets("invalid key sk-live-1234 for org", &["sk-live-1234"]);
assert_eq!(message, "invalid key ****** for org");