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 TOTPBuilder on how to generate a TOTP.

See Also:
  • Method Details

    • key

      public static TOTPBuilder key(byte[] key)
      Returns a new TOTPBuilder instance initialized with the specified key.
      Parameters:
      key - the shared secret key
      Returns:
      a new TOTPBuilder instance.
      Throws:
      NullPointerException - if key is null.
    • 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 this TOTP.
      Returns:
      the time (in milliseconds) used to generate this TOTP.
    • hmacShaAlgorithm

      public HmacShaAlgorithm hmacShaAlgorithm()
      Returns the HmacShaAlgorithm used to generate this TOTP.
      Returns:
      the HmacShaAlgorithm used to generate this TOTP.
    • digits

      public int digits()
      Returns the number of digits of this TOTP.
      Returns:
      the number of digits of this TOTP.
    • timeStep

      public long timeStep()
      Returns the time step size (in milliseconds) used to generate this TOTP.
      Returns:
      the time step size (in milliseconds) used to generate this TOTP.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object