Upstream/typed authentication context - #264
Open
LucaCappelletti94 wants to merge 2 commits into
Open
LucaCappelletti94 wants to merge 2 commits into
LucaCappelletti94 wants to merge 2 commits into
Conversation
This was referenced Sep 26, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR is "stacked" on #263 and adds an
AuthenticationContextbehind an opt-inlocal-authenticationfeature, accepted by bothItemSearchOptionsandPasswordOptions, so callers need nounsafebridging and cannot pass a non-LAContextobject. Its builder sets the prompt text, sincekSecUseOperationPromptis deprecated in favour oflocalizedReason.I am unsure whether
AuthenticationContextshould beSend + Sync, as it currently is. An app often wants one context for all its threads, the context cannot change once built, and the crate only passes it toSecItem*without calling its methods, but Apple's SDK headers mark several LocalAuthentication typesNS_SWIFT_SENDABLEandLAContextis not marked as such. Without these impls, an app that needs sharing can still write its ownunsafe impland takes on that assumption itself.Measured on an iPhone 15 Pro Max through apple-native-keyring-store, a shared context gave one Face ID sheet for the first read in ~2s, and none for the later reads and update, which took ~10ms each. The
unsafeonLAContextgoes away with madsmtm/objc2#864.