Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS Keychain - Use accessiblity option for all operations and throw PlatformException for SecErrors #602

Merged
merged 2 commits into from
Oct 12, 2023

Conversation

bierbaumtim
Copy link
Contributor

This PR fixes the issue that the accessiblity option was ignored for containtsKey and delete. Since all functions now require the conversion for the accessiblity option, I refactored that into a seperate function.

While working on this, I noticed that errors were not being propagated properly. So I improved the error propagation so that now errors will lead to a PlatformException.

I also noticed that the implementation of containsKey could be optimized. Reading the value is not neccessary therefore I removed it and use the status to determine if the key is contained.

All changes currently apply to iOS only. Since the macOS implementation is almost identical, I could apply the fixes there too, but I can't test them because I don't have a Mac. What's your oppinion on that?

The work on this PR started as an attempt to fix #524. The changes does not fully fix the issue descripted in #524. To do fix them you need to wait until the function applicationProtectedDataDidBecomeAvailable is called and stop reading values when applicationProtectedDataWillBecomeUnavailable is called. I created a Gist containing the necessary code to do that. https://gist.github.com/bierbaumtim/63c5057fc2889558d1801d95d93b6c6c
I think this plugin should support fetching and listening to changes in the availability of the keychain. But I want to know your opinion on that and if support should be added, should this be a seperate PR?

@bierbaumtim
Copy link
Contributor Author

@juliansteenbakker Could you review the changes?

@juliansteenbakker
Copy link
Collaborator

Thank you for your work! Sorry for the late response, i'm planning on picking up some overdue work this plugin in the comming days.

I think it will be good to add the same fixes on macOS. I can test them since i do have a mac. If you can create a separate PR for this, and for the new fetching and listening functions that would be great. Also, can you update this PR with the latest code base available?

@bierbaumtim
Copy link
Contributor Author

Thanks for your feedback. I plan to work on it on Saturday.

@bierbaumtim
Copy link
Contributor Author

PR is now update to date with latest code base

@bierbaumtim
Copy link
Contributor Author

Could also fix #532, #519

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

.read() return null since iOS 16.3.X even with the correct KeychainAccessibility
2 participants