diff --git a/build.gradle.kts b/build.gradle.kts index e153a3c..74b57e6 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -3,7 +3,7 @@ import org.jetbrains.kotlin.utils.addToStdlib.cast import org.jetbrains.kotlin.utils.addToStdlib.castAll plugins { - kotlin("multiplatform") version "1.8.21" + kotlin("multiplatform") version "1.9.10" id("dev.petuska.npm.publish") version "3.3.1" `maven-publish` } @@ -50,6 +50,7 @@ kotlin { sourceSets { val commonMain by getting { dependencies { + implementation("dev.whyoleg.cryptography:cryptography-random:0.2.0") implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.1") implementation("com.soywiz.korlibs.krypto:krypto:$kryptoVersion") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.1") diff --git a/src/commonMain/kotlin/id/walt/sdjwt/SDPayload.kt b/src/commonMain/kotlin/id/walt/sdjwt/SDPayload.kt index 8a657c7..0e6f8a6 100644 --- a/src/commonMain/kotlin/id/walt/sdjwt/SDPayload.kt +++ b/src/commonMain/kotlin/id/walt/sdjwt/SDPayload.kt @@ -1,5 +1,6 @@ package id.walt.sdjwt +import dev.whyoleg.cryptography.random.CryptographyRandom import korlibs.crypto.SecureRandom import korlibs.crypto.encoding.Base64 import korlibs.crypto.sha256 @@ -120,7 +121,7 @@ data class SDPayload internal constructor ( } private fun generateSalt(): String { - val randomness = SecureRandom.nextBytes(16) + val randomness = CryptographyRandom.nextBytes(16) return Base64.encode(randomness, url = true) }