From 4882791ab14d2e7b3fdf7b15470607746ed135c4 Mon Sep 17 00:00:00 2001 From: Juan Docal <109512072+kp-juan-docal@users.noreply.github.com> Date: Tue, 3 Oct 2023 14:59:11 +0200 Subject: [PATCH] PIA-620: Update iOS `KeychainSettings` constructor to pass the `kSecAttrAccessible` attribute (#1) Update iOS KeychainSettings constructor to pass the accessible attribute --- .../secureSettings/SecureSettingsProvider.kt | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/account/src/iosMain/kotlin/com/privateinternetaccess/account/internals/persistency/secureSettings/SecureSettingsProvider.kt b/account/src/iosMain/kotlin/com/privateinternetaccess/account/internals/persistency/secureSettings/SecureSettingsProvider.kt index 17fb7bd..4ecd1eb 100644 --- a/account/src/iosMain/kotlin/com/privateinternetaccess/account/internals/persistency/secureSettings/SecureSettingsProvider.kt +++ b/account/src/iosMain/kotlin/com/privateinternetaccess/account/internals/persistency/secureSettings/SecureSettingsProvider.kt @@ -1,12 +1,22 @@ package com.privateinternetaccess.account.internals.persistency.secureSettings +import com.russhwolf.settings.ExperimentalSettingsImplementation import com.russhwolf.settings.KeychainSettings import com.russhwolf.settings.Settings +import kotlinx.cinterop.ExperimentalForeignApi +import platform.Foundation.CFBridgingRetain +import platform.Security.kSecAttrAccessible +import platform.Security.kSecAttrAccessibleAlways +import platform.Security.kSecAttrService internal actual object SecureSettingsProvider { private const val KEYCHAIN_NAME = "account_keychain" + @OptIn(ExperimentalSettingsImplementation::class, ExperimentalForeignApi::class) actual val settings: Settings? - get() = KeychainSettings(KEYCHAIN_NAME) + get() = KeychainSettings( + kSecAttrService to CFBridgingRetain(KEYCHAIN_NAME), + kSecAttrAccessible to kSecAttrAccessibleAlways + ) } \ No newline at end of file