diff --git a/CHANGELOG.md b/CHANGELOG.md index 7837698..58da769 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ (All dates are DD.MM.YYYY) #### 0.8.4-SNAPSHOT +- Bump to kotlin 1.5.21 +- Libsodium.js bump to 0.7.9 +- Removed bintray/jcenter repositories #### 0.8.3 - 28.5.2021 - Built with kotlin 1.5.10 diff --git a/build.gradle.kts b/build.gradle.kts index cdadcc4..140f2df 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -20,11 +20,8 @@ buildscript { repositories { mavenCentral() google() - maven ("https://kotlin.bintray.com/kotlinx") - maven ("https://dl.bintray.com/kotlin/kotlin-eap") - maven ("https://dl.bintray.com/kotlin/kotlin-dev") gradlePluginPortal() - jcenter() + } dependencies { @@ -39,10 +36,6 @@ allprojects { repositories { mavenCentral() google() - maven ("https://kotlin.bintray.com/kotlinx") - maven ("https://dl.bintray.com/kotlin/kotlin-eap") - maven ("https://dl.bintray.com/kotlin/kotlin-dev") - jcenter() maven { url = uri("https://oss.sonatype.org/content/repositories/snapshots") } diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index b6a536a..04f0628 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -24,9 +24,6 @@ plugins { repositories { mavenCentral() - maven ("https://dl.bintray.com/kotlin/kotlin-eap") - maven("https://dl.bintray.com/kotlin/kotlin-dev") - jcenter() google() } diff --git a/buildSrc/src/main/kotlin/Deps.kt b/buildSrc/src/main/kotlin/Deps.kt index 4e7934a..a8fd195 100644 --- a/buildSrc/src/main/kotlin/Deps.kt +++ b/buildSrc/src/main/kotlin/Deps.kt @@ -16,12 +16,12 @@ object Versions { val kotlinCoroutines = "1.5.0-native-mt" - val kotlin = "1.5.10" + val kotlin = "1.5.21" val kotlinSerialization = "1.0.1" val kotlinSerializationPlugin = "1.5.10" val atomicfu = "0.14.3-M2-2-SNAPSHOT" //NOTE: my linux arm32 and arm64 build val nodePlugin = "1.3.0" - val dokkaPlugin = "1.4.0-rc" + val dokkaPlugin = "1.5.0" val taskTreePlugin = "1.5" val kotlinBigNumVersion = "0.2.8" val jna = "5.7.0" @@ -31,7 +31,7 @@ object Versions { val timber = "4.7.1" val kodeinVersion = "7.1.0" - val resourceLoader = "1.3.10" + val resourceLoader = "2.0.1" @@ -67,10 +67,10 @@ object Deps { object Js { object JsVersions { - val react = "16.13.1-pre.124-kotlin-1.4.10" - val reactNpm = "16.13.1" - val styled = "5.2.0-pre.124-kotlin-1.4.10" - val styledNpm = "1.0.0" + val react = "17.0.2-pre.218-kotlin-1.5.21" + val reactNpm = "17.0.2" + val styled = "5.3.0-pre.218-kotlin-1.5.21" + val styledNpm = "5.3.0" } @@ -83,21 +83,11 @@ object Deps { val ktorClientSerialization = "io.ktor:ktor-client-serialization-js:${Versions.ktor}" val ktorClientWebSockets = "io.ktor:ktor-client-websockets-js:${Versions.ktor}" - object React { - val react = "org.jetbrains:kotlin-react:${JsVersions.react}" - val reactDom = "org.jetbrains:kotlin-react-dom:${JsVersions.react}" - val styled = "org.jetbrains:kotlin-styled:${JsVersions.styled}" - - } - object Npm { - val libsodium = Pair("libsodium-wrappers-sumo", "0.7.8") + val libsodium = Pair("libsodium-wrappers-sumo", "0.7.9") //val libsodiumWrappers = Pair("libsodium-wrappers-sumo", "file:${getProjectPath()}/multiplatform-crypto-delegated/libsodium-wrappers-sumo-0.7.6.tgz") - val libsodiumWrappers = Pair("libsodium-wrappers-sumo", "0.7.8") - val reactPair = Pair("react", JsVersions.reactNpm) - val reactDomPair = Pair("react-dom", JsVersions.reactNpm) - val styledComponentsPair = Pair("styled-components", "5.2.0") - val inlineStylePrefixesPair = Pair("inline-style-prefixer", "6.0.0") + val libsodiumWrappers = Pair("libsodium-wrappers-sumo", "0.7.9") + } } @@ -114,7 +104,7 @@ object Deps { val kotlinPoet = "com.squareup:kotlinpoet:${Versions.kotlinPoet}" - val resourceLoader = "co.libly:resource-loader:${Versions.resourceLoader}" + val resourceLoader = "com.goterl:resource-loader:${Versions.resourceLoader}" object Delegated { val jna = "net.java.dev.jna:jna:${Versions.jna}" diff --git a/gradle.properties b/gradle.properties index 7f02a10..30499d4 100644 --- a/gradle.properties +++ b/gradle.properties @@ -24,3 +24,5 @@ kotlin.native.disableCompilerDaemon=true org.gradle.jvmargs=-Xmx4g -XX:MaxPermSize=4096m android.useAndroidX=true + +kotlin.js.webpack.major.version=4 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 8e234f9..0b86c83 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -16,6 +16,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/multiplatform-crypto-api/build.gradle.kts b/multiplatform-crypto-api/build.gradle.kts index 7eb6f8c..aa0ecdf 100644 --- a/multiplatform-crypto-api/build.gradle.kts +++ b/multiplatform-crypto-api/build.gradle.kts @@ -30,8 +30,6 @@ plugins { repositories { mavenCentral() - jcenter() - } group = ReleaseInfo.group version = ReleaseInfo.version diff --git a/multiplatform-crypto-libsodium-bindings/build.gradle.kts b/multiplatform-crypto-libsodium-bindings/build.gradle.kts index fcc6657..e516a6c 100644 --- a/multiplatform-crypto-libsodium-bindings/build.gradle.kts +++ b/multiplatform-crypto-libsodium-bindings/build.gradle.kts @@ -47,7 +47,6 @@ val sonatypeUsernameEnv: String? = System.getenv()["SONATYPE_USERNAME"] repositories { mavenCentral() - jcenter() maven { url = uri("https://oss.sonatype.org/content/repositories/snapshots") } @@ -89,9 +88,11 @@ kotlin { } jvm() + val projectRef = project runningOnLinuxx86_64 { println("Configuring Linux X86-64 targets") + js(IR) { browser { testTask { @@ -112,11 +113,11 @@ kotlin { linuxX64() { compilations.getByName("main") { val libsodiumCinterop by cinterops.creating { - defFile(project.file("src/nativeInterop/cinterop/libsodium.def")) - compilerOpts.add("-I${project.rootDir}/sodiumWrapper/static-linux-x86-64/include/") + defFile(projectRef.file("src/nativeInterop/cinterop/libsodium.def")) + compilerOpts.add("-I${projectRef.rootDir}/sodiumWrapper/static-linux-x86-64/include/") } kotlinOptions.freeCompilerArgs = listOf( - "-include-binary", "${project.rootDir}/sodiumWrapper/static-linux-x86-64/lib/libsodium.a" + "-include-binary", "${projectRef.rootDir}/sodiumWrapper/static-linux-x86-64/lib/libsodium.a" ) } binaries { @@ -185,11 +186,11 @@ kotlin { } compilations.getByName("main") { val libsodiumCinterop by cinterops.creating { - defFile(project.file("src/nativeInterop/cinterop/libsodium.def")) - compilerOpts.add("-I${project.rootDir}/sodiumWrapper/static-macos-x86-64/include") + defFile(projectRef.file("src/nativeInterop/cinterop/libsodium.def")) + compilerOpts.add("-I${projectRef.rootDir}/sodiumWrapper/static-macos-x86-64/include") } kotlinOptions.freeCompilerArgs = listOf( - "-include-binary", "${project.rootDir}/sodiumWrapper/static-macos-x86-64/lib/libsodium.a" + "-include-binary", "${projectRef.rootDir}/sodiumWrapper/static-macos-x86-64/lib/libsodium.a" ) } } @@ -241,11 +242,11 @@ kotlin { } compilations.getByName("main") { val libsodiumCinterop by cinterops.creating { - defFile(project.file("src/nativeInterop/cinterop/libsodium.def")) - compilerOpts.add("-I${project.rootDir}/sodiumWrapper/static-mingw-x86-64/include") + defFile(projectRef.file("src/nativeInterop/cinterop/libsodium.def")) + compilerOpts.add("-I${projectRef.rootDir}/sodiumWrapper/static-mingw-x86-64/include") } kotlinOptions.freeCompilerArgs = listOf( - "-include-binary", "${project.rootDir}/sodiumWrapper/static-mingw-x86-64/lib/libsodium.a" + "-include-binary", "${projectRef.rootDir}/sodiumWrapper/static-mingw-x86-64/lib/libsodium.a" ) } } @@ -351,11 +352,11 @@ kotlin { compilations.getByName("main") { val libsodiumCinterop by cinterops.creating { - defFile(project.file("src/nativeInterop/cinterop/libsodium.def")) - compilerOpts.add("-I${project.rootDir}/sodiumWrapper/static-arm64/include/") + defFile(projectRef.file("src/nativeInterop/cinterop/libsodium.def")) + compilerOpts.add("-I${projectRef.rootDir}/sodiumWrapper/static-arm64/include/") } kotlinOptions.freeCompilerArgs = listOf( - "-include-binary", "${project.rootDir}/sodiumWrapper/static-arm64/lib/libsodium.a" + "-include-binary", "${projectRef.rootDir}/sodiumWrapper/static-arm64/lib/libsodium.a" ) } } @@ -370,11 +371,11 @@ kotlin { defaultSourceSet.dependsOn(createWorkaroundNativeMainSourceSet(this@withType.name, nativeDependencies)) println("Setting ios cinterop for $this") val libsodiumCinterop by cinterops.creating { - defFile(project.file("src/nativeInterop/cinterop/libsodium.def")) - compilerOpts.add("-I${project.rootDir}/sodiumWrapper/static-ios/include") + defFile(projectRef.file("src/nativeInterop/cinterop/libsodium.def")) + compilerOpts.add("-I${projectRef.rootDir}/sodiumWrapper/static-ios/include") } kotlinOptions.freeCompilerArgs = listOf( - "-include-binary", "${project.rootDir}/sodiumWrapper/static-ios/lib/libsodium.a" + "-include-binary", "${projectRef.rootDir}/sodiumWrapper/static-ios/lib/libsodium.a" ) } @@ -382,11 +383,11 @@ kotlin { defaultSourceSet.dependsOn(createWorkaroundNativeMainSourceSet(this@withType.name, nativeDependencies)) println("Setting ios cinterop for $this") val libsodiumCinterop by cinterops.creating { - defFile(project.file("src/nativeInterop/cinterop/libsodium.def")) - compilerOpts.add("-I${project.rootDir}/sodiumWrapper/static-ios-simulators/include") + defFile(projectRef.file("src/nativeInterop/cinterop/libsodium.def")) + compilerOpts.add("-I${projectRef.rootDir}/sodiumWrapper/static-ios-simulators/include") } kotlinOptions.freeCompilerArgs = listOf( - "-include-binary", "${project.rootDir}/sodiumWrapper/static-ios-simulators/lib/libsodium.a" + "-include-binary", "${projectRef.rootDir}/sodiumWrapper/static-ios-simulators/lib/libsodium.a" ) } @@ -394,11 +395,11 @@ kotlin { defaultSourceSet.dependsOn(createWorkaroundNativeMainSourceSet(this@withType.name, nativeDependencies)) println("Setting ios cinterop for $this") val libsodiumCinterop by cinterops.creating { - defFile(project.file("src/nativeInterop/cinterop/libsodium.def")) - compilerOpts.add("-I${project.rootDir}/sodiumWrapper/static-tvos/include") + defFile(projectRef.file("src/nativeInterop/cinterop/libsodium.def")) + compilerOpts.add("-I${projectRef.rootDir}/sodiumWrapper/static-tvos/include") } kotlinOptions.freeCompilerArgs = listOf( - "-include-binary", "${project.rootDir}/sodiumWrapper/static-tvos/lib/libsodium.a" + "-include-binary", "${projectRef.rootDir}/sodiumWrapper/static-tvos/lib/libsodium.a" ) } @@ -406,11 +407,11 @@ kotlin { defaultSourceSet.dependsOn(createWorkaroundNativeMainSourceSet(this@withType.name, nativeDependencies)) println("Setting ios cinterop for $this") val libsodiumCinterop by cinterops.creating { - defFile(project.file("src/nativeInterop/cinterop/libsodium.def")) - compilerOpts.add("-I${project.rootDir}/sodiumWrapper/static-tvos-simulators/include") + defFile(projectRef.file("src/nativeInterop/cinterop/libsodium.def")) + compilerOpts.add("-I${projectRef.rootDir}/sodiumWrapper/static-tvos-simulators/include") } kotlinOptions.freeCompilerArgs = listOf( - "-include-binary", "${project.rootDir}/sodiumWrapper/static-tvos-simulators/lib/libsodium.a" + "-include-binary", "${projectRef.rootDir}/sodiumWrapper/static-tvos-simulators/lib/libsodium.a" ) } @@ -418,11 +419,11 @@ kotlin { defaultSourceSet.dependsOn(createWorkaroundNativeMainSourceSet(this@withType.name, nativeDependencies)) println("Setting ios cinterop for $this") val libsodiumCinterop by cinterops.creating { - defFile(project.file("src/nativeInterop/cinterop/libsodium.def")) - compilerOpts.add("-I${project.rootDir}/sodiumWrapper/static-watchos/include") + defFile(projectRef.file("src/nativeInterop/cinterop/libsodium.def")) + compilerOpts.add("-I${projectRef.rootDir}/sodiumWrapper/static-watchos/include") } kotlinOptions.freeCompilerArgs = listOf( - "-include-binary", "${project.rootDir}/sodiumWrapper/static-watchos/lib/libsodium.a" + "-include-binary", "${projectRef.rootDir}/sodiumWrapper/static-watchos/lib/libsodium.a" ) } @@ -430,11 +431,11 @@ kotlin { defaultSourceSet.dependsOn(createWorkaroundNativeMainSourceSet(this@withType.name, nativeDependencies)) println("Setting ios cinterop for $this") val libsodiumCinterop by cinterops.creating { - defFile(project.file("src/nativeInterop/cinterop/libsodium.def")) - compilerOpts.add("-I${project.rootDir}/sodiumWrapper/static-watchos-simulators/include") + defFile(projectRef.file("src/nativeInterop/cinterop/libsodium.def")) + compilerOpts.add("-I${projectRef.rootDir}/sodiumWrapper/static-watchos-simulators/include") } kotlinOptions.freeCompilerArgs = listOf( - "-include-binary", "${project.rootDir}/sodiumWrapper/static-watchos-simulators/lib/libsodium.a" + "-include-binary", "${projectRef.rootDir}/sodiumWrapper/static-watchos-simulators/lib/libsodium.a" ) } @@ -602,21 +603,19 @@ tasks { - dokkaJavadoc { + + create("javadocJar") { + dependsOn(dokkaHtml) + archiveClassifier.set("javadoc") + from(dokkaHtml.get().outputDirectory) + } + + dokkaHtml { println("Dokka !") dokkaSourceSets { - create("commonMain") { - displayName = "common" - platform = "common" - } } } - create("javadocJar") { - dependsOn(dokkaJavadoc) - archiveClassifier.set("javadoc") - from(dokkaJavadoc.get().outputDirectory) - } if (getHostOsName() == "linux" && getHostArchitecture() == "x86-64") { val jvmTest by getting(Test::class) { testLogging { @@ -753,18 +752,5 @@ publishing { } } -//configurations.forEach { -// -// if (it.name == "linuxCompileKlibraries") { -// println("Configuration name: ${it.name}") -// it.attributes { -// this.keySet().forEach { key -> -// val attribute = getAttribute(key) -// println(" |-- Attribute $key ${attribute}") -// attribute(org.jetbrains.kotlin.gradle.plugin.ProjectLocalConfigurations.ATTRIBUTE, "publicZ") -// } -// } -// } -//} diff --git a/multiplatform-crypto-libsodium-bindings/src/commonTest/kotlin/com/ionspin/kotlin/crypto/box/BoxTest.kt b/multiplatform-crypto-libsodium-bindings/src/commonTest/kotlin/com/ionspin/kotlin/crypto/box/BoxTest.kt index fdc5929..c3722cd 100644 --- a/multiplatform-crypto-libsodium-bindings/src/commonTest/kotlin/com/ionspin/kotlin/crypto/box/BoxTest.kt +++ b/multiplatform-crypto-libsodium-bindings/src/commonTest/kotlin/com/ionspin/kotlin/crypto/box/BoxTest.kt @@ -44,6 +44,8 @@ class BoxTest { assertFailsWith() { val tampered = encrypted.copyOf() tampered[1] = 0U + tampered[2] = 0U + tampered[3] = 0U Box.openEasy(tampered, messageNonce, senderKeypair.publicKey, recipientKeypair.secretKey) } } @@ -71,6 +73,8 @@ class BoxTest { assertFailsWith() { val tampered = encrypted.ciphertext.copyOf() tampered[1] = 0U + tampered[2] = 0U + tampered[3] = 0U Box.openDetached( tampered, encrypted.tag, @@ -104,6 +108,8 @@ class BoxTest { assertFailsWith() { val tampered = encrypted.copyOf() tampered[1] = 0U + tampered[2] = 0U + tampered[3] = 0U Box.openEasyAfterNM(tampered, messageNonce, recipientComputedSessionKey) } } @@ -124,6 +130,8 @@ class BoxTest { assertFailsWith() { val tampered = sealed.copyOf() tampered[1] = 0U + tampered[2] = 0U + tampered[3] = 0U Box.sealOpen(tampered, recipientKeypair.publicKey, recipientKeypair.secretKey) } } diff --git a/multiplatform-crypto-libsodium-bindings/src/jvmMain/kotlin/com/ionspin/kotlin/crypto/LibsodiumInitializer.kt b/multiplatform-crypto-libsodium-bindings/src/jvmMain/kotlin/com/ionspin/kotlin/crypto/LibsodiumInitializer.kt index 911a32d..ca1c16d 100644 --- a/multiplatform-crypto-libsodium-bindings/src/jvmMain/kotlin/com/ionspin/kotlin/crypto/LibsodiumInitializer.kt +++ b/multiplatform-crypto-libsodium-bindings/src/jvmMain/kotlin/com/ionspin/kotlin/crypto/LibsodiumInitializer.kt @@ -1,7 +1,6 @@ package com.ionspin.kotlin.crypto -import co.libly.resourceloader.FileLoader -import co.libly.resourceloader.SharedLibraryLoader +import com.goterl.resourceloader.SharedLibraryLoader import com.sun.jna.Native import com.sun.jna.Platform import java.io.File diff --git a/sample/build.gradle.kts b/sample/build.gradle.kts index 8bc7009..5245b7a 100644 --- a/sample/build.gradle.kts +++ b/sample/build.gradle.kts @@ -32,7 +32,6 @@ plugins { kotlin(PluginsDeps.kotlinSerializationPlugin) version Versions.kotlinSerializationPlugin } -org.jetbrains.kotlin.gradle.targets.js.npm.NpmResolverPlugin.apply(project) val sonatypeStaging = "https://oss.sonatype.org/service/local/staging/deploy/maven2/" val sonatypeSnapshots = "https://oss.sonatype.org/content/repositories/snapshots/" @@ -41,8 +40,6 @@ val sonatypeSnapshots = "https://oss.sonatype.org/content/repositories/snapshots repositories { mavenCentral() - jcenter() - maven("https://dl.bintray.com/terl/lazysodium-maven") maven("https://oss.sonatype.org/content/repositories/snapshots/") } @@ -82,7 +79,7 @@ kotlin { } } -// binaries.executable() + binaries.executable() } @@ -205,11 +202,7 @@ kotlin { implementation("androidx.core:core-ktx:1.3.2") implementation("androidx.constraintlayout:constraintlayout:2.0.2") implementation("com.google.android.material:material:1.3.0-alpha03") -// implementation("androidx.ui:ui-tooling:$composeDevVersion") -// implementation("androidx.ui:ui-layout:$composeDevVersion") -// implementation("androidx.ui:ui-material:$composeDevVersion") -// implementation("androidx.ui:ui-foundation:$composeDevVersion") -// implementation("androidx.ui:ui-framework:$composeDevVersion") + implementation(Deps.Android.coroutines) implementation(Deps.Android.timber) // implementation("androidx.compose:compose-runtime:$composeDevVersion") @@ -244,7 +237,7 @@ kotlin { val nativeMain by getting { dependsOn(commonMain) dependencies { - implementation(Deps.Desktop.libui) + } } nativeMain @@ -252,7 +245,7 @@ kotlin { val nativeMain by creating { dependsOn(commonMain) dependencies { - implementation(Deps.Desktop.libui) + } } nativeMain @@ -296,17 +289,6 @@ kotlin { implementation(kotlin(Deps.Js.stdLib)) implementation(Deps.Js.coroutines) - // React - implementation(Deps.Js.React.react) - implementation(Deps.Js.React.reactDom) - implementation(npm(Deps.Js.Npm.reactPair.first, Deps.Js.Npm.reactPair.second)) - implementation(npm(Deps.Js.Npm.reactDomPair.first, Deps.Js.Npm.reactDomPair.second)) - - // Styled - implementation(Deps.Js.React.styled) - implementation(npm(Deps.Js.Npm.styledComponentsPair.first, Deps.Js.Npm.styledComponentsPair.second)) - implementation(npm(Deps.Js.Npm.inlineStylePrefixesPair.first, Deps.Js.Npm.inlineStylePrefixesPair.second)) - } } val jsTest by getting { @@ -481,12 +463,12 @@ tasks { } } - val jsNodeTest by getting(KotlinJsTest::class) { - testLogging { - events("PASSED", "FAILED", "SKIPPED") - showStandardStreams = true - } - } +// val jsNodeTest by getting(KotlinJsTest::class) { +// testLogging { +// events("PASSED", "FAILED", "SKIPPED") +// showStandardStreams = true +// } +// } } diff --git a/sample/src/jsMain/kotlin/com/ionspin/kotlin/crypto/sample/App.kt b/sample/src/jsMain/kotlin/com/ionspin/kotlin/crypto/sample/App.kt index f626f89..e69de29 100644 --- a/sample/src/jsMain/kotlin/com/ionspin/kotlin/crypto/sample/App.kt +++ b/sample/src/jsMain/kotlin/com/ionspin/kotlin/crypto/sample/App.kt @@ -1,35 +0,0 @@ -import com.ionspin.kotlin.crypto.hash.Hash -import com.ionspin.kotlin.crypto.util.encodeToUByteArray -import com.ionspin.kotlin.crypto.util.toHexString -import kotlinx.css.br -import react.RBuilder -import react.RComponent -import react.RProps -import react.RState -import react.ReactElement -import react.dom.h1 - -external interface RAppState : RState { - var currentState: String -} - -external interface RAppProps : RProps { - -} - -class App(props: RAppProps) : RComponent(props) { - override fun RBuilder.render() { - val hash = Hash.sha512("123".encodeToUByteArray()) - h1 { - +"Hash (SHA512) of 123: ${hash.toHexString()}" - - } - } - -} - -fun RBuilder.app(handler: RAppProps.() -> Unit): ReactElement { - return child(App::class) { - this.attrs(handler) - } -} diff --git a/sample/src/jsMain/kotlin/com/ionspin/kotlin/crypto/sample/Main.kt b/sample/src/jsMain/kotlin/com/ionspin/kotlin/crypto/sample/Main.kt index f5e426d..ecc9d7b 100644 --- a/sample/src/jsMain/kotlin/com/ionspin/kotlin/crypto/sample/Main.kt +++ b/sample/src/jsMain/kotlin/com/ionspin/kotlin/crypto/sample/Main.kt @@ -2,28 +2,13 @@ import com.ionspin.kotlin.crypto.LibsodiumInitializer import com.ionspin.kotlin.crypto.hash.Hash -import com.ionspin.kotlin.crypto.util.LibsodiumRandom import com.ionspin.kotlin.crypto.util.encodeToUByteArray import com.ionspin.kotlin.crypto.util.toHexString -import react.dom.render -import kotlinx.browser.document -import kotlinx.browser.window fun main() { - val runningOnNode = jsTypeOf(window) == "undefined" -// if (!runningOnNode) = runTest { - LibsodiumInitializer.initializeWithCallback { - render(document.getElementById("root")) { - app { - - } - } - } -// } else = runTest { -// LibsodiumInitializer.initializeWithCallback { -// val hash = Hash.sha512("123".encodeToUByteArray()) -// println("Hash (SHA512) of 123: ${hash.toHexString()}") -// } -// } + LibsodiumInitializer.initializeWithCallback { + val hash = Hash.sha512("123".encodeToUByteArray()) + println("Hash (SHA512) of 123: ${hash.toHexString()}") + } } diff --git a/sample/src/nativeMain/kotlin/Runner.kt b/sample/src/nativeMain/kotlin/Runner.kt index 0630398..5520d1b 100644 --- a/sample/src/nativeMain/kotlin/Runner.kt +++ b/sample/src/nativeMain/kotlin/Runner.kt @@ -2,5 +2,4 @@ import com.ionspin.kotlin.crypto.sample.Sample fun main() : Unit { Sample.runSample() - ui() } diff --git a/sample/src/nativeMain/kotlin/com/ionspin/kotlin/crypto/sample/UI.kt b/sample/src/nativeMain/kotlin/com/ionspin/kotlin/crypto/sample/UI.kt deleted file mode 100644 index 2c84065..0000000 --- a/sample/src/nativeMain/kotlin/com/ionspin/kotlin/crypto/sample/UI.kt +++ /dev/null @@ -1,30 +0,0 @@ -import com.ionspin.kotlin.crypto.hash.Hash -import com.ionspin.kotlin.crypto.util.encodeToUByteArray -import com.ionspin.kotlin.crypto.util.toHexString -import libui.ktx.TextArea -import libui.ktx.appWindow -import libui.ktx.button -import libui.ktx.textarea -import libui.ktx.vbox - -fun ui() = appWindow( - title = "Hello", - width = 320, - height = 240 -) { - val hash = Hash.sha512("123".encodeToUByteArray()) - val text = "Hash (SHA512) of 123: ${hash.toHexString()}" - vbox { - lateinit var scroll: TextArea - - button("Test") { - action { - scroll.append(text.trimMargin()) - } - } - scroll = textarea { - readonly = true - stretchy = true - } - } -} diff --git a/settings.gradle.kts b/settings.gradle.kts index d0a5cf9..8719ca8 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -17,11 +17,7 @@ pluginManagement { repositories { - maven("https://dl.bintray.com/kotlin/kotlin-eap") - maven("https://dl.bintray.com/kotlin/kotlin-dev") - mavenCentral() - maven("https://plugins.gradle.org/m2/") } @@ -33,7 +29,6 @@ pluginManagement { } } } -enableFeaturePreview("GRADLE_METADATA") rootProject.name = "KotlinMultiplatformLibsodium" include("multiplatform-crypto-api") include("multiplatform-crypto-libsodium-bindings")