Interface PhoneVerificationRepository
public interface PhoneVerificationRepository
Port that stores the pending phone verification of each user, with the code hashed. An implementation never returns
null.-
Method Summary
Modifier and TypeMethodDescriptionvoiddeleteByUserId(UUID userId) Removes the pending verification of a user.intdeleteExpired(Instant now) Deletes every pending verification that has expired.findByUserId(UUID userId) Finds the pending verification of a user.intincrementAttempts(UUID userId) Counts a wrong submission, in one atomic step.voidsave(PhoneVerification verification) Stores the pending verification of a user, replacing the one it had.
-
Method Details
-
save
Stores the pending verification of a user, replacing the one it had.- Parameters:
verification- the verification.
-
findByUserId
Finds the pending verification of a user.- Parameters:
userId- identifier of the user.- Returns:
- the verification, or empty when there is none.
-
incrementAttempts
Counts a wrong submission, in one atomic step.- Parameters:
userId- identifier of the user.- Returns:
- the number of attempts after the increment, or
0when there is no pending verification.
-
deleteByUserId
Removes the pending verification of a user.- Parameters:
userId- identifier of the user.
-
deleteExpired
Deletes every pending verification that has expired.- Parameters:
now- current instant.- Returns:
- the number of deleted verifications.
-