Ios obfuscation Hello, I am working on kmm librar...
# multiplatform
j
Ios obfuscation Hello, I am working on kmm library for ios and android platform. I'm trying to find a way to obfuscate ios library. I found this tutorial - https://medium.com/@dfs.techblog/code-obfuscations-in-kotlin-multiplatform-kmp-494d2cd0a416 in which someone is modifying linker options to strip all on used symbols. When I am trying to modify my build script this way i am getting this warning and errors: w: Flag is not supported by this version of the compiler: -Xobfuscate ld: unknown options: -Xlinker -Xlinker -Xlinker --strip-debug -Xlinker --strip-unneeded -Xlinker --strip-all I am using Xcode 15.4, AGP 2.0.20. Any suggestions on how to fix this? Or any other ideas how to obfuscate ios xcframework generated using KMM?
Any ideas? I would really appreciaty any help
f
The default release mode is not enough for you? How do you check the content?
j
Nope, its not enough. When I am using command nm -g on final, release binary I can see a lot of unnecessary symbols that i would like to get rid of. Is it possible somehow?
f
The content exposed are what inside the objc header used by your iOS app, means everything exposed publicly from your kotlin code
if you want to reduce the exposed content set the visibility of your kotlin code at internal
Use something like explicitApi() to control what you want to expose
j
Okay, but what about frameworks that are statically linked. In my KMP project I am using openssl which is linked statically and in final binary i also can see symbols from openssl. I don't want them there. How can i change visibility of openssl symbols?
f
Changing the visibility of your class/properties to internal will remove them to the “nm -g” list
if one of your public properties use openssl, openssl will be exposed, even with the coroutine
Just make a simple app with explicitapi enabled and play with the visibility
Swift module are internal by default and kotlin module are open by default