Class OtpManagerUtils


  • @RefreshScope
    @Component
    public class OtpManagerUtils
    extends Object
    This utility class defines some of the utility methods used in OTP validation.
    Since:
    1.0.0
    Author:
    Sagar Mahapatra, Ritesh Sinha
    • Constructor Detail

      • OtpManagerUtils

        public OtpManagerUtils()
    • Method Detail

      • timeDifferenceInSeconds

        public static int timeDifferenceInSeconds​(LocalDateTime fromDateTime,
                                                  LocalDateTime toDateTime)
        This method returns the difference between two LocalDateTime objects in seconds.
        Parameters:
        fromDateTime - The time from which the difference needs to be calculated.
        toDateTime - The time till which the difference needs to be calculated.
        Returns:
        The difference in seconds.
      • getCurrentLocalDateTime

        public static LocalDateTime getCurrentLocalDateTime()
        This method returns the current LocalDateTime.
        Returns:
        The current local date and time.
      • validateOtpRequestArguments

        public void validateOtpRequestArguments​(String key,
                                                String otp)
        This method validates the input arguments provided for validation.
        Parameters:
        key - The key.
        otp - The OTP to be validated against the given key.