Forum Xamarin.iOS

Something like AuthenticationValidityDuration?

Palo_spPalo_sp Member ✭✭

Hi.. I am looking for functionality like in Android with SetUserAuthenticationValidityDurationSeconds in android. Is there something similar for accessing keychain data with SecKeyChain and SecRecord? I don't want to ask for authentication right after phone was unlocked by user.
I'm using
SecAccessControl(SecAccessible.WhenPasscodeSetThisDeviceOnly, SecAccessControlCreateFlags.UserPresence)

Best Answer


  • LandLuLandLu Member, Xamarin Team Xamurai

    Unfortunately, I don't think iOS also has this feature as Android.
    According to Apple's documentation about Restricting Keychain Item Accessibility:
    Apple doesn't mention anything about the expiration date of accessibility.
    If you want to access the data without request the user's authentication again, you could only set the kSecAttrAccessible to kSecAttrAccessibleWhenUnlocked and remove the user presence settings.
    Because Apple thinks once the user presence has been set, it should be checked at the very last minute before retrieving login credentials from the keychain.

  • Palo_spPalo_sp Member ✭✭

    Thank you LandLu ... but I want to force user to authenticate before he can access some data inside app.. but not immediately after he unlocks the phone.

  • Palo_spPalo_sp Member ✭✭

    @LandLu Thank you for your time :)

Sign In or Register to comment.