diff --git a/README.md b/README.md index ab41c75..6026bff 100644 --- a/README.md +++ b/README.md @@ -11,9 +11,11 @@ The implementations are based on the RFCs: * [RFC 4226: "RFC 4226 HOTP: An HMAC-Based One-Time Password Algorithm"](https://www.ietf.org/rfc/rfc4226.txt) * [RFC 6238: "TOTP: Time-Based One-Time Password Algorithm"](https://tools.ietf.org/html/rfc6238) -> ℹ️ In this repository, changes don't happen that often and the library gets updated very rarely. However, this is **not** an abandoned project. Since the code is relatively simple, follows the specifications of the two RFCs, and has good test coverage, there is hardly any need to change anything. +> [!NOTE] +> This library is updated very rarely, and there are only minor changes every now and then. However, this should not be seen as an abandonment of the project. Since the code is relatively simple, follows the specifications of the relevant RFCs, and has good test coverage, there is little need to change anything. -> ℹ️ If you want to use this library in conjunction with the Google Authenticator app (or similar apps), please carefully read the chapter [Google Authenticator](#google-authenticator), especially the remarks regarding the Base32-encoded secret and the plain text secret length limitation. Most problems arise from not following the two remarks correctly. +> [!TIP] +> If you want to use this library in conjunction with the Google Authenticator app (or similar apps), please carefully read the chapter [Google Authenticator](#google-authenticator), especially the remarks regarding the Base32-encoded secret and the plain text secret length limitation. Most problems arise from not following the two remarks correctly. > > This library gets used by hundreds of active users every day to generate Google Authenticator codes for several years now, so I am very confident that the code correctly generates codes. @@ -44,10 +46,10 @@ This library is available at [Maven Central](https://mvnrepository.com/artifact/ ```java // Groovy -implementation 'dev.turingcomplete:kotlin-onetimepassword:2.4.0' +implementation 'dev.turingcomplete:kotlin-onetimepassword:2.4.1' // Kotlin -implementation("dev.turingcomplete:kotlin-onetimepassword:2.4.0") +implementation("dev.turingcomplete:kotlin-onetimepassword:2.4.1") ``` ### Maven @@ -56,7 +58,7 @@ implementation("dev.turingcomplete:kotlin-onetimepassword:2.4.0") dev.turingcomplete kotlin-onetimepassword - 2.4.0 + 2.4.1 ``` @@ -268,7 +270,7 @@ Note that according to the specification, the Base32 padding character `=` will ## Licensing -Copyright (c) 2023 Marcel Kliemannel +Copyright (c) 2024 Marcel Kliemannel Licensed under the **Apache License, Version 2.0** (the "License"); you may not use this file except in compliance with the License. diff --git a/build.gradle.kts b/build.gradle.kts index 1408054..6db1f22 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -11,7 +11,7 @@ plugins { allprojects { group = "dev.turingcomplete" - version = "2.4.0" + version = "2.4.1" repositories { mavenLocal() diff --git a/src/main/kotlin/dev/turingcomplete/kotlinonetimepassword/OtpAuthUriBuilder.kt b/src/main/kotlin/dev/turingcomplete/kotlinonetimepassword/OtpAuthUriBuilder.kt index e06d8c5..37ba80e 100644 --- a/src/main/kotlin/dev/turingcomplete/kotlinonetimepassword/OtpAuthUriBuilder.kt +++ b/src/main/kotlin/dev/turingcomplete/kotlinonetimepassword/OtpAuthUriBuilder.kt @@ -210,7 +210,7 @@ open class OtpAuthUriBuilder>(private val type: String, private fun buildUriWithoutSecret(additionalParameters: Map = emptyMap()): String { val query = parameters.plus(additionalParameters).map { "${it.key}=${it.value}" }.joinToString(separator = "&", prefix = "?") - return "otpauth://$type/${if (label != null) "$label/" else ""}$query" + return "otpauth://$type/${if (label != null) label else ""}$query" } private fun removePaddingFromBase32Secret(base32Secret: ByteArray): ByteArray { diff --git a/src/test/kotlin/dev/turingcomplete/kotlinonetimepassword/OtpAuthUriBuilderTest.kt b/src/test/kotlin/dev/turingcomplete/kotlinonetimepassword/OtpAuthUriBuilderTest.kt index f833afa..8b4740e 100644 --- a/src/test/kotlin/dev/turingcomplete/kotlinonetimepassword/OtpAuthUriBuilderTest.kt +++ b/src/test/kotlin/dev/turingcomplete/kotlinonetimepassword/OtpAuthUriBuilderTest.kt @@ -89,17 +89,17 @@ class OtpAuthUriBuilderTest { @Test fun testLabel() { - assertEquals("otpauth://totp/iss:acc/?secret=$BASE32_SECRET_REMOVED_PADDING", + assertEquals("otpauth://totp/iss:acc?secret=$BASE32_SECRET_REMOVED_PADDING", OtpAuthUriBuilder.forTotp(BASE32_SECRET) .label("acc", "iss", false) .buildToString()) - assertEquals("otpauth://totp/acc/?secret=$BASE32_SECRET_REMOVED_PADDING", + assertEquals("otpauth://totp/acc?secret=$BASE32_SECRET_REMOVED_PADDING", OtpAuthUriBuilder.forTotp(BASE32_SECRET) .label("acc", null, false) .buildToString()) - assertEquals("otpauth://totp/iss%3Aacc/?secret=$BASE32_SECRET_REMOVED_PADDING", + assertEquals("otpauth://totp/iss%3Aacc?secret=$BASE32_SECRET_REMOVED_PADDING", OtpAuthUriBuilder.forTotp(BASE32_SECRET) .label("acc", "iss", true) .buildToString()) @@ -107,7 +107,7 @@ class OtpAuthUriBuilderTest { @Test fun testLabelUrlEncoding() { - assertEquals("otpauth://totp/i%2F%2Fss%3Aa%2F%2Fcc/?secret=$BASE32_SECRET_REMOVED_PADDING", + assertEquals("otpauth://totp/i%2F%2Fss%3Aa%2F%2Fcc?secret=$BASE32_SECRET_REMOVED_PADDING", OtpAuthUriBuilder.forTotp(BASE32_SECRET) .label("a//cc", "i//ss", true) .buildToString()) @@ -121,7 +121,7 @@ class OtpAuthUriBuilderTest { .digits(8) val stringRepresentation = builder.buildToString() - assertEquals("otpauth://totp/i%2Fss:acc/?issuer=i%2Fss&digits=8&secret=$BASE32_SECRET_REMOVED_PADDING", stringRepresentation) + assertEquals("otpauth://totp/i%2Fss:acc?issuer=i%2Fss&digits=8&secret=$BASE32_SECRET_REMOVED_PADDING", stringRepresentation) val byteArrayRepresentation = builder.buildToByteArray() assertEquals(stringRepresentation, String(byteArrayRepresentation))