Hotp

class Hotp(initialCounter: Long, base32Secret: ByteArray) : OtpAuthUriBuilder<OtpAuthUriBuilder.Hotp>

A builder for an HOTP OTP Auth URI.

An instance should be created via forHotp or HmacOneTimePasswordGenerator.otpAuthUriBuilder.

Parameters

initialCounter

the initial counter value.

Constructors

Link copied to clipboard
fun Hotp(initialCounter: Long, base32Secret: ByteArray)

Functions

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

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 counter(initialCounter: Long): OtpAuthUriBuilder.Hotp

Sets the counter parameter, which defines the initial counter value.

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

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

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

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.Hotp

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.