Class TotpClock

java.lang.Object
tech.mgl.utils.security.gen.TotpClock

public class TotpClock extends Object
Clock input for the time-based OTPs (TOTP). The input is based on the current system time and is adjusted by a persistently stored correction value (offset in minutes).
Author:
klyubin@google.com (Alex Klyubin)
  • Constructor Details

    • TotpClock

      public TotpClock()
  • Method Details

    • currentTimeMillis

      public long currentTimeMillis()
      Gets the number of milliseconds since epoch.
    • getTimeCorrectionMinutes

      public int getTimeCorrectionMinutes()
      Gets the currently used time correction value.
      Returns:
      number of minutes by which this device is behind the correct time.
    • setTimeCorrectionMinutes

      public void setTimeCorrectionMinutes(int minutes)
      Sets the currently used time correction value.
      Parameters:
      minutes - number of minutes by which this device is behind the correct time.