Package io.mangoo.crypto.totp
Class OTPKey
- java.lang.Object
-
- io.mangoo.crypto.totp.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)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classOTPKey.OTPTypeType of One Time Password.
-
Constructor Summary
Constructors Constructor Description OTPKey(String key, OTPKey.OTPType type)Creates a new instance of an OTP key of type HOTP or TOTP.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetKey()Returns the encoded shared secret key used to generate an OTP.OTPKey.OTPTypegetType()Returns the type of OTP.
-
-
-
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 OTPtype- 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.
-
-