Skip to content
This repository has been archived by the owner on Dec 13, 2023. It is now read-only.

Commit

Permalink
Updated dependencies & replaced SecureRandom with CryptographyRandom …
Browse files Browse the repository at this point in the history
…for nextBytes generation
  • Loading branch information
dinkar-jain committed Sep 21, 2023
1 parent c6b093d commit d9e7925
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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`
}
Expand Down Expand Up @@ -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")
Expand Down
3 changes: 2 additions & 1 deletion src/commonMain/kotlin/id/walt/sdjwt/SDPayload.kt
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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)
}

Expand Down

0 comments on commit d9e7925

Please sign in to comment.