Credential Validator
Component Detail
Description
Pure validation service containing rules for email format and password constraints. Returns structured validation results consumed by the BLoC to produce field-level error messages without side effects.
credential-validator
Summaries
The Credential Validator ensures users encounter clear, immediate feedback when entering login information incorrectly, reducing frustration and support tickets related to login failures. By enforcing consistent email and password rules at the point of entry, the business reduces failed authentication attempts, lowers the load on backend authentication infrastructure, and improves conversion rates on login and registration flows. A smoother onboarding experience directly correlates with user retention and reduces churn caused by friction during first-time account access.
The Credential Validator is a self-contained, low-complexity component with zero external dependencies, making it one of the lowest-risk deliverables in the mobile authentication feature set. It can be developed and unit tested in isolation before any backend or BLoC integration is ready, enabling parallel workstreams. Testing coverage is straightforward: input/output validation with clearly defined acceptance criteria per field rule. No deployment infrastructure is required.
The main scheduling consideration is coordinating its completion before the authentication BLoC integration begins, as the BLoC consumes its output for field-level error display.
Credential Validator is a pure, stateless service with no dependencies or side effects, making it trivially testable and deterministic. It exposes three methods: validateEmail() checks RFC 5322 format compliance, validatePassword() enforces minimum length and non-empty constraints, and validateAll() batches both validations and returns a List
Localization of error messages, if required, should be injected rather than hardcoded to keep this component side-effect free and testable.
Responsibilities
- Validate email format against RFC 5322 pattern
- Validate password minimum length and non-empty constraints
- Return structured validation result objects with field and message
Interfaces
validateEmail(String email) ValidationResult
validatePassword(String password) ValidationResult
validateAll(String email, String password) List<ValidationResult>