Class OTPKey


  • public final class OTPKey
    extends Object
    An immutable class representing a One Time Password (OTP) key. An OTP key consists of:
    • The shared secret key,
    • The type of OTP (either HOTP or TOTP)
    • Constructor Detail

      • OTPKey

        public OTPKey​(String key,
                      OTPKey.OTPType type)
        Creates a new instance of an OTP key of type HOTP or TOTP.
        Parameters:
        key - the encoded shared secret key used to generate an OTP
        type - the type of OTP
    • Method Detail

      • getKey

        public String getKey()
        Returns the encoded shared secret key used to generate an OTP.
        Returns:
        the encoded shared secret key used to generate an OTP.
      • getType

        public OTPKey.OTPType getType()
        Returns the type of OTP.
        Returns:
        the type of OTP.