chore: Update Kotlin to 2.0.20

This commit is contained in:
Artem Chepurnyi 2024-09-01 10:18:02 +03:00
parent 2c82d57f72
commit 62b24bb462
25 changed files with 66 additions and 60 deletions

View File

@ -91,6 +91,7 @@ kotlin {
all { all {
languageSettings.optIn("kotlin.ExperimentalStdlibApi") languageSettings.optIn("kotlin.ExperimentalStdlibApi")
languageSettings.optIn("kotlin.time.ExperimentalTime") languageSettings.optIn("kotlin.time.ExperimentalTime")
languageSettings.optIn("kotlin.uuid.ExperimentalUuidApi")
languageSettings.optIn("androidx.compose.animation.ExperimentalAnimationApi") languageSettings.optIn("androidx.compose.animation.ExperimentalAnimationApi")
languageSettings.optIn("androidx.compose.material.ExperimentalMaterialApi") languageSettings.optIn("androidx.compose.material.ExperimentalMaterialApi")
languageSettings.optIn("androidx.compose.foundation.ExperimentalFoundationApi") languageSettings.optIn("androidx.compose.foundation.ExperimentalFoundationApi")

View File

@ -1,7 +1,7 @@
package com.artemchep.keyguard.android package com.artemchep.keyguard.android
import java.nio.ByteBuffer import java.nio.ByteBuffer
import java.util.UUID import kotlin.uuid.Uuid
object PasskeyCredentialId { object PasskeyCredentialId {
private const val UUID_SIZE_BYTES = Long.SIZE_BYTES * 2 private const val UUID_SIZE_BYTES = Long.SIZE_BYTES * 2
@ -11,7 +11,7 @@ object PasskeyCredentialId {
): ByteArray { ): ByteArray {
val uuid = kotlin val uuid = kotlin
.runCatching { .runCatching {
UUID.fromString(credentialId) Uuid.parse(credentialId)
} }
// The credential id is not conforming to UUID rules, // The credential id is not conforming to UUID rules,
// this is fine for us (although should not happen), we // this is fine for us (although should not happen), we
@ -20,8 +20,13 @@ object PasskeyCredentialId {
return PasskeyBase64.decode(credentialId) return PasskeyBase64.decode(credentialId)
} }
return ByteBuffer.allocate(UUID_SIZE_BYTES) return ByteBuffer.allocate(UUID_SIZE_BYTES)
.putLong(uuid.mostSignificantBits) .apply {
.putLong(uuid.leastSignificantBits) uuid.toLongs { m, l ->
putLong(m)
putLong(l)
Unit
}
}
.array() .array()
} }
@ -30,7 +35,7 @@ object PasskeyCredentialId {
): String { ): String {
if (data.size == UUID_SIZE_BYTES) { if (data.size == UUID_SIZE_BYTES) {
val bb = ByteBuffer.wrap(data) val bb = ByteBuffer.wrap(data)
return UUID( return Uuid.fromLongs(
bb.getLong(), bb.getLong(),
bb.getLong(), bb.getLong(),
).toString() ).toString()

View File

@ -37,7 +37,7 @@ import kotlinx.collections.immutable.PersistentMap
import kotlinx.collections.immutable.persistentMapOf import kotlinx.collections.immutable.persistentMapOf
import kotlinx.collections.immutable.toImmutableSet import kotlinx.collections.immutable.toImmutableSet
import java.io.IOException import java.io.IOException
import java.util.UUID import kotlin.uuid.Uuid
@Composable @Composable
actual fun rememberYubiKey( actual fun rememberYubiKey(
@ -127,7 +127,7 @@ private fun YubiKitManager.rememberYubiKeyUsbState(
DisposableEffect(context, this) { DisposableEffect(context, this) {
val callback = Callback<UsbYubiKeyDevice> { device: UsbYubiKeyDevice -> val callback = Callback<UsbYubiKeyDevice> { device: UsbYubiKeyDevice ->
val info = ActiveDevice( val info = ActiveDevice(
id = UUID.randomUUID().toString(), id = Uuid.random().toString(),
pid = device.pid, pid = device.pid,
) )

View File

@ -1,9 +1,9 @@
package com.artemchep.keyguard.common.model package com.artemchep.keyguard.common.model
import java.util.UUID import kotlin.uuid.Uuid
data class ToastMessage( data class ToastMessage(
val id: String = UUID.randomUUID().toString(), val id: String = Uuid.random().toString(),
val type: Type? = null, val type: Type? = null,
val title: String, val title: String,
val text: String? = null, val text: String? = null,

View File

@ -7,7 +7,7 @@ import com.artemchep.keyguard.common.io.io
import com.artemchep.keyguard.common.service.id.IdRepository import com.artemchep.keyguard.common.service.id.IdRepository
import org.kodein.di.DirectDI import org.kodein.di.DirectDI
import org.kodein.di.instance import org.kodein.di.instance
import java.util.UUID import kotlin.uuid.Uuid
class DeviceIdUseCase( class DeviceIdUseCase(
private val deviceIdRepository: IdRepository, private val deviceIdRepository: IdRepository,
@ -45,4 +45,4 @@ class DeviceIdUseCase(
} }
} }
private fun getDeviceId() = UUID.randomUUID().toString() private fun getDeviceId() = Uuid.random().toString()

View File

@ -4,7 +4,7 @@ import com.artemchep.keyguard.common.model.ToastMessage
import com.artemchep.keyguard.common.usecase.MessageHub import com.artemchep.keyguard.common.usecase.MessageHub
import com.artemchep.keyguard.common.usecase.ShowMessage import com.artemchep.keyguard.common.usecase.ShowMessage
import org.kodein.di.DirectDI import org.kodein.di.DirectDI
import java.util.UUID import kotlin.uuid.Uuid
class MessageHubImpl() : MessageHub, ShowMessage { class MessageHubImpl() : MessageHub, ShowMessage {
constructor(directDI: DirectDI) : this() constructor(directDI: DirectDI) : this()
@ -21,7 +21,7 @@ class MessageHubImpl() : MessageHub, ShowMessage {
key: String, key: String,
onMessage: (ToastMessage) -> Unit, onMessage: (ToastMessage) -> Unit,
): () -> Unit { ): () -> Unit {
val id = UUID.randomUUID().toString() val id = Uuid.random().toString()
val entry = Entry( val entry = Entry(
id = id, id = id,
key = key, key = key,

View File

@ -5,8 +5,8 @@ import kotlinx.datetime.Clock
import kotlinx.datetime.Instant import kotlinx.datetime.Instant
import kotlinx.serialization.SerialName import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable import kotlinx.serialization.Serializable
import java.util.UUID
import kotlin.time.Duration.Companion.days import kotlin.time.Duration.Companion.days
import kotlin.uuid.Uuid
@Serializable @Serializable
@optics @optics
@ -317,7 +317,7 @@ fun BitwardenCipher.Companion.generated(): BitwardenCipher {
"Cum ita esset affecta, secundum non recte, si voluptas esset bonum, fuisse desideraturam. Idcirco enim non desideraret, quia, quod dolore caret, id in hominum consuetudine facilius fieri poterit et iustius?", "Cum ita esset affecta, secundum non recte, si voluptas esset bonum, fuisse desideraturam. Idcirco enim non desideraret, quia, quod dolore caret, id in hominum consuetudine facilius fieri poterit et iustius?",
) )
return BitwardenCipher( return BitwardenCipher(
cipherId = UUID.randomUUID().toString(), cipherId = Uuid.random().toString(),
accountId = accountIds.random(), accountId = accountIds.random(),
folderId = folderIds.random(), folderId = folderIds.random(),
revisionDate = Clock.System.now().minus(20L.days), revisionDate = Clock.System.now().minus(20L.days),

View File

@ -5,11 +5,11 @@ import com.artemchep.keyguard.provider.bitwarden.ServerEnv
import com.artemchep.keyguard.provider.bitwarden.ServerHeader import com.artemchep.keyguard.provider.bitwarden.ServerHeader
import kotlinx.datetime.Instant import kotlinx.datetime.Instant
import kotlinx.serialization.Serializable import kotlinx.serialization.Serializable
import java.util.UUID import kotlin.uuid.Uuid
@Serializable @Serializable
data class BitwardenToken( data class BitwardenToken(
val id: String = UUID.randomUUID().toString(), val id: String = Uuid.random().toString(),
val key: Key, val key: Key,
val token: Token? = null, val token: Token? = null,
val user: User, val user: User,

View File

@ -64,7 +64,7 @@ import org.kodein.di.compose.localDI
import org.kodein.di.direct import org.kodein.di.direct
import org.kodein.di.instance import org.kodein.di.instance
import java.io.Serializable import java.io.Serializable
import java.util.UUID import kotlin.uuid.Uuid
private const val TAG = "login" private const val TAG = "login"
@ -850,7 +850,7 @@ suspend fun <T, Argument> RememberStateFlowScope.foo3(
val initialState = Foo2InitialState( val initialState = Foo2InitialState(
items = initial items = initial
.associateBy { .associateBy {
UUID.randomUUID().toString() Uuid.random().toString()
} }
.map { entry -> .map { entry ->
Foo2InitialState.Item( Foo2InitialState.Item(
@ -983,7 +983,7 @@ suspend fun <T, Argument> RememberStateFlowScope.foo(
} }
fun add(type: String, arg: Argument?) { fun add(type: String, arg: Argument?) {
val key = "$scope.items." + UUID.randomUUID().toString() val key = "$scope.items." + Uuid.random().toString()
// Remember the argument, so we can grab it and construct something // Remember the argument, so we can grab it and construct something
// persistent from it. // persistent from it.
if (arg != null) { if (arg != null) {

View File

@ -8,7 +8,7 @@ import com.artemchep.keyguard.ui.FlatItemAction
import kotlinx.collections.immutable.PersistentList import kotlinx.collections.immutable.PersistentList
import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.StateFlow
import kotlinx.datetime.Instant import kotlinx.datetime.Instant
import java.util.UUID import kotlin.uuid.Uuid
@Immutable @Immutable
@optics @optics
@ -19,7 +19,7 @@ sealed interface GeneratorHistoryItem {
@Immutable @Immutable
data class Section( data class Section(
override val id: String = UUID.randomUUID().toString(), override val id: String = Uuid.random().toString(),
val text: String? = null, val text: String? = null,
val caps: Boolean = true, val caps: Boolean = true,
) : GeneratorHistoryItem { ) : GeneratorHistoryItem {

View File

@ -5,7 +5,7 @@ import androidx.compose.ui.text.AnnotatedString
import arrow.optics.optics import arrow.optics.optics
import com.artemchep.keyguard.feature.home.vault.model.VaultItemIcon import com.artemchep.keyguard.feature.home.vault.model.VaultItemIcon
import com.artemchep.keyguard.ui.FlatItemAction import com.artemchep.keyguard.ui.FlatItemAction
import java.util.UUID import kotlin.uuid.Uuid
@optics @optics
sealed interface AccountItem { sealed interface AccountItem {
@ -15,7 +15,7 @@ sealed interface AccountItem {
@optics @optics
data class Section( data class Section(
override val id: String = UUID.randomUUID().toString(), override val id: String = Uuid.random().toString(),
val text: String? = null, val text: String? = null,
) : AccountItem { ) : AccountItem {
companion object companion object

View File

@ -11,7 +11,7 @@ import com.artemchep.keyguard.ui.icons.icon
import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.flow.flowOf
import org.kodein.di.DirectDI import org.kodein.di.DirectDI
import org.kodein.di.instance import org.kodein.di.instance
import java.util.UUID import kotlin.uuid.Uuid
fun settingEmitMessageProvider( fun settingEmitMessageProvider(
directDI: DirectDI, directDI: DirectDI,
@ -31,7 +31,7 @@ fun settingEmitMessageProvider(
val model = ToastMessage( val model = ToastMessage(
title = "Test message", title = "Test message",
type = type, type = type,
text = UUID.randomUUID().toString(), text = Uuid.random().toString(),
) )
showMessage.copy(model) showMessage.copy(model)
}, },

View File

@ -19,7 +19,7 @@ import com.artemchep.keyguard.ui.icons.icon
import kotlinx.coroutines.flow.flow import kotlinx.coroutines.flow.flow
import org.kodein.di.DirectDI import org.kodein.di.DirectDI
import org.kodein.di.instance import org.kodein.di.instance
import java.util.UUID import kotlin.uuid.Uuid
fun settingLaunchAppPicker( fun settingLaunchAppPicker(
directDI: DirectDI, directDI: DirectDI,
@ -39,7 +39,7 @@ fun settingLaunchAppPicker(
if (result is AppPickerResult.Confirm) { if (result is AppPickerResult.Confirm) {
val model = ToastMessage( val model = ToastMessage(
title = result.uri, title = result.uri,
text = UUID.randomUUID().toString(), text = Uuid.random().toString(),
) )
showMessage.copy(model) showMessage.copy(model)
} }

View File

@ -178,7 +178,7 @@ import org.kodein.di.compose.localDI
import org.kodein.di.direct import org.kodein.di.direct
import org.kodein.di.instance import org.kodein.di.instance
import java.io.Serializable import java.io.Serializable
import java.util.UUID import kotlin.uuid.Uuid
// TODO: Support hide password option // TODO: Support hide password option
@Composable @Composable
@ -468,7 +468,7 @@ fun produceAddScreenState(
if (info != null) { if (info != null) {
val model = SkeletonAttachment.Local( val model = SkeletonAttachment.Local(
identity = SkeletonAttachment.Local.Identity( identity = SkeletonAttachment.Local.Identity(
id = UUID.randomUUID().toString(), id = Uuid.random().toString(),
uri = info.uri, uri = info.uri,
size = info.size, size = info.size,
), ),
@ -1593,7 +1593,7 @@ suspend fun <T, Argument> RememberStateFlowScope.foo3(
val initialState = Foo2InitialState( val initialState = Foo2InitialState(
items = initial items = initial
.associateBy { .associateBy {
UUID.randomUUID().toString() Uuid.random().toString()
} }
.map { entry -> .map { entry ->
Foo2InitialState.Item( Foo2InitialState.Item(
@ -1760,7 +1760,7 @@ suspend fun <T, Argument> RememberStateFlowScope.foo(
} }
fun add(type: String, arg: Argument?) { fun add(type: String, arg: Argument?) {
val key = "$scope.items." + UUID.randomUUID().toString() val key = "$scope.items." + Uuid.random().toString()
// Remember the argument, so we can grab it and construct something // Remember the argument, so we can grab it and construct something
// persistent from it. // persistent from it.
if (arg != null) { if (arg != null) {

View File

@ -35,7 +35,7 @@ import kotlinx.coroutines.flow.shareIn
import org.kodein.di.compose.localDI import org.kodein.di.compose.localDI
import org.kodein.di.direct import org.kodein.di.direct
import org.kodein.di.instance import org.kodein.di.instance
import java.util.UUID import kotlin.uuid.Uuid
@Composable @Composable
fun collectionsScreenState( fun collectionsScreenState(
@ -358,7 +358,7 @@ private class OrganizationDecorator : Decorator {
lastOrganization = organization lastOrganization = organization
if (organization != null) { if (organization != null) {
val itemKey = if (organization.id in seenOrganizationIds) { val itemKey = if (organization.id in seenOrganizationIds) {
val randomId = UUID.randomUUID().toString() val randomId = Uuid.random().toString()
"duplicate.$randomId" "duplicate.$randomId"
} else { } else {
organization.id organization.id

View File

@ -18,7 +18,7 @@ import com.artemchep.keyguard.ui.icons.AccentColors
import kotlinx.collections.immutable.ImmutableList import kotlinx.collections.immutable.ImmutableList
import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.StateFlow
import kotlinx.datetime.Instant import kotlinx.datetime.Instant
import java.util.UUID import kotlin.uuid.Uuid
@Immutable @Immutable
@optics @optics
@ -35,7 +35,7 @@ sealed interface VaultItem2 {
companion object; companion object;
data class Item( data class Item(
val key: String = UUID.randomUUID().toString(), val key: String = Uuid.random().toString(),
val leading: (@Composable () -> Unit)? = null, val leading: (@Composable () -> Unit)? = null,
val imageVector: ImageVector? = null, val imageVector: ImageVector? = null,
val title: String, val title: String,
@ -67,7 +67,7 @@ sealed interface VaultItem2 {
@Immutable @Immutable
data class Section( data class Section(
override val id: String = UUID.randomUUID().toString(), override val id: String = Uuid.random().toString(),
val text: TextHolder? = null, val text: TextHolder? = null,
val caps: Boolean = true, val caps: Boolean = true,
) : VaultItem2 { ) : VaultItem2 {

View File

@ -4,7 +4,7 @@ import androidx.compose.runtime.Immutable
import androidx.compose.ui.text.AnnotatedString import androidx.compose.ui.text.AnnotatedString
import arrow.optics.optics import arrow.optics.optics
import com.artemchep.keyguard.common.service.logging.LogLevel import com.artemchep.keyguard.common.service.logging.LogLevel
import java.util.UUID import kotlin.uuid.Uuid
@Immutable @Immutable
@optics @optics
@ -15,7 +15,7 @@ sealed interface LogsItem {
@Immutable @Immutable
data class Section( data class Section(
override val id: String = UUID.randomUUID().toString(), override val id: String = Uuid.random().toString(),
val text: String? = null, val text: String? = null,
val caps: Boolean = true, val caps: Boolean = true,
) : LogsItem { ) : LogsItem {

View File

@ -18,7 +18,7 @@ import kotlinx.coroutines.launch
import kotlinx.coroutines.plus import kotlinx.coroutines.plus
import kotlinx.coroutines.suspendCancellableCoroutine import kotlinx.coroutines.suspendCancellableCoroutine
import kotlinx.coroutines.withContext import kotlinx.coroutines.withContext
import java.util.UUID import kotlin.uuid.Uuid
interface NavigationEntry : BackPressInterceptorHost { interface NavigationEntry : BackPressInterceptorHost {
companion object { companion object {
@ -83,7 +83,7 @@ data class NavigationEntryImpl(
override fun interceptBackPress( override fun interceptBackPress(
block: () -> Unit, block: () -> Unit,
): () -> Unit { ): () -> Unit {
val id = UUID.randomUUID().toString() val id = Uuid.random().toString()
val entry = BackPressInterceptorRegistration( val entry = BackPressInterceptorRegistration(
id = id, id = id,
block = block, block = block,

View File

@ -14,7 +14,7 @@ import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.flow.flatMapLatest import kotlinx.coroutines.flow.flatMapLatest
import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.flow.flowOf
import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.map
import java.util.UUID import kotlin.uuid.Uuid
@Composable @Composable
fun NavigationRouter( fun NavigationRouter(
@ -295,7 +295,7 @@ private fun NavigationIntentScope.exec(
val r = intent.route val r = intent.route
val e = NavigationEntryImpl( val e = NavigationEntryImpl(
source = "router", source = "router",
id = UUID.randomUUID().toString(), id = Uuid.random().toString(),
parent = scope, parent = scope,
route = r, route = r,
) )
@ -308,7 +308,7 @@ private fun NavigationIntentScope.exec(
val r = intent.route val r = intent.route
val e = NavigationEntryImpl( val e = NavigationEntryImpl(
source = "router", source = "router",
id = UUID.randomUUID().toString(), id = Uuid.random().toString(),
parent = scope, parent = scope,
route = r, route = r,
) )
@ -343,7 +343,7 @@ private fun NavigationIntentScope.exec(
val factory = fun(route: Route): NavigationEntry = val factory = fun(route: Route): NavigationEntry =
NavigationEntryImpl( NavigationEntryImpl(
source = "router", source = "router",
id = UUID.randomUUID().toString(), id = Uuid.random().toString(),
parent = scope, parent = scope,
route = route, route = route,
) )

View File

@ -7,7 +7,7 @@ import androidx.compose.runtime.remember
import kotlinx.collections.immutable.PersistentMap import kotlinx.collections.immutable.PersistentMap
import kotlinx.collections.immutable.persistentMapOf import kotlinx.collections.immutable.persistentMapOf
import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.MutableStateFlow
import java.util.UUID import kotlin.uuid.Uuid
/** /**
* A definition of the distinct application component that * A definition of the distinct application component that
@ -48,7 +48,7 @@ class BackHandler(
controller: NavigationController, controller: NavigationController,
backStack: List<NavigationEntry>, backStack: List<NavigationEntry>,
): () -> Unit { ): () -> Unit {
val id = UUID.randomUUID().toString() val id = Uuid.random().toString()
eek.value = eek.value.put( eek.value = eek.value.put(
key = id, key = id,
value = Entry( value = Entry(
@ -67,7 +67,7 @@ class BackHandler(
onBack: () -> Unit, onBack: () -> Unit,
priority: Int, priority: Int,
): () -> Unit { ): () -> Unit {
val id = UUID.randomUUID().toString() val id = Uuid.random().toString()
eek2.value = eek2.value.put( eek2.value = eek2.value.put(
key = id, key = id,
value = Entry2( value = Entry2(

View File

@ -9,7 +9,7 @@ import com.artemchep.keyguard.feature.attachments.SelectableItemState
import com.artemchep.keyguard.feature.home.vault.model.VaultItemIcon import com.artemchep.keyguard.feature.home.vault.model.VaultItemIcon
import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.StateFlow
import kotlinx.datetime.Instant import kotlinx.datetime.Instant
import java.util.UUID import kotlin.uuid.Uuid
@Immutable @Immutable
@optics @optics
@ -20,7 +20,7 @@ sealed interface SendItem {
@Immutable @Immutable
data class Section( data class Section(
override val id: String = UUID.randomUUID().toString(), override val id: String = Uuid.random().toString(),
val text: String? = null, val text: String? = null,
val caps: Boolean = true, val caps: Boolean = true,
) : SendItem { ) : SendItem {

View File

@ -6,7 +6,7 @@ import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.mutableStateMapOf import androidx.compose.runtime.mutableStateMapOf
import androidx.compose.runtime.staticCompositionLocalOf import androidx.compose.runtime.staticCompositionLocalOf
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
import java.util.UUID import kotlin.uuid.Uuid
class BackgroundManager { class BackgroundManager {
private val surfaceColorsState = mutableStateMapOf<String, Color>() private val surfaceColorsState = mutableStateMapOf<String, Color>()
@ -42,7 +42,7 @@ class BackgroundManager {
fun register( fun register(
color: Color, color: Color,
): () -> Unit { ): () -> Unit {
val key = UUID.randomUUID().toString() val key = Uuid.random().toString()
surfaceColorsState[key] = color surfaceColorsState[key] = color
return { return {

View File

@ -9,7 +9,7 @@ import androidx.compose.ui.text.withStyle
import com.artemchep.keyguard.feature.navigation.state.TranslatorScope import com.artemchep.keyguard.feature.navigation.state.TranslatorScope
import org.jetbrains.compose.resources.StringResource import org.jetbrains.compose.resources.StringResource
import org.jetbrains.compose.resources.stringResource import org.jetbrains.compose.resources.stringResource
import java.util.UUID import kotlin.uuid.Uuid
@Composable @Composable
fun annotatedResource( fun annotatedResource(
@ -20,7 +20,7 @@ fun annotatedResource(
// arguments. Later, we will replace those with // arguments. Later, we will replace those with
// actual values. // actual values.
val placeholders = remember { val placeholders = remember {
Array(args.size) { UUID.randomUUID().toString() } Array(args.size) { Uuid.random().toString() }
} }
val value = stringResource(resource, *placeholders) val value = stringResource(resource, *placeholders)
return remember(value) { return remember(value) {
@ -40,7 +40,7 @@ suspend fun TranslatorScope.annotate(
// arguments. Later, we will replace those with // arguments. Later, we will replace those with
// actual values. // actual values.
val placeholders = val placeholders =
Array(args.size) { UUID.randomUUID().toString() } Array(args.size) { Uuid.random().toString() }
val value = translate(resource, *placeholders) val value = translate(resource, *placeholders)
return rebuild( return rebuild(
value, value,

View File

@ -10,9 +10,9 @@ import org.bouncycastle.crypto.generators.Argon2BytesGenerator
import org.bouncycastle.crypto.params.Argon2Parameters import org.bouncycastle.crypto.params.Argon2Parameters
import java.security.MessageDigest import java.security.MessageDigest
import java.security.SecureRandom import java.security.SecureRandom
import java.util.UUID
import javax.crypto.Mac import javax.crypto.Mac
import javax.crypto.spec.SecretKeySpec import javax.crypto.spec.SecretKeySpec
import kotlin.uuid.Uuid
class CryptoGeneratorJvm() : CryptoGenerator { class CryptoGeneratorJvm() : CryptoGenerator {
companion object { companion object {
@ -92,7 +92,7 @@ class CryptoGeneratorJvm() : CryptoGenerator {
return md.digest() return md.digest()
} }
override fun uuid(): String = UUID.randomUUID().toString() override fun uuid(): String = Uuid.random().toString()
override fun random(): Int = secureRandom.nextInt() override fun random(): Int = secureRandom.nextInt()

View File

@ -72,7 +72,7 @@ kdrag0nColorKt = "1.0.5"
# https://github.com/Kodein-Framework/Kodein-DI # https://github.com/Kodein-Framework/Kodein-DI
kodeinDi = "7.22.0" kodeinDi = "7.22.0"
# https://github.com/JetBrains/kotlin # https://github.com/JetBrains/kotlin
kotlin = "2.0.10" kotlin = "2.0.20"
# https://github.com/Kotlin/kotlinx.collections.immutable # https://github.com/Kotlin/kotlinx.collections.immutable
kotlinCollections = "0.3.7" kotlinCollections = "0.3.7"
# https://github.com/Kotlin/kotlinx.coroutines # https://github.com/Kotlin/kotlinx.coroutines
@ -81,9 +81,9 @@ kotlinCoroutines = "1.8.1"
kotlinDatetime = "0.6.1" kotlinDatetime = "0.6.1"
kotlinDsl = "4.3.0" kotlinDsl = "4.3.0"
# https://github.com/Kotlin/kotlinx.serialization # https://github.com/Kotlin/kotlinx.serialization
kotlinSerialization = "1.7.1" kotlinSerialization = "1.7.2"
# https://github.com/google/ksp/releases # https://github.com/google/ksp/releases
kspPlugin = "2.0.10-1.0.24" kspPlugin = "2.0.20-1.0.24"
# https://github.com/pinterest/ktlint/releases # https://github.com/pinterest/ktlint/releases
# @keep # @keep
ktlint = "0.50.0" ktlint = "0.50.0"