Skip to content

Commit

Permalink
PIA-620: Update iOS KeychainSettings constructor to pass the `kSecA…
Browse files Browse the repository at this point in the history
…ttrAccessible` attribute (#1)

Update iOS KeychainSettings constructor to pass the accessible attribute
  • Loading branch information
kp-juan-docal authored Oct 3, 2023
1 parent c0d41b1 commit 4882791
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -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
)
}

0 comments on commit 4882791

Please sign in to comment.