Package io.mangoo.crypto.totp
Class TOTP
- java.lang.Object
-
- io.mangoo.crypto.totp.TOTP
-
public final class TOTP extends Object
Class which represents a Time-based One-time Password as per RFC 6238.Refer to
TOTPBuilderon how to generate aTOTP.- See Also:
- RFC 6238
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intdigits()Returns the number of digits of thisTOTP.booleanequals(Object obj)inthashCode()HmacShaAlgorithmhmacShaAlgorithm()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.Stringvalue()Returns the time-based one time password value.
-
-
-
Method Detail
-
key
public static TOTPBuilder key(byte[] key)
Returns a newTOTPBuilderinstance initialized with the specifiedkey.- Parameters:
key- the shared secret key- Returns:
- a new
TOTPBuilderinstance. - Throws:
NullPointerException- ifkeyisnull.
-
value
public String 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
public HmacShaAlgorithm 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.
-
-