Package io.mangoo.crypto.totp
Class TOTP
java.lang.Object
io.mangoo.crypto.totp.TOTP
Class which represents a Time-based One-time Password as per RFC 6238.
Refer to TOTPBuilder on how to generate a TOTP.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionintdigits()Returns the number of digits of thisTOTP.booleaninthashCode()Returns theHmacShaAlgorithmused to generate thisTOTP.static TOTPBuilderkey(byte[] key) Returns a newTOTPBuilderinstance initialized with the specifiedkey.longtime()Returns the time (in milliseconds) used to generate thisTOTP.longtimeStep()Returns the time step size (in milliseconds) used to generate thisTOTP.value()Returns the time-based one time password value.
-
Method Details
-
key
Returns a newTOTPBuilderinstance initialized with the specifiedkey.- Parameters:
key- the shared secret key- Returns:
- a new
TOTPBuilderinstance. - Throws:
NullPointerException- ifkeyisnull.
-
value
Returns the time-based one time password value.- Returns:
- the time-based one time password value.
-
time
public long time()Returns the time (in milliseconds) used to generate thisTOTP.- Returns:
- the time (in milliseconds) used to generate this
TOTP.
-
hmacShaAlgorithm
Returns theHmacShaAlgorithmused to generate thisTOTP.- Returns:
- the
HmacShaAlgorithmused to generate thisTOTP.
-
digits
public int digits()Returns the number of digits of thisTOTP.- Returns:
- the number of digits of this
TOTP.
-
timeStep
public long timeStep()Returns the time step size (in milliseconds) used to generate thisTOTP.- Returns:
- the time step size (in milliseconds) used to generate this
TOTP.
-
hashCode
public int hashCode() -
equals
-