From 9acac9f182817ea4cbabbe3cd69eb988c10e5e63 Mon Sep 17 00:00:00 2001 From: rlnt Date: Tue, 24 Mar 2026 09:31:30 +0100 Subject: [PATCH] replace deprecated Ktor base64 encoding with Kotlin std library call fixes #22808 --- .../libraries/jvm-ktor/auth/HttpBasicAuth.kt.mustache | 4 ++-- .../libraries/multiplatform/auth/HttpBasicAuth.kt.mustache | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-ktor/auth/HttpBasicAuth.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-ktor/auth/HttpBasicAuth.kt.mustache index 0e3dba003ef0..c18b30352f05 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-ktor/auth/HttpBasicAuth.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-ktor/auth/HttpBasicAuth.kt.mustache @@ -1,6 +1,6 @@ package {{packageName}}.auth -import io.ktor.util.encodeBase64 +import kotlin.io.encoding.Base64 {{^nonPublicApi}}{{#explicitApi}}public {{/explicitApi}}{{/nonPublicApi}}class HttpBasicAuth : Authentication { {{^nonPublicApi}}{{#explicitApi}}public {{/explicitApi}}{{/nonPublicApi}}var username: String? = null @@ -9,7 +9,7 @@ import io.ktor.util.encodeBase64 override fun apply(query: MutableMap>, headers: MutableMap) { if (username == null && password == null) return val str = (username ?: "") + ":" + (password ?: "") - val auth = str.encodeBase64() + val auth = Base64.encode(str.encodeToByteArray()) headers["Authorization"] = "Basic $auth" } } diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/auth/HttpBasicAuth.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/auth/HttpBasicAuth.kt.mustache index 0e3dba003ef0..c18b30352f05 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/auth/HttpBasicAuth.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/auth/HttpBasicAuth.kt.mustache @@ -1,6 +1,6 @@ package {{packageName}}.auth -import io.ktor.util.encodeBase64 +import kotlin.io.encoding.Base64 {{^nonPublicApi}}{{#explicitApi}}public {{/explicitApi}}{{/nonPublicApi}}class HttpBasicAuth : Authentication { {{^nonPublicApi}}{{#explicitApi}}public {{/explicitApi}}{{/nonPublicApi}}var username: String? = null @@ -9,7 +9,7 @@ import io.ktor.util.encodeBase64 override fun apply(query: MutableMap>, headers: MutableMap) { if (username == null && password == null) return val str = (username ?: "") + ":" + (password ?: "") - val auth = str.encodeBase64() + val auth = Base64.encode(str.encodeToByteArray()) headers["Authorization"] = "Basic $auth" } }