fix(Desktop): Use Conscrypt as preferred security provider for OkHttp to use #324

This commit is contained in:
Artem Chepurnoy 2024-06-30 20:54:34 +03:00
parent d53d75550b
commit eb925db5ae
No known key found for this signature in database
GPG Key ID: FAC37D0CF674043E
3 changed files with 11 additions and 0 deletions

View File

@ -21,6 +21,7 @@ kotlin {
implementation(compose.materialIconsExtended)
implementation(compose.desktop.currentOs)
implementation(compose.components.resources)
implementation(libs.conscrypt.openjdk)
implementation(project(":common"))
}
}

View File

@ -70,6 +70,7 @@ import kotlinx.coroutines.flow.mapLatest
import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.launch
import kotlinx.datetime.Clock
import org.conscrypt.Conscrypt
import org.jetbrains.compose.resources.painterResource
import org.jetbrains.compose.resources.stringResource
import org.kodein.di.DI
@ -79,10 +80,17 @@ import org.kodein.di.compose.rememberInstance
import org.kodein.di.compose.withDI
import org.kodein.di.direct
import org.kodein.di.instance
import java.security.Security
import java.util.Locale
import kotlin.reflect.KClass
fun main() {
// Add Conscrypt as the first security provider
// to make OkHTTP use its TLS instead of a platform
// specific one.
// https://github.com/square/okhttp?tab=readme-ov-file#requirements
Security.insertProviderAt(Conscrypt.newProvider(), 1)
val kamelConfig = KamelConfig {
this.takeFrom(KamelConfig.Default)
mapper(FaviconUrlMapper)

View File

@ -55,6 +55,7 @@ commonsLang3 = "3.14.0"
composeMultiplatform = "1.6.20-dev1673"
# https://github.com/DevSrSouza/compose-icons
composeOpenIcons = "1.1.0"
conscrypt = "2.5.2"
crashlyticsPlugin = "3.0.2"
firebase = "33.1.1"
# https://github.com/tfcporciuncula/flow-preferences
@ -184,6 +185,7 @@ cash-sqldelight-coroutines-extensions = { module = "app.cash.sqldelight:coroutin
cash-sqldelight-sqlite-driver = { module = "app.cash.sqldelight:sqlite-driver", version.ref = "sqldelight" }
commons-codec = { module = "commons-codec:commons-codec", version.ref = "commonsCodec" }
commons-lang3 = { module = "org.apache.commons:commons-lang3", version.ref = "commonsLang3" }
conscrypt-openjdk = { module = "org.conscrypt:conscrypt-openjdk-uber", version.ref = "conscrypt" }
devsrsouza-feather = { module = "br.com.devsrsouza.compose.icons:feather", version.ref = "composeOpenIcons" }
firebase-analytics-ktx = { module = "com.google.firebase:firebase-analytics-ktx" }
firebase-bom = { module = "com.google.firebase:firebase-bom", version.ref = "firebase" }