hi ! Has anyone interfaced `Apple CryptoKit` into...
# multiplatform
a
hi ! Has anyone interfaced
Apple CryptoKit
into a kmp library ? My research lead me to how to use swift only code in kmp, Looking for already packaged lib 😄
j
What do you want to achieve? If you are just searching for something, you'd be better off googling or asking chatgpt; if you want to solve a problem, describe the problem 😉
a
I'm want to use
X448
and
X25519
encryption in my kotlin commode module these alg are offered by
Apple CryptoKit
for ios But It's a known problem with kmp that we can't use swift only libraries in kotlin The workarounds i found : https://dev.to/ttypic/going-swiftly-using-a-swift-only-libraries-in-your-kotlin-multiplatform-app-1ml9 https://github.com/KodeinKoders/playground-SwiftLib-in-KMMLib Before i try using these i'm looking for an open source library that already implemented this and exposed
Apple CryptoKit
to kmp common code
j
If your main concern are these two algorithms, then maybe using openssl would be a viable alternative for you? Integrating BoringSSL (a fork of OpenSSL - https://boringssl.googlesource.com/boringssl/) into KMP is reasonably easy, can post some pointers here if you are interested.
a
yeah if i can import this library into a kmp module (common or ios target) would be great would appreciate any snippets !
j
@Ahmed na I'm using the BoringSSL in https://github.com/kendy/Kotlin-Native-BigDecimal . To build BoringSSL, here are my notes: https://github.com/kendy/Kotlin-Native-BigDecimal/blob/master/bignum/README.md To actually import it then into your project using cinterops, see https://github.com/kendy/Kotlin-Native-BigDecimal/blob/master/build.gradle.kts Then when you want to actually use that, see https://github.com/kendy/Kotlin-Native-BigDecimal/blob/master/src/iosMain/kotlin/kendy/math/NativeBN.kt where I call the BoringSSL API
🙏 1