Create a new SecretScrubber.
Additional keys to consider sensitive
Check if a key is sensitive.
Delegates to the shared utility for base sensitive keys (including blocklist logic). Additional keys provided at construction are checked separately — they bypass the blocklist since they are explicitly declared as sensitive by the consumer.
The key to check
true if the key matches a sensitive pattern
Scrub secrets from a text string.
Handles:
The text to scrub
The scrubbed text
Recursively scrub sensitive keys from an object.
Also scrubs string values that may contain embedded secrets (e.g., "password=secret123" patterns).
The object to scrub
A new object with sensitive values redacted
Secret Scrubber class for detecting and redacting sensitive information.
Usage:
const scrubber = new SecretScrubber();scrubber.scrub('token=secret123')returns'token=**********'scrubber.scrubObject({ password: 'secret' })returns{ password: '**********' }