Is it possible to somehow access the iOS Keychain in Kotlin unit tests?
j
Jeff Lockhart
01/13/2024, 1:52 AM
You can use iOS platform Objective-C APIs in iOS platform code. Keychain APIs should be in the
platform.Security
package.
r
russhwolf
01/13/2024, 2:53 AM
Access to the Objective-C APIs isn't enough. There's entitlements that the os needs at runtime which aren't available in the default simulator environment that Kotlin/Native tests use. I've had a TODO to dig into this for a while for keychain tests in Multiplatform Settings. There's a ticket at https://youtrack.jetbrains.com/issue/KT-61470 which has a workaround you can try if you know how to create the correct entitlements plist.
j
Jeff Lockhart
01/13/2024, 3:12 AM
Ah, that's good to know. I recall now, I never did get this working in some tests last I tried a while ago.
Jeff Lockhart
01/13/2024, 3:12 AM
I remember some keychain operations succeeded, but others failed.