You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
platform-wallet: store derivation breadcrumbs for keys of address-funded and shielded identity creation #6281
IdentityManager::record_new_identity (packages/rs-platform-wallet/src/wallet/identity/state/manager/lifecycle.rs) records an identity Platform has just accepted. Asset-lock registration and invitation claim pass NewIdentityKeyOrigin::DerivedAtKeyId and store each key with its derivation breadcrumb (wallet_id, identity_index, key_id). Address-funded registration (register_from_addresses) and shielded identity creation (shielded_identity_create_from_pool) pass Unrecorded and store their keys without a breadcrumb, as they did before #6143.
The FFI docs say the host derives those keys at (identity_index, key_id) as well, so the missing breadcrumb looks like an omission: after a restart the wallet has no record that lets the host re-derive the private keys of these identities.
What to do
Store derivation indices for the wallet-derived keys of address-funded and shielded identity creation, from per-key provenance verified in Rust (the key is checked against the wallet's own derivation at that index), and leave caller-supplied or unverified keys unmarked.
These were raised on that PR and left out of it on purpose. They touch the same method and are recorded here so they are not lost; each may deserve its own issue.
An occupied HD slot is overwritten silently.add_identity_unstored rejects only a duplicate identity id. Recording a different identity at an identity_index that is already occupied replaces the earlier one in the wallet's bucket, while the location index still maps the earlier id to that slot. All four flows now share one entry point, so a slot check there would cover them all.
Unrecorded flows store the identity exactly once. The breadcrumb flows store the identity again with every key, so one failed store is covered by the next. Address-funded and shielded creation have only the initial store. On a host that reports a failed save as fatal (SwiftData), one failed save leaves the identity in memory only, and a launch that already has another identity on file runs no discovery scan to find it again.
No signal to the host when every breadcrumb store fails (not verified). record_new_identity is best-effort and returns nothing, which is right for the calling flows, but the host does not learn that the identity will come back watch-only after a restart.
Note from the review of #6143: for shielded identity creation the caller supplies the keys and signer, and nothing requires them to match the wallet derivation. Identity discovery probes only the wallet-derived authentication key hash at key index 0 of each slot, and by default starts above the highest locally held slot, so a shielded identity whose local save failed is not guaranteed to be found by a discovery scan. The doc comments that say "an identity discovery scan adds it" should state both conditions when this follow-up is done.
Activity
llbartekll commentedon Nov 25, 2026
Note from the review of #6143: for shielded identity creation the caller supplies the keys and signer, and nothing requires them to match the wallet derivation. Identity discovery probes only the wallet-derived authentication key hash at key index 0 of each slot, and by default starts above the highest locally held slot, so a shielded identity whose local save failed is not guaranteed to be found by a discovery scan. The doc comments that say "an identity discovery scan adds it" should state both conditions when this follow-up is done.