Is it possible to somehow access the iOS Keychain ...
# kotlin-native
w
Is it possible to somehow access the iOS Keychain in Kotlin unit tests?
j
You can use iOS platform Objective-C APIs in iOS platform code. Keychain APIs should be in the
platform.Security
package.
r
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
Ah, that's good to know. I recall now, I never did get this working in some tests last I tried a while ago.
I remember some keychain operations succeeded, but others failed.
r
I have been nerd sniped. Needs some CI cleanup and sometimes the simulator doesn't launch fast enough, but here's some config that roughly works for me locally https://github.com/russhwolf/multiplatform-settings/pull/181/files
😄 1
🚀 2
254 Views