Skip to content

feat(mobile): sync sign-in to iCloud Keychain so new iOS devices are signed in - #14824

Open
dylanjeffers wants to merge 1 commit into
mainfrom
feat/mobile-icloud-keychain-signin
Open

dylanjeffers wants to merge 1 commit into
mainfrom
feat/mobile-icloud-keychain-signin

Conversation

@dylanjeffers

Copy link
Copy Markdown
Contributor

Description

On iOS the hedgehog entropy only lived in AsyncStorage, so a new device (or a reinstall) always started signed out. This copies it to an iCloud Keychain item (kSecAttrSynchronizable, end-to-end encrypted) and restores it at launch when there is no local entropy.

  • Sign-in / sign-up / password change: entropy is written to AsyncStorage as before and also to iCloud Keychain.
  • Already signed-in users: the first entropy read after updating uploads the existing entropy, so no re-sign-in is needed.
  • New device or reinstall: with no local entropy, the app reads it from iCloud Keychain, saves it locally, and the normal startup flow signs the account in.
  • Sign-out: both copies are removed and the device is flagged so it won't restore from iCloud until someone signs in on it again (otherwise another signed-in device would re-upload and sign this one back in).
  • Failures: keychain errors are logged and ignored; behaviour falls back to today's.

Implementation: a small native module (CloudKeychain.m, registered in the Xcode project, no new dependency) and a storage wrapper (entropy-synced-storage.ts) wired in through local-storage.ts. The keychain item is namespaced by bundle ID and environment, so production and release-candidate builds don't share it. Android is unchanged.

Notes:

  • Only syncs if the user has iCloud Keychain enabled, and on Apple's schedule. The app checks at startup only, so opening it on a new device before the keychain has synced shows the sign-in screen.

How Has This Been Tested?

  • New unit tests for the storage wrapper pass (9/9); lint and typecheck are clean for the changed files.
  • CloudKeychain.m passes a clang syntax check against the React headers.
  • Not yet built or run in the iOS app. Needs a device/TestFlight build, and two devices on the same Apple ID (or delete-and-reinstall on one) to confirm the restore.

🤖 Generated with Claude Code

…signed in

Copy the hedgehog entropy to a synchronizable iCloud Keychain item on iOS
and restore it on launch when the device has no local entropy. Sign-out
removes both copies and blocks restore on that device until the next
sign-in.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@socket-security

Copy link
Copy Markdown

Dependency limit exceeded — report not shown.

This pull request scan exceeded the 10,000-dependency limit applied to this scan, so the results are incomplete and may be inaccurate. To avoid reporting false positives, Socket has not posted a report.

Upgrade your plan to raise the dependency limit and get complete reports, or view the partial scan in the dashboard.

Socket is always free for open source. If this is a public open source project under an OSI-approved license, contact us to request a free Business plan upgrade.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant