Skip to content
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

Merged
merged 1 commit into from
Feb 12, 2024

Conversation

tristan-warner-smith
Copy link
Contributor

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.

@tristan-warner-smith
Copy link
Contributor Author

For context:
getIdToken crash

Logout crash

@romin-halltari
Copy link
Contributor

Thank you @tristan-warner-smith for this PR. We checked it on our end and it solves the issue with runtime crashes when the signing fails.

@romin-halltari romin-halltari merged commit aa4f0e8 into magiclabs:main Feb 12, 2024
@tristan-warner-smith
Copy link
Contributor Author

Thank you @tristan-warner-smith for this PR. We checked it on our end and it solves the issue with runtime crashes when the signing fails.

Great, and no chance of it popping up in other places? You don't need to delete the previous key etc? Changes to that key should persist correctly etc @romin-halltari ?

@tristan-warner-smith tristan-warner-smith deleted the patch-1 branch February 21, 2024 17:15
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants