From 0cee223baea49feaeb5ed3d1cd84d67e92736a7b Mon Sep 17 00:00:00 2001 From: Ugljesa Jovanovic Date: Sat, 9 Jan 2021 15:31:03 +0100 Subject: [PATCH 1/7] Update readme 2 --- README.md | 41 ++++++++++++++++------------------------- 1 file changed, 16 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index 4188c2b..8b1e962 100644 --- a/README.md +++ b/README.md @@ -3,15 +3,6 @@ ![Danger: Experimental](https://camo.githubusercontent.com/275bc882f21b154b5537b9c123a171a30de9e6aa/68747470733a2f2f7261772e6769746875622e636f6d2f63727970746f7370686572652f63727970746f7370686572652f6d61737465722f696d616765732f6578706572696d656e74616c2e706e67) -# Kotlin Multiplatform Crypto Library - -This repository contains two cryptography related projects: - -1. Libsodium bindings for Kotiln Multiplatform -2. Pure/Delegated kotlin multiplatform crypto library written from scratch in pure kotlin/delegated to libsodium. [Link to project readme](https://github.com/ionspin/kotlin-multiplatform-crypto/blob/master/multiplatform-crypto-api/README.md) - -This readme represents the libsodium bindings project - # Libsodium bindings for Kotiln Multiplatform Libsodium bindings project uses libsodium c sources, libsodium.js as well as LazySodium Java and Android to provide a kotlin multiplatform wrapper library for libsodium. @@ -116,22 +107,22 @@ At the moment you should refer to original libsodium documentation for instructi Currently supported native platforms: -|Platform|Pure variant| Delegated variant| -|--------|------------|------------------| -|Linux X86 64| :heavy_check_mark: | :heavy_check_mark: | -|Linux Arm 64| :heavy_check_mark: | :heavy_check_mark: | -|Linux Arm 32| :heavy_check_mark: | :x: | -|macOS X86 64| :heavy_check_mark: | :heavy_check_mark: | -|iOS x86 64 | :heavy_check_mark: | :heavy_check_mark: | -|iOS Arm 64 | :heavy_check_mark: | :heavy_check_mark: | -|iOS Arm 32 | :heavy_check_mark: | :heavy_check_mark: | -|watchOS X86 32 | :heavy_check_mark: | :heavy_check_mark: | -|watchOS Arm 64(_32) | :heavy_check_mark: | :heavy_check_mark: | -|watchos Arm 32 | :heavy_check_mark: | :heavy_check_mark: | -|tvOS X86 64 | :heavy_check_mark: | :heavy_check_mark: | -|tvOS Arm 64 | :heavy_check_mark: | :heavy_check_mark: | -|minGW X86 64| :heavy_check_mark: | :heavy_check_mark: | -|minGW X86 32| :x: | :x: | +|Platform| Supported | +|--------|------------------| +|Linux X86 64| :heavy_check_mark: | +|Linux Arm 64| :heavy_check_mark: | +|Linux Arm 32| :x: | +|macOS X86 64| :heavy_check_mark: | +|iOS x86 64 | :heavy_check_mark: | +|iOS Arm 64 | :heavy_check_mark: | +|iOS Arm 32 | :heavy_check_mark: | +|watchOS X86 32 | :heavy_check_mark: | +|watchOS Arm 64(_32) | :heavy_check_mark: | +|watchos Arm 32 | :heavy_check_mark: | +|tvOS X86 64 | :heavy_check_mark: | +|tvOS Arm 64 | :heavy_check_mark: | +|minGW X86 64| :heavy_check_mark: | +|minGW X86 32| :x: | ### TODO: From de5158d22eb627fa5d0edff3135a1890f48419d8 Mon Sep 17 00:00:00 2001 From: Ugljesa Jovanovic Date: Sat, 9 Jan 2021 15:53:50 +0100 Subject: [PATCH 2/7] Add known issues to readme, rename project in gradle --- README.md | 13 +++++++++++++ settings.gradle.kts | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8b1e962..881411f 100644 --- a/README.md +++ b/README.md @@ -133,7 +133,20 @@ Currently supported native platforms: - LobsodiumUtil `unpad` and `fromBase64` native implementations use a nasty hack to support shared native sourceset. The hack either needs to be removed and replaced with another solution or additional safeguards need to be added. - Complete exposing libsodium constants +### Known issues: +- Using LazySodium self built variant to fix some of the bugs present in LazySodium, but **Android** is using directly + LazySodium release which has not been updated (latest version is 4.2.0), this means that randombytes_random, basetobin and + base64tohex functions are not working on Android, as well as problems with sodium_pad: + + https://github.com/terl/lazysodium-java/issues/83 + + https://github.com/terl/lazysodium-java/issues/85 + https://github.com/terl/lazysodium-java/issues/86 + + Also it is not clear where are the precompiled libraries in LazySodium coming from + + This will be handled by providing a new JNA libsodium wrapper library diff --git a/settings.gradle.kts b/settings.gradle.kts index 884beca..d0a5cf9 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -34,7 +34,7 @@ pluginManagement { } } enableFeaturePreview("GRADLE_METADATA") -rootProject.name = "KotlinMultiplatformCrypto" +rootProject.name = "KotlinMultiplatformLibsodium" include("multiplatform-crypto-api") include("multiplatform-crypto-libsodium-bindings") include("sample") From 15b2793acf7ff37eb0e061dffd899570b8325ed4 Mon Sep 17 00:00:00 2001 From: Ugljesa Jovanovic Date: Sat, 9 Jan 2021 23:42:30 +0100 Subject: [PATCH 3/7] Remove dokka javadoc for now --- buildSrc/src/main/kotlin/Deps.kt | 4 ++-- multiplatform-crypto-api/build.gradle.kts | 16 ---------------- .../build.gradle.kts | 11 ++++++----- 3 files changed, 8 insertions(+), 23 deletions(-) diff --git a/buildSrc/src/main/kotlin/Deps.kt b/buildSrc/src/main/kotlin/Deps.kt index edf6f4a..09b4ee0 100644 --- a/buildSrc/src/main/kotlin/Deps.kt +++ b/buildSrc/src/main/kotlin/Deps.kt @@ -15,13 +15,13 @@ */ object Versions { - val kotlinCoroutines = "1.4.1" + val kotlinCoroutines = "1.4.2" val kotlin = "1.4.20" val kotlinSerialization = "1.0.1" val kotlinSerializationPlugin = "1.4.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" + val dokkaPlugin = "1.4.20" val taskTreePlugin = "1.5" val kotlinBigNumVersion = "0.2.2" val lazySodium = "4.3.1-SNAPSHOT" diff --git a/multiplatform-crypto-api/build.gradle.kts b/multiplatform-crypto-api/build.gradle.kts index 4c655f0..30299cc 100644 --- a/multiplatform-crypto-api/build.gradle.kts +++ b/multiplatform-crypto-api/build.gradle.kts @@ -267,23 +267,7 @@ kotlin { } tasks { - create("javadocJar") { - dependsOn(dokkaJavadoc) - archiveClassifier.set("javadoc") - from(dokkaJavadoc.get().outputDirectory) - } - dokkaJavadoc { - println("Dokka !") - dokkaSourceSets { - named("commonMain") { - displayName.set("common") - platform.set(Platform.common) - } - } - - - } if (getHostOsName() == "linux" && getHostArchitecture() == "x86-64") { val jvmTest by getting(Test::class) { diff --git a/multiplatform-crypto-libsodium-bindings/build.gradle.kts b/multiplatform-crypto-libsodium-bindings/build.gradle.kts index 7aee1fb..dcc8a9e 100644 --- a/multiplatform-crypto-libsodium-bindings/build.gradle.kts +++ b/multiplatform-crypto-libsodium-bindings/build.gradle.kts @@ -28,10 +28,10 @@ plugins { id(PluginsDeps.mavenPublish) id(PluginsDeps.signing) id(PluginsDeps.node) version Versions.nodePlugin - id(PluginsDeps.dokka) id(PluginsDeps.taskTree) version Versions.taskTreePlugin id(PluginsDeps.androidLibrary) id(PluginsDeps.kotlinAndroidExtensions) + id(PluginsDeps.dokka) } @@ -595,9 +595,9 @@ tasks { dokkaJavadoc { println("Dokka !") dokkaSourceSets { - named("commonMain") { - displayName.set("common") - platform.set(Platform.common) + named("jvmMain") { + displayName.set("jvm") + platform.set(Platform.jvm) } } @@ -610,11 +610,12 @@ tasks { named("commonMain") { // displayName.set("common") // platform.set(Platform.common) - moduleDisplayName.set("Kotlin Multiplatform Libsodium Bindings") + moduleName.set("Kotlin Multiplatform Libsodium Bindings") includes.from( "src/commonMain/kotlin/com.ionspin.kotlin.crypto/aead/Aead.md", "src/commonMain/kotlin/com.ionspin.kotlin.crypto/auth/Auth.md", "src/commonMain/kotlin/com.ionspin.kotlin.crypto/box/Box.md", + "src/commonMain/kotlin/com.ionspin.kotlin.crypto/generichash/GenericHash.md", "src/commonMain/kotlin/com.ionspin.kotlin.crypto/CryptoModule.md") displayName.set("Kotlin multiplatform") } From 938c49468a7ae2a17cebab34a3f5f27eaa05a4d9 Mon Sep 17 00:00:00 2001 From: Ugljesa Jovanovic Date: Sun, 10 Jan 2021 12:05:33 +0100 Subject: [PATCH 4/7] Rremove dokka javadoc from libsodium bindings as well --- .../build.gradle.kts | 20 +------------------ 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/multiplatform-crypto-libsodium-bindings/build.gradle.kts b/multiplatform-crypto-libsodium-bindings/build.gradle.kts index dcc8a9e..f998059 100644 --- a/multiplatform-crypto-libsodium-bindings/build.gradle.kts +++ b/multiplatform-crypto-libsodium-bindings/build.gradle.kts @@ -584,25 +584,7 @@ tasks.whenTaskAdded { } tasks { - - - create("javadocJar") { - dependsOn(dokkaJavadoc) - archiveClassifier.set("javadoc") - from(dokkaJavadoc.get().outputDirectory) - } - - dokkaJavadoc { - println("Dokka !") - dokkaSourceSets { - named("jvmMain") { - displayName.set("jvm") - platform.set(Platform.jvm) - } - } - - - } + dokkaHtml { println("Dokka Html!") From 21d0c9929f73cabca33de555a7d8d6a9285505a6 Mon Sep 17 00:00:00 2001 From: Ugljesa Jovanovic Date: Sun, 10 Jan 2021 23:25:35 +0100 Subject: [PATCH 5/7] Remove javadoc jar --- multiplatform-crypto-libsodium-bindings/build.gradle.kts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/multiplatform-crypto-libsodium-bindings/build.gradle.kts b/multiplatform-crypto-libsodium-bindings/build.gradle.kts index f998059..4cb2428 100644 --- a/multiplatform-crypto-libsodium-bindings/build.gradle.kts +++ b/multiplatform-crypto-libsodium-bindings/build.gradle.kts @@ -584,7 +584,7 @@ tasks.whenTaskAdded { } tasks { - + dokkaHtml { println("Dokka Html!") @@ -676,7 +676,6 @@ signing { publishing { publications.withType(MavenPublication::class) { - artifact(tasks["javadocJar"]) pom { name.set("Kotlin Multiplatform Crypto") description.set("Kotlin Multiplatform Crypto library") From 06f4af078371c6f27d3b3f9e733cde7457b7a5e5 Mon Sep 17 00:00:00 2001 From: Ugljesa Jovanovic Date: Mon, 11 Jan 2021 10:22:30 +0100 Subject: [PATCH 6/7] Log at the end of windows script --- windowsBuild-delegated.sh | 1 + windowsBuildAndPublish-delegated.sh | 1 + 2 files changed, 2 insertions(+) diff --git a/windowsBuild-delegated.sh b/windowsBuild-delegated.sh index 3a2bcbe..cd71323 100755 --- a/windowsBuild-delegated.sh +++ b/windowsBuild-delegated.sh @@ -14,5 +14,6 @@ echo "completed libsodium build" cd .. #and then libsodium bindings ./gradlew --no-daemon multiplatform-crypto-libsodium-bindings:build || exit 1 +echo "Script completed" exit 0 diff --git a/windowsBuildAndPublish-delegated.sh b/windowsBuildAndPublish-delegated.sh index 9281e98..b3efb6a 100755 --- a/windowsBuildAndPublish-delegated.sh +++ b/windowsBuildAndPublish-delegated.sh @@ -14,5 +14,6 @@ echo "completed libsodium build" cd .. ./gradlew --no-daemon multiplatform-crypto-libsodium-bindings:build || exit 1 ./gradlew --no-daemon multiplatform-crypto-libsodium-bindings:publishMingwX64PublicationToSnapshotRepository || exit 1 +echo "Script completed" exit 0 From 5d098a7eb1ddeb4baceacfa9bc6d74d92af5724f Mon Sep 17 00:00:00 2001 From: Ugljesa Jovanovic Date: Mon, 11 Jan 2021 10:27:25 +0100 Subject: [PATCH 7/7] Bump kotlin to 1.4.21 --- buildSrc/src/main/kotlin/Deps.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/src/main/kotlin/Deps.kt b/buildSrc/src/main/kotlin/Deps.kt index 09b4ee0..8823416 100644 --- a/buildSrc/src/main/kotlin/Deps.kt +++ b/buildSrc/src/main/kotlin/Deps.kt @@ -16,7 +16,7 @@ object Versions { val kotlinCoroutines = "1.4.2" - val kotlin = "1.4.20" + val kotlin = "1.4.21" val kotlinSerialization = "1.0.1" val kotlinSerializationPlugin = "1.4.10" val atomicfu = "0.14.3-M2-2-SNAPSHOT" //NOTE: my linux arm32 and arm64 build