v0.9.0: kotlin 2.2.21, kotlin.time fix for deprecated methods in kotlinx.datetime. Should work ok on mac/ios
This commit is contained in:
parent
3bd06ac7ff
commit
13dff8d760
5
.idea/misc.xml
generated
5
.idea/misc.xml
generated
@ -1,7 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="corretto-17" project-jdk-type="JavaSDK">
|
||||
<component name="FrameworkDetectionExcludesConfiguration">
|
||||
<file type="web" url="file://$PROJECT_DIR$" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" project-jdk-name="corretto-17" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
||||
@ -2,6 +2,14 @@
|
||||
|
||||
Kotlin Multiplatform cryptographic primitives using modern strong cryptography.
|
||||
|
||||
## v0.9.0 for kotlin 2.2.21, new kotlin time compatible
|
||||
|
||||
The primary goal was to fix kotlin-caused incompatibilities with kotlinx.datetime.Instant and Clock; the upgrade shoud be in-place
|
||||
replacement providing calling code ises `kotlin.time.Instant` and
|
||||
`kotlin.time.Clock` respectively. No other changes are needed.
|
||||
|
||||
Also we start to add small syntax sugar methods.
|
||||
|
||||
## v.0.8.4 is built for all platform, IOS and wasmJS included
|
||||
|
||||
Cryptographic API works exactly the same and compiles to any platform supported listed below with no change in source code.
|
||||
|
||||
@ -13,14 +13,14 @@ import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl
|
||||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
||||
|
||||
plugins {
|
||||
kotlin("multiplatform") version "2.2.20"
|
||||
id("org.jetbrains.kotlin.plugin.serialization") version "2.2.20"
|
||||
kotlin("multiplatform") version "2.2.21"
|
||||
id("org.jetbrains.kotlin.plugin.serialization") version "2.2.21"
|
||||
id("org.jetbrains.dokka") version "1.9.20"
|
||||
`maven-publish`
|
||||
}
|
||||
|
||||
group = "net.sergeych"
|
||||
version = "0.8.5"
|
||||
version = "0.9.0"
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
@ -31,12 +31,8 @@ repositories {
|
||||
}
|
||||
|
||||
kotlin {
|
||||
jvm {
|
||||
@OptIn(ExperimentalKotlinGradlePluginApi::class)
|
||||
compilerOptions {
|
||||
jvmTarget = JvmTarget.JVM_11
|
||||
}
|
||||
}
|
||||
jvmToolchain(21)
|
||||
jvm()
|
||||
js {
|
||||
browser()
|
||||
nodejs()
|
||||
@ -60,18 +56,20 @@ kotlin {
|
||||
languageSettings.optIn("kotlinx.serialization.ExperimentalSerializationApi")
|
||||
languageSettings.optIn("kotlinx.coroutines.ExperimentalCoroutinesApi")
|
||||
languageSettings.optIn("kotlin.ExperimentalUnsignedTypes")
|
||||
languageSettings.optIn("kotlin.time.ExperimentalTime")
|
||||
}
|
||||
|
||||
val commonMain by getting {
|
||||
dependencies {
|
||||
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.1")
|
||||
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.0")
|
||||
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.2")
|
||||
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.9.0")
|
||||
|
||||
implementation("net.sergeych:multiplatform-crypto-libsodium-bindings:0.9.6")
|
||||
implementation(project.dependencies.platform("org.kotlincrypto.hash:bom:0.5.1"))
|
||||
implementation("org.kotlincrypto.hash:sha3")
|
||||
api("com.ionspin.kotlin:bignum:0.3.10")
|
||||
api("net.sergeych:mp_bintools:0.2.2")
|
||||
api("net.sergeych:mp_bintools:0.3.2")
|
||||
|
||||
}
|
||||
}
|
||||
val commonTest by getting {
|
||||
@ -114,6 +112,14 @@ publishing {
|
||||
}
|
||||
}
|
||||
|
||||
tasks.named<Test>("jvmTest") {
|
||||
// Ignore Kotlin synthetic classes generated from files that look like tests
|
||||
exclude("**/*TestKt.class")
|
||||
exclude("**/*TestsKt.class")
|
||||
exclude("**/*AssertThrowsKt.class")
|
||||
exclude("**/*Test_toolsKt.class")
|
||||
}
|
||||
|
||||
tasks.dokkaHtml.configure {
|
||||
outputDirectory.set(buildDir.resolve("dokka"))
|
||||
dokkaSourceSets {
|
||||
|
||||
@ -9,3 +9,7 @@
|
||||
#
|
||||
|
||||
kotlin.code.style=official
|
||||
org.gradle.parallel=true
|
||||
org.gradle.jvmargs=-Xmx4096M -Dfile.encoding=UTF-8
|
||||
org.gradle.configuration-cache=true
|
||||
org.gradle.caching=true
|
||||
|
||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -10,6 +10,6 @@
|
||||
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
@ -60,6 +60,12 @@ sealed class Multikey {
|
||||
*/
|
||||
abstract fun check(keys: Iterable<VerifyingPublicKey>): Boolean
|
||||
|
||||
/**
|
||||
* Step towards automated picking necessary keys.
|
||||
* Return all the keys mentioned in this multikey condition.
|
||||
*/
|
||||
abstract fun mentionedKeys(): Set<VerifyingPublicKey>
|
||||
|
||||
/**
|
||||
* Check that [verifyingKeys] satisfy the multikey condition
|
||||
*/
|
||||
@ -97,6 +103,10 @@ sealed class Multikey {
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
override fun mentionedKeys(): Set<VerifyingPublicKey> {
|
||||
return validKeys
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -119,6 +129,10 @@ sealed class Multikey {
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
override fun mentionedKeys(): Set<VerifyingPublicKey> {
|
||||
return validKeys.flatMap { it.mentionedKeys() }.toSet()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -129,6 +143,7 @@ sealed class Multikey {
|
||||
@Serializable
|
||||
object AnyKey : Multikey() {
|
||||
override fun check(keys: Iterable<VerifyingPublicKey>): Boolean = true
|
||||
override fun mentionedKeys(): Set<VerifyingPublicKey> = emptySet()
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
|
||||
package net.sergeych.crypto2
|
||||
|
||||
import kotlinx.datetime.Instant
|
||||
import kotlin.time.Instant
|
||||
import kotlinx.serialization.Serializable
|
||||
import net.sergeych.bipack.BipackEncoder
|
||||
import net.sergeych.bipack.decodeFromBipack
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
|
||||
package net.sergeych.crypto2
|
||||
|
||||
import kotlinx.datetime.Instant
|
||||
import kotlin.time.Instant
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.Transient
|
||||
import net.sergeych.bipack.BipackDecoder
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
|
||||
package net.sergeych.crypto2
|
||||
|
||||
import kotlinx.datetime.Instant
|
||||
import kotlin.time.Instant
|
||||
|
||||
interface SigningKey: KeyInstance {
|
||||
val verifyingKey: VerifyingPublicKey
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
package net.sergeych.crypto2
|
||||
|
||||
import com.ionspin.kotlin.crypto.signature.Signature
|
||||
import kotlinx.datetime.Instant
|
||||
import kotlin.time.Instant
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.Transient
|
||||
|
||||
@ -12,8 +12,8 @@
|
||||
|
||||
package net.sergeych.utools
|
||||
|
||||
import kotlinx.datetime.Clock
|
||||
import kotlinx.datetime.Instant
|
||||
import kotlin.time.Clock
|
||||
import kotlin.time.Instant
|
||||
|
||||
fun now(): Instant = Clock.System.now()
|
||||
fun nowToSeconds(): Instant = Clock.System.now().truncateToSeconds()
|
||||
|
||||
@ -10,25 +10,17 @@
|
||||
|
||||
import kotlinx.coroutines.flow.asFlow
|
||||
import kotlinx.coroutines.test.runTest
|
||||
import kotlinx.datetime.Clock
|
||||
import kotlin.time.Clock
|
||||
import net.sergeych.crypto2.Hash
|
||||
import net.sergeych.crypto2.initCrypto
|
||||
import kotlin.random.Random
|
||||
import kotlin.random.nextUBytes
|
||||
import kotlin.test.Ignore
|
||||
import kotlin.test.Test
|
||||
import kotlin.test.assertContentEquals
|
||||
import kotlin.test.assertEquals
|
||||
import kotlin.test.assertFalse
|
||||
|
||||
@Suppress("UNUSED_PARAMETER", "UNUSED_VARIABLE")
|
||||
suspend fun <T> sw(label: String, f: suspend () -> T): T {
|
||||
val t1 = Clock.System.now()
|
||||
val result = f()
|
||||
val t2 = Clock.System.now()
|
||||
// println("$label: ${t2 - t1}")
|
||||
return result
|
||||
}
|
||||
|
||||
class HashTest {
|
||||
@Test
|
||||
fun testEqualMethods() {
|
||||
@ -77,3 +69,13 @@ class HashTest {
|
||||
|
||||
}
|
||||
|
||||
@Suppress("UNUSED_PARAMETER", "UNUSED_VARIABLE")
|
||||
suspend fun <T> sw(label: String, f: suspend () -> T): T {
|
||||
val t1 = Clock.System.now()
|
||||
val result = f()
|
||||
val t2 = Clock.System.now()
|
||||
// println("$label: ${t2 - t1}")
|
||||
return result
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
*/
|
||||
|
||||
import kotlinx.coroutines.test.runTest
|
||||
import kotlinx.datetime.Instant
|
||||
import kotlin.time.Instant
|
||||
import net.sergeych.crypto2.initCrypto
|
||||
import net.sergeych.utools.nowToSeconds
|
||||
import net.sergeych.utools.pack
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user