Infendro e43fc4de86
All checks were successful
/ test (pull_request) Successful in 1m14s
Upgrade dependencies
2026-02-16 19:17:19 +01:00
2026-01-29 18:15:06 +01:00
2026-02-16 19:17:19 +01:00
2025-07-12 20:04:39 +02:00
2026-02-16 19:17:19 +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-01-30 13:31:04 +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.0")
}

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%