@@ -41,5 +41,38 @@ fn main() {
4141}
4242```
4343
44+ ## Configuration
45+
46+ The ` Masker ` struct uses the ** Builder Pattern** . You can chain methods to configure which PII types to detect and how to mask them.
47+
48+ By default, ` Masker::new() ` performs ** no masking** (pass-through). You must explicitly enable the filters you need.
49+
50+ ### Builder Methods
51+
52+ | Method | Description | Default |
53+ | --- | --- | --- |
54+ | ` mask_emails() ` | Enables detection and masking of email addresses. | ` Disabled ` |
55+ | ` mask_phones() ` | Enables detection and masking of global phone numbers. | ` Disabled ` |
56+ | ` with_mask_char(char) ` | Sets the character used for masking (e.g., ` '*' ` , ` '#' ` , ` 'x' ` ). | ` '*' ` |
57+
58+ ### Masking Logic Details
59+
60+ Understanding how data is masked is crucial for security and usability.
61+
62+ * ** 📧 Emails**
63+ * ** Pattern:** Detects standard email formats.
64+ * ** Behavior:** Keeps the ** first character** of the local part and the domain. Masks the rest of the local part.
65+ * ** Example:** ` alice@example.com ` -> ` a****@example.com `
66+ * ** Short Emails:** If the local part is 1 character, it is fully masked (e.g., ` a@b.com ` -> ` *@b.com ` ).
67+
68+
69+ * ** 📞 Phones (Global Support)**
70+ * ** Pattern:** Detects sequences of digits that look like phone numbers (supports International ` +81... ` , US ` (555)... ` , and Hyphenated ` 090-... ` ).
71+ * ** Behavior:** Preserves formatting (hyphens, spaces, parentheses) and the ** last 4 digits** . All other digits are replaced.
72+ * ** Example:**
73+ * ` 090-1234-5678 ` -> ` 090-****-5678 `
74+ * ` +1 (800) 123-4567 ` -> ` +1 (***) ***-4567 `
75+ * ` 12345 ` -> ` *2345 ` (Short numbers)
76+
4477## Developer
4578This library is developed by [ Finite Field, K.K.] ( https://finitefield.org ) .
0 commit comments