Skip to main content

Crate maskprompt_core

Crate maskprompt_core 

Source
Expand description

Pure-Rust core for maskprompt. Detects common PII patterns plus caller-supplied keywords and replaces them via one of four strategies.

  • Built-in rules. A small fixed set of regex patterns. Credit-card matches are validated through Luhn before redaction so unrelated 13–19 digit strings (order numbers, etc.) are not flagged.
  • Custom keywords. An Aho-Corasick automaton over the union of all user-supplied needles, so a list with thousands of entries (customer names, internal project codes) still matches in linear time.
  • Strategies. Tag, Hash, Fixed, Remove. The Hash strategy uses blake3 truncated to 8 hex chars to give stable cross-run redaction without recovering the source.

Match resolution: when two rules overlap, the one that started earlier wins; ties go to the longer match.

Structs§

MaskMatch
One match found by Masker::mask.
MaskResult
Output of Masker::mask.
Masker
Compiled detector set. Build with Masker::builder.
MaskerBuilder
Builder for Masker.

Enums§

BuiltinRule
Built-in detector identifiers.
MaskerError
All errors surfaced by maskprompt-core.
Strategy
How matches are replaced in the masked string.

Type Aliases§

Result
Crate-wide result alias.