Secure key storage
To store secrets (such as user authorization tokens, etc.), the OneEntry Native SDK uses the system's built-in secure storage: Keychain
on Apple platforms and EncryptedSharedPreferences
on Android.
However, in rare cases, you might need to override the default secret storage behavior.
Kotlin Multiplatform
OneEntryApp.initialize(
host = "sample.oneentry.cloud",
token = "vfrueaBVFuivUpv...hceupGVUGEWuvga"
) {
keystore = object : Keystore {
val map = mutableMapOf<String, String>()
override fun get(key: String): String? = map[key]
override fun set(key: String, value: String?) {
if (value != null)
map[key] = value
else
map.remove(key)
}
}
}
Swift
final class InMemoryKeystore: Keystore {
var dictionary: [String : String] = [:]
func get(key: String) -> String? {
dictionary[key]
}
func set(key: String, value: String?) {
dictionary[key] = value
}
}
OneEntryApp.shared.initialize(
host: "sample.oneentry.cloud",
token: "vfrueaBVFuivUpv...hceupGVUGEWuvga"
) {
CustomKeystore(InMemoryKeystore())
}
Last modified: 01 August 2025