Skip to content

Commit 4f822b7

Browse files
authored
Merge pull request #796 from supabase-community/kotlin-2-1-0
Update Kotlin to 2.1.0
1 parent af6f770 commit 4f822b7

File tree

12 files changed

+37
-27
lines changed

12 files changed

+37
-27
lines changed

Auth/build.gradle.kts

+8-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ kotlin {
3838
val commonMain by getting {
3939
dependencies {
4040
addModules(SupabaseModule.SUPABASE)
41-
implementation(libs.krypto)
41+
// implementation(libs.krypto)
42+
implementation(libs.secure.random)
43+
api(libs.okio)
4244
}
4345
}
4446
val desktopMain by getting {
@@ -65,6 +67,11 @@ kotlin {
6567
api(libs.androidx.browser)
6668
}
6769
}
70+
val wasmJsMain by getting {
71+
dependencies {
72+
api(libs.kotlinx.browser)
73+
}
74+
}
6875
}
6976
}
7077

Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
@file:Suppress("MatchingDeclarationName")
22
package io.github.jan.supabase.auth
33

4-
import korlibs.crypto.SHA256
5-
import korlibs.crypto.SecureRandom
4+
import okio.ByteString.Companion.toByteString
5+
import org.kotlincrypto.SecureRandom
66
import kotlin.io.encoding.Base64
77
import kotlin.io.encoding.ExperimentalEncodingApi
88

@@ -14,13 +14,13 @@ internal object PKCEConstants {
1414
@OptIn(ExperimentalEncodingApi::class)
1515
internal fun generateCodeVerifier(): String {
1616
val bytes = ByteArray(PKCEConstants.VERIFIER_LENGTH)
17-
SecureRandom.nextBytes(bytes)
17+
SecureRandom().nextBytesCopyTo(bytes)
1818
return Base64.UrlSafe.encode(bytes)
1919
}
2020

2121
@OptIn(ExperimentalEncodingApi::class)
2222
internal fun generateCodeChallenge(codeVerifier: String): String {
23-
val bytes = codeVerifier.encodeToByteArray()
24-
val hash = SHA256.digest(bytes)
25-
return Base64.UrlSafe.encode(hash.bytes).replace("=", "")
23+
val byteString = codeVerifier.encodeToByteArray().toByteString()
24+
val hash = byteString.sha256()
25+
return Base64.UrlSafe.encode(hash.toByteArray()).replace("=", "")
2626
}

Functions/build.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ kotlin {
2828
}
2929

3030
android {
31-
compileSdk = 34
31+
compileSdk = 35
3232
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
3333
namespace = "io.github.jan.supabase.functions.library"
3434
defaultConfig {

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ For information about supported Kotlin targets, see the corresponding module REA
1010

1111
[![](https://img.shields.io/github/release/supabase-community/supabase-kt?label=stable)](https://github.com/supabase-community/supabase-kt/releases)
1212
[![](https://badgen.net/github/release/supabase-community/supabase-kt?label=prerelease)](https://central.sonatype.com/search?q=io.github.jan.supabase&smo=true)
13-
[![Kotlin](https://img.shields.io/badge/kotlin-2.0.21-blue.svg?logo=kotlin)](http://kotlinlang.org)
14-
[![Ktor](https://img.shields.io/badge/ktor-3.0.0-blue)](https://ktor.io/)
13+
[![Kotlin](https://img.shields.io/badge/kotlin-2.1.0-blue.svg?logo=kotlin)](http://kotlinlang.org)
14+
[![Ktor](https://img.shields.io/badge/ktor-3.0.1-blue)](https://ktor.io/)
1515
[![slack](https://img.shields.io/badge/slack-%23supabase--kt-purple.svg?logo=slack)](https://kotlinlang.slack.com/archives/C06QXPC7064)
1616

1717
### Links
@@ -101,7 +101,7 @@ val iosMain by getting {
101101
**Note:** It is recommended to use the same Ktor version as supabase-kt:
102102

103103
__For 3.0.0 and above:__
104-
[![Ktor](https://img.shields.io/badge/ktor-3.0.0-blue)](https://ktor.io/)
104+
[![Ktor](https://img.shields.io/badge/ktor-3.0.1-blue)](https://ktor.io/)
105105

106106
__For versions below 3.0.0:__
107107
[![Ktor](https://img.shields.io/badge/ktor-2.3.12-blue)](https://ktor.io/)

demos/android-login/android/build.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ dependencies {
1919
}
2020

2121
android {
22-
compileSdk = 34
22+
compileSdk = 35
2323
defaultConfig {
2424
applicationId = "io.github.jan.supabase.android"
2525
minSdk = 26

demos/android-login/common/build.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ kotlin {
4848
}
4949

5050
android {
51-
compileSdk = 34
51+
compileSdk = 35
5252
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
5353
namespace = "io.github.jan.supabase.common"
5454
defaultConfig {

demos/multiplatform-deeplinks/android/build.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ dependencies {
1414
}
1515

1616
android {
17-
compileSdk = 34
17+
compileSdk = 35
1818
defaultConfig {
1919
applicationId = "io.github.jan.supabase.android"
2020
minSdk = 26

demos/multiplatform-deeplinks/common/build.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ kotlin {
5151
}
5252

5353
android {
54-
compileSdk = 34
54+
compileSdk = 35
5555
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
5656
namespace = "io.github.jan.supabase.common"
5757
defaultConfig {

gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ org.jetbrains.compose.experimental.uikit.enabled=true
1010
org.jetbrains.compose.experimental.jscanvas.enabled=true
1111
org.jetbrains.compose.experimental.wasm.enabled=true
1212

13-
supabase-version = 3.0.2
13+
supabase-version = 3.0.3
1414
base-group = io.github.jan-tennert.supabase

gradle/libs.versions.toml

+10-6
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
[versions]
2-
kotlin = "2.0.21"
2+
kotlin = "2.1.0"
33
accompanist-permissions = "0.36.0"
4-
ktor = "3.0.1"
4+
ktor = "3.0.2"
55
dokka = "1.9.20"
66
kotlinx-datetime = "0.6.1"
77
kermit = "2.0.5"
8-
atomicfu = "0.26.0"
8+
atomicfu = "0.26.1"
99
coroutines = "1.9.0"
1010
android-lifecycle = "2.8.7"
1111
androidx-startup = "1.2.0"
1212
androidx-activity-compose = "1.9.3"
13-
multiplatform-settings = "1.2.0"
13+
multiplatform-settings = "1.3.0"
1414
complete-kotlin = "1.1.0"
1515
agp = "8.5.2"
1616
maven-publish = "0.30.0"
1717
apollo-kotlin = "4.1.0"
18-
korlibs = "4.0.10"
18+
korlibs = "6.0.0"
1919
detekt = "1.23.7"
2020
moshi = "1.15.1"
2121
jackson = "2.18.1"
@@ -33,6 +33,8 @@ androidx-core = "1.15.0"
3333
androidx-compat = "1.7.0"
3434
androidx-lifecycle = "2.8.7"
3535
filekit = "0.8.7"
36+
kotlinx-browser = "0.3"
37+
secure-random = "0.3.2"
3638

3739
[plugins]
3840
kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
@@ -54,6 +56,7 @@ power-assert = { id = "org.jetbrains.kotlin.plugin.power-assert", version.ref =
5456
[libraries]
5557
kotlinx-atomicfu = { module = "org.jetbrains.kotlinx:atomicfu", version.ref = "atomicfu" }
5658
kotlinx-datetime = { module = "org.jetbrains.kotlinx:kotlinx-datetime", version.ref = "kotlinx-datetime" }
59+
kotlinx-browser = { module = "org.jetbrains.kotlinx:kotlinx-browser", version.ref = "kotlinx-browser" }
5760
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutines" }
5861
kotlinx-coroutines-play-services = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-play-services", version.ref = "coroutines" }
5962
kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "coroutines" }
@@ -98,7 +101,8 @@ multiplatform-settings-test = { module = "com.russhwolf:multiplatform-settings-t
98101

99102
apollo-kotlin = { module = "com.apollographql.apollo:apollo-runtime", version.ref = "apollo-kotlin" }
100103

101-
krypto = { module = "com.soywiz.korlibs.krypto:krypto", version.ref = "korlibs" }
104+
krypto = { module = "com.soywiz:korlibs-crypto", version.ref = "korlibs" }
105+
secure-random = { module = "org.kotlincrypto:secure-random", version.ref = "secure-random" }
102106
okio = { module = "com.squareup.okio:okio", version.ref = "okio" }
103107

104108
moshi = { module = "com.squareup.moshi:moshi", version.ref = "moshi" }

plugins/ComposeAuth/build.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ kotlin {
3434
dependencies {
3535
addModules(SupabaseModule.AUTH)
3636
implementation(compose.runtime)
37-
implementation(libs.krypto)
37+
// implementation(libs.krypto)
3838
}
3939
}
4040
val androidMain by getting {
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
package io.github.jan.supabase.compose.auth
22

3-
import io.ktor.utils.io.core.toByteArray
4-
import korlibs.crypto.SHA256
3+
import okio.ByteString.Companion.toByteString
54

65
internal fun String.hash(): String {
7-
val hash = SHA256.digest(this.toByteArray())
8-
return hash.hex
6+
val hash = this.encodeToByteArray().toByteString()
7+
return hash.sha256().hex()
98
}

0 commit comments

Comments
 (0)