Skip to content

iOS: Hardware-Secured Wallet Seed Storage and Background Migration #236

Description

@alienx5499

Summary

Secures the BIP39 wallet mnemonic on iOS by migrating it from legacy plaintext disk storage (seed_phrase) to Apple's hardware-secured Keychain. The Keychain entry is configured to support background execution, allowing the NotificationService extension to wake up, boot the LDK Node, and process inbound payments even when the main app is closed and the device is locked.

Why This Matters

  • Cleartext Security Vulnerability: Storing the seed phrase in a plaintext file on disk leaves it exposed to anyone with access to the local sandbox or device backups.
  • Background Wakeups (NSE): The background Notification Service Extension needs to read the seed to boot the LDK Node on push notifications. Gating the Keychain under direct biometric access controls (kSecAccessControl / Face ID prompt) would block these silent background receive operations.
  • Robust Error Auditing: Exposing Keychain failure events (KEYCHAIN_STORE_FAILED, KEYCHAIN_LOAD_FAILED, KEYCHAIN_DELETE_FAILED) with their exact OSStatus failure codes in the audit logs ensures system health and diagnostic visibility.

Expected Behavior

  • On the first application launch, any legacy plaintext seed file on disk is migrated to the secure Keychain and then permanently deleted.
  • If the Keychain migration fails, the legacy plaintext file is preserved on disk, and a failure event is recorded in the audit logs.
  • The NotificationService background extension successfully loads the wallet seed from the Keychain to process push notifications when the device is locked or the application is in the background.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions