Describe the bug
A minority of users who swap devices, for whom apps using Magic SDK are automatically re-installed restore the keychain content, but do not enable access to it due to biometric signature differences.
This causes the DPop.swift line let signature = try! privateKey.signature(for: signingInputData) to crash irrecoverably.
In this case try retrieveKeyFromKeychain does not throw.
I raised a hopeful PR to patch the symptom but here's the Apple Forum reference that says they're aware of this issue but that you have you handle it yourself.
In the PR I prevent the crash, I'm not sure if this means you'll recreate the token later, or if the key would need to be explicitly removed as mentioned in the Apple Forum post above.
To Reproduce
Steps to reproduce the behavior:
- Install an app with an active, cached auth credential from the Magic SDK
- Buy a new device and use restore
- Attempt to access a login flow that references
Magic.getIdToken
- See crash
Expected behavior
No crashes, a self-healing recoverable flow
Screenshots
If applicable, add screenshots to help explain your problem.


Environment
- Package Version: 10.0.0
- XCode Version: 15.2
- Swift Version: 5.8
- Simulator / Device OS: Device no OS specificity, os bug seems to have existed for several versions
Additional context