Totp

class Totp(base32Secret: ByteArray) : OtpAuthUriBuilder<OtpAuthUriBuilder.Totp>

A builder for a TOTP OTP Auth URI.

An instance should be created via forTotp or TimeBasedOneTimePasswordGenerator.otpAuthUriBuilder.

Constructors

Link copied to clipboard
fun Totp(base32Secret: ByteArray)

Functions

Link copied to clipboard
fun algorithm(algorithm: HmacAlgorithm): OtpAuthUriBuilder.Totp

Sets the algorithm query parameter, which is the uppercase name of the HMAC algorithms defined in HmacAlgorithm.

Link copied to clipboard
fun buildToByteArray(): ByteArray

Builds the final OTP Auth URI as a ByteArray.

Link copied to clipboard
fun buildToString(): String

Builds the final OTP Auth URI as a String.

Link copied to clipboard
fun buildToUri(): URI

Builds the final OTP Auth URI as a URI.

Link copied to clipboard
fun digits(digits: Int): OtpAuthUriBuilder.Totp

Sets the digits query parameter, which is the length of the generated code.

Link copied to clipboard
fun issuer(issuer: String): OtpAuthUriBuilder.Totp

Sets the issuer query parameter, which indicates the provider or service the account (for which the OTP code gets used) belongs to.

Link copied to clipboard
fun label(    accountName: String,     issuer: String?,     encodeSeparator: Boolean = false): OtpAuthUriBuilder.Totp

Sets the label path part of the URI, which consist of an account name and an optional issuer. Both values will be separated by a colon (:), which can be URL encoded by setting the parameter encodeSeparator.

Link copied to clipboard
fun period(timeStep: Long, timeStepUnit: TimeUnit): OtpAuthUriBuilder.Totp

Sets the period query parameter, which defines the validity of a TOTP code in seconds.