This repository has been archived by the owner on Sep 4, 2024. It is now read-only.
Tackle crash defensively in the case of an invalid signature of a keychain value #35
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.
We encounter a recurring crash on this implicitly unwrapped
try!
.The cause, seems to be an OS-bug that indicates the biometrics that are securing the keychain have changed, such as when an app is automatically restored on a new phone.
The throwing function that gets the
privateKey
does not throw in this situation but the signature is invalid so it crashes here.The recommendation in the forum seems to be to delete the keychain value in this scenario, but I don't have sufficient context to know if what I do in this PR is sufficient to recreate the keychain value.
What I do know is that this error results in users being unable to use the app at all, until they uninstall + reinstall the app, which is a terrible user experience.