Repository navigation
Description
Expected Behavior
A key added through IdentityWallet::update_identity_with_external_signer (FFI platform_wallet_update_identity_with_signer[_at_revision], Swift ManagedPlatformWallet.updateIdentity) is stored with a (wallet_id, identity_index, key_index) derivation breadcrumb only when the wallet derived it at that path. A key supplied from outside, such as a browser session key registered by the share-login-key flow, is stored without one, so it stays external (watch-only).
Current Behavior
After the update lands, apply_landed_update (packages/rs-platform-wallet/src/wallet/identity/network/update.rs) gives every added key the breadcrumb (wallet_id, identity_index, key.id()) whenever the identity has an identity_index. The method does not derive or verify the keys it is given, so the breadcrumb is inferred from the identity's wallet membership, not from the key. v5.1-dev already does this on the regular path; #5487 kept the same rule for a cache already at or past the landed revision.
On iOS, the persister turns that breadcrumb into PersistentPublicKey.identityDerivationPath. KeychainSigner then reports the key as signable by deriving on demand from the seed at that path (resolverCanDeriveSign + breadcrumb + mnemonic). For an external key the derived scalar does not match the public key, so a signing path that selects it produces an invalid signature instead of treating the key as one the phone cannot sign with.
Possible Solution
Add explicit per-key provenance to the update API, decided by the caller that built the key (it knows whether the key came from the wallet's derivation at a given index):
IdentityPubkeyFFI(shared with registration) gains an optional derivation key index, or a "wallet-derived" flag.- Swift
ManagedPlatformWallet.IdentityPubkeyand the Kotlin counterpart marshal it. update_identity_with_external_signertakes the added keys asKeyWithBreadcrumb, andapply_landed_updatestores exactly that,Nonefor external keys.- dashwallet-ios passes the derivation index for keys it derives and none for the share-login-key session key.
Rust cannot check this on its own here: identity authentication paths are hardened, and the call carries no mnemonic.
Steps to Reproduce (for bugs)
- On iOS, register an external key (e.g. a share-login-key browser session key) on a wallet-owned identity through
updateIdentity(addPublicKeys:). - Look at the stored
PersistentPublicKeyrow of the new key: it haswalletIdandidentityDerivationPathset. KeychainSigner.canSignreports the key as signable, and signing with it derives a scalar that does not match its public key.
Context
Raised by the review of #5487 (finding "Do not fabricate HD derivation breadcrumbs for externally supplied keys"). The behavior predates that PR, and the fix crosses the FFI, Swift and Kotlin SDKs and the apps, so it is tracked here instead of being widened into #5487.
Your Environment
- Version used: v5.1-dev
- Operating System and version (desktop, server, or mobile): iOS (dashwallet-ios), Android (Kotlin SDK) for parity
🤖 Generated with Claude Code
Activity
romchornyi commentedon Oct 20, 2026
Addressed in #5487 (4d1f50a, 2c31b5f): the update API takes
external_key_idsthrough Rust, FFI, JNI, Kotlin and Swift, and disables no longer carry an inferred breadcrumb. This closes when #5487 merges.refactor(platform-wallet): fold fetched identities without the key-ro…