Skip to content
This repository was archived by the owner on Oct 10, 2025. It is now read-only.
This repository was archived by the owner on Oct 10, 2025. It is now read-only.

Crash for users setting up new devices (broken keychain) #36

@tristan-warner-smith

Description

@tristan-warner-smith

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:

  1. Install an app with an active, cached auth credential from the Magic SDK
  2. Buy a new device and use restore
  3. Attempt to access a login flow that references Magic.getIdToken
  4. See crash

Expected behavior
No crashes, a self-healing recoverable flow

Screenshots
If applicable, add screenshots to help explain your problem.
image
image

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

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions