Masking
Overview
The Masking service handles sensitive data masking for display — primarily phone numbers and email addresses. It ensures that private contact information is never fully exposed in the UI.
Phone Masking
Automatically detects the country code from the phone number and masks the middle digits:
Input: +6281234567890
Output: +62 812-****-7890
Input: 081234567890
Output: 0812-****-7890Email Masking
Preserves the first and last character of the local part while masking the middle:
Input: johndoe@example.com
Output: j*****e@example.comKey Methods
| Method | Description |
|---|---|
maskPhone(value) | Mask phone number — detects country code, preserves prefix and last 4 digits |
maskEmail(value) | Mask email — preserves first and last char of local part |
Key Files
app/Services/Common/MaskingService.php