Infendro a2051dbd85
All checks were successful
/ publish (push) Successful in 3m6s
Merge pull request '1.3.1 Release' (#3) from develop into main
Reviewed-on: Infendro/otp-kt#3
2026-03-12 10:34:21 +00:00
2026-01-29 18:15:06 +01:00
2026-03-12 11:25:47 +01:00
2025-07-12 20:04:39 +02:00
2026-03-12 11:26:23 +01:00
2025-08-17 14:52:48 +02:00
2025-08-17 14:52:48 +02:00
2025-07-12 20:04:39 +02:00
2026-03-12 11:26:23 +01:00

otp-kt

otp-kt is a Kotlin Multiplatform library that provides common One-Time Password algorithms.

Supported algorithms:

  • HOTP
  • TOTP

Installation

Add the following to your build.gradle.kts.

repositories {
    maven("https://git.infendro.com/api/packages/Infendro/maven")
}

dependencies {
    implementation("com.infendro:otp:1.3.1")
}

Usage

fun main() {
    // create TOTP instance
    val totp = TOTP(
        function = SHA1(),
        length = 6,
        period = 30.seconds,
    )

    // generate and verify OTP
    val secret = "...".encodeToByteArray()
    val time = System.now()
    val otp = totp.generate(secret, time)
    totp.verify(secret, time, otp)
}
Description
No description provided
Readme 168 KiB
Languages
Kotlin 100%