Class TwoFactorAPI


  • public class TwoFactorAPI
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      TwoFactorAPI()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean isValidKey​(java.lang.String secret, int code)
      Check if a 6-digit code is a valid 2FA key
      static boolean isValidKey​(java.lang.String secret, java.lang.String code)
      Check if a 6-digit code is a valid 2FA key
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TwoFactorAPI

        public TwoFactorAPI()
    • Method Detail

      • isValidKey

        public static boolean isValidKey​(java.lang.String secret,
                                         int code)
        Check if a 6-digit code is a valid 2FA key
        Parameters:
        secret - The secret key unique to the user
        code - The 6-digit code that was provided
        Returns:
        If the 6-digit code provided is a valid 2FA key
      • isValidKey

        public static boolean isValidKey​(java.lang.String secret,
                                         java.lang.String code)
                                  throws ValidationException
        Check if a 6-digit code is a valid 2FA key
        Parameters:
        secret - The secret key unique to the user
        code - The 6-digit code that was provided
        Returns:
        If the 6-digit code provided is a valid 2FA key
        Throws:
        ValidationException - If the string code provided cannot be parsed as an integer