From 572c5ef6deac828d0c97c822528a061c5983d52d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20VANDENDAELEN?= Date: Wed, 14 Aug 2024 08:42:09 +0200 Subject: [PATCH 1/2] fix: Added default crypto service + added a way to rename the XcFramework --- buildSrc/src/main/kotlin/ConfigureMultiplatform.kt | 5 +++-- icure-sdk/build.gradle.kts | 2 +- .../kotlin/com/icure/sdk/utils/DefaultCryptoService.kt | 7 +++++++ 3 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 icure-sdk/src/appleMain/kotlin/com/icure/sdk/utils/DefaultCryptoService.kt diff --git a/buildSrc/src/main/kotlin/ConfigureMultiplatform.kt b/buildSrc/src/main/kotlin/ConfigureMultiplatform.kt index c6acab9f1..dcd5d0e79 100644 --- a/buildSrc/src/main/kotlin/ConfigureMultiplatform.kt +++ b/buildSrc/src/main/kotlin/ConfigureMultiplatform.kt @@ -53,10 +53,11 @@ fun Project.configureKotlinLinux( * Configures targets and source sets for multiplatform modules. */ fun Project.configureMultiplatform( - kotlinMultiplatformExtension: KotlinMultiplatformExtension + kotlinMultiplatformExtension: KotlinMultiplatformExtension, + xcFrameworkName: String? = null ) = with(kotlinMultiplatformExtension) { val localProperties = getLocalProperties() - val frameworkName = project.name.replaceFirstChar { it.uppercase() } + val frameworkName = xcFrameworkName ?: project.name.replaceFirstChar { it.uppercase() } val xcf = XCFramework(frameworkName) jvm { compilations.all { diff --git a/icure-sdk/build.gradle.kts b/icure-sdk/build.gradle.kts index 004ec6b80..8c2c630b4 100644 --- a/icure-sdk/build.gradle.kts +++ b/icure-sdk/build.gradle.kts @@ -17,7 +17,7 @@ val version: String? by project project.version = version ?: "0.0.0-snapshot" kotlin { - configureMultiplatform(this) + configureMultiplatform(this, null) sourceSets { val commonMain by getting { diff --git a/icure-sdk/src/appleMain/kotlin/com/icure/sdk/utils/DefaultCryptoService.kt b/icure-sdk/src/appleMain/kotlin/com/icure/sdk/utils/DefaultCryptoService.kt new file mode 100644 index 000000000..71e3d4f16 --- /dev/null +++ b/icure-sdk/src/appleMain/kotlin/com/icure/sdk/utils/DefaultCryptoService.kt @@ -0,0 +1,7 @@ +package com.icure.sdk.utils + +/** + * This is a default crypto service that is used by the SDK. + * The sole purpose of this variable is to make the Kotlin Multiplatform to generate the correct code for the XcFramework. + */ +val defaultCryptoService = com.icure.kryptom.crypto.defaultCryptoService From c60d2fa707c22342f1e578fd8c242a9bbd828c9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20VANDENDAELEN?= Date: Tue, 27 Aug 2024 13:48:39 +0200 Subject: [PATCH 2/2] Exposed RSA Encryption algorithm to XCFramework --- .../kotlin/com/icure/sdk/utils/DefaultCryptoService.kt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/icure-sdk/src/appleMain/kotlin/com/icure/sdk/utils/DefaultCryptoService.kt b/icure-sdk/src/appleMain/kotlin/com/icure/sdk/utils/DefaultCryptoService.kt index 71e3d4f16..e970d5224 100644 --- a/icure-sdk/src/appleMain/kotlin/com/icure/sdk/utils/DefaultCryptoService.kt +++ b/icure-sdk/src/appleMain/kotlin/com/icure/sdk/utils/DefaultCryptoService.kt @@ -1,7 +1,12 @@ package com.icure.sdk.utils +import com.icure.kryptom.crypto.RsaAlgorithm + /** * This is a default crypto service that is used by the SDK. * The sole purpose of this variable is to make the Kotlin Multiplatform to generate the correct code for the XcFramework. */ val defaultCryptoService = com.icure.kryptom.crypto.defaultCryptoService + +val rsaEncryptionAlgorithmOaepWithSha1 = RsaAlgorithm.RsaEncryptionAlgorithm.OaepWithSha1 +val rsaEncryptionAlgorithmOaepWithSha256 = RsaAlgorithm.RsaEncryptionAlgorithm.OaepWithSha256