public class OathTokenCode
extends java.lang.Object
| Modifier | Constructor and Description |
|---|---|
protected |
OathTokenCode(TimeKeeper timeKeeper,
java.lang.String code,
long start,
long until,
OathMechanism.TokenType tokenType)
Creates a OathTokenCode wrap with given data
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getCurrentCode()
Gets the code which is currently active.
|
OathMechanism.TokenType |
getOathType()
Returns the token type (HOTP, TOTP)
|
int |
getProgress()
Get the current percent progress of the code for
TOTPMechanism. |
long |
getStart()
Get the started timestamp of current Oath token.
|
long |
getUntil()
Get the expiration timestamp for TOTP tokens.
|
boolean |
isValid()
Indicates whether the current OathTokenCode is valid or not.
|
java.lang.String |
toJson()
Creates a JSON string representation of
OathTokenCode object. |
protected OathTokenCode(TimeKeeper timeKeeper, java.lang.String code, long start, long until, OathMechanism.TokenType tokenType)
timeKeeper - class containing timekeeping functionalitycode - OTP code with 6 or 8 digitsstart - start timestamp for current Oath codeuntil - expiration timestamp for current Oath codepublic java.lang.String getCurrentCode()
public long getStart()
public long getUntil()
0 as it does not expires.public boolean isValid()
true if the OathTokenCode is still valid, false otherwise.public OathMechanism.TokenType getOathType()
public int getProgress()
TOTPMechanism. This is a number
between 0 and 1000, and represents the amount of time that has passed between the start and
end times of the code.
For HOTPMechanism, progress always returns 0.public java.lang.String toJson()
OathTokenCode object.