Package com.bank.auth_service.service
Interface VerificationCodeService
- All Known Implementing Classes:
VerificationCodeServiceImpl
public interface VerificationCodeService
Service interface for handling verification code operations.
Provides methods to generate and validate temporary verification codes.
Actually used for sensitive actions such as confim payments or password resets.
- Since:
- 1.0.0
- Version:
- 1.0.0, 06/23/2025
- Author:
- Fernando Cruz Cavina
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiongenerateCode
(String key) Generates a 6-digit numeric verification code tied to a unique key.validateCode
(ConfirmCodeDto confirmCode) Validates a verification code by checking its existence, expiration, and correctness.
-
Method Details
-
generateCode
Generates a 6-digit numeric verification code tied to a unique key. The key may represent an email address, phone number, or another identifier.- Parameters:
key
- the unique identifier (e.g., email, phone number)- Returns:
- a message that says that the code was created and that it's in the email
- See Also:
-
validateCode
Validates a verification code by checking its existence, expiration, and correctness. Codes are typically valid for 5 minutes after generation.- Parameters:
confirmCode
- the DTO containing the code and its associated key- Returns:
- a confirmation message if the code is valid
- Throws:
CodeNotFoundOrExpiredException
- if the code doesn't exist or has expiredInvalidCodeException
- if the code is incorrect for the given key- See Also:
-