Class VerificationCodeServiceImpl
java.lang.Object
com.bank.auth_service.service.impl.VerificationCodeServiceImpl
- All Implemented Interfaces:
VerificationCodeService
-
Constructor Summary
ConstructorsConstructorDescriptionVerificationCodeServiceImpl(CodeRepository codeRepository, CodePublisher codePublisher) -
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.
-
Constructor Details
-
VerificationCodeServiceImpl
-
-
Method Details
-
generateCode
Description copied from interface:VerificationCodeServiceGenerates a 6-digit numeric verification code tied to a unique key. The key may represent an email address, phone number, or another identifier.- Specified by:
generateCodein interfaceVerificationCodeService- 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
Description copied from interface:VerificationCodeServiceValidates a verification code by checking its existence, expiration, and correctness. Codes are typically valid for 5 minutes after generation.- Specified by:
validateCodein interfaceVerificationCodeService- Parameters:
confirmCode- the DTO containing the code and its associated key- Returns:
- a confirmation message if the code is valid
- See Also:
-