generate

fun generate(timestamp: Long = System.currentTimeMillis()): String

Generates a code representing the time-based one-time password.

The TOTP algorithm uses the HTOP algorithm via HmacOneTimePasswordGenerator.generate, with a counter parameter that represents the number of timeSteps from TimeBasedOneTimePasswordConfig which fits into the timestamp.

The timestamp can be seen as the challenge to be solved. This should normally be a continuous value over time (e.g. the current time).

Parameters

timestamp

The Unix timestamp against the counting of the time steps is calculated. The default value is the current system time from System.currentTimeMillis.


fun generate(date: Date): String
fun generate(instant: Instant): String

Convenience method for generate.