Repository navigation
Description
Expected Behavior
In both example apps, a normal identity registration and a DashPay invitation claim cannot take the same identity index on one wallet. Each one holds its slot through a single shared reservation before it derives keys. The reservation:
- is taken at the moment the index is chosen and is stored durably, so it survives an app exit;
- covers every slot, including indices past the derived address lookahead;
- records who holds the slot. An invitation claim retried after a lost result has to return to its own slot, where the landed claim's keys are, to be recognized as this wallet's claim (code 64). A normal registration must skip that slot.
Current Behavior
SwiftExampleApp. CreateIdentityView skips indices that have an identity row or an isUsed identity-registration address (#L1030, #L2149), but it does not read RegistrationCoordinator. After #5536, the invitation claim sheet skips coordinator-held slots and sets isUsed on its own slot before deriving keys, then saves it. The limits are:
isUseddoes not record who holds the slot. For that reason the claim's own selector ignores it, so it can still pick a slot that only an unconfirmed normal registration from before a restart holds throughisUsed.- Nothing is written for a slot past the lookahead, both here and in
CreateIdentityView.
KotlinExampleApp. CreateIdentityScreen starts the index field at "0" (#L96) and submits any number that parses (#L204, #L482). It checks neither recorded identities, nor coordinator slots, nor a claim's slot. The claim sheets skip coordinator-held slots (ClaimInvitationSheet.kt#L138) but reserve nothing, because the form reads nothing.
In both apps, when two flows take the same slot they derive the same keys. Platform refuses the second one on duplicate key hashes (40207), after its separate funding is spent.
Possible Solution
Make the lease a wallet-owned operation in rs-platform-wallet, exposed through the FFI to both SDKs, so the example apps, Kotlin and any direct caller use the same one:
IdentityWalletselects and acquires(wallet_id, identity_index)with its holder (a normal registration, or an invitation claim keyed by the invitation's outpoint) before any key is derived, and persists it through the wallet's persister, so it survives an app exit and covers slots past the address lookahead.- Selection skips slots held by another holder and lets a claim re-enter its own lease, so a retry after a lost result returns to its slot.
- The lease is held through key derivation, submission, recovery and persistence, is released when the registration lands or is abandoned, and is bound to the wallet generation that took it.
- Hosts stop choosing the index themselves: the Swift
isUsedmarker and coordinator snapshots in the claim sheet, and Kotlin's free-typed index inCreateIdentityScreen, are replaced by the index the lease returns.
Steps to Reproduce (for bugs)
- KotlinExampleApp: register an identity on a wallet (it lands at index 0).
- Open Create Identity again on the same wallet: the index field shows 0.
- Submit. The wallet derives the same keys at index 0, and Platform refuses them as already registered (40207) after the funding is spent.
- In either app, the same collision is possible between a normal registration and an invitation claim in the cases listed above.
Context
Found in the review of #5536 (invitation claim preflight), which closes the cheap cases in Swift and defers the shared reservation here.
Your Environment
- Version used: v5.2-dev (0fc32ab) + fix!: check a DashPay invitation claim against Platform before broadcasting it #5536
- Operating System and version: iOS (SwiftExampleApp), Android (KotlinExampleApp)
Activity
[-]KotlinExampleApp: identity registration form does not check which indices are already taken[/-][+]Example apps: identity registration and invitation claims need a shared identity-slot reservation[/+][-]Example apps: identity registration and invitation claims need a shared identity-slot reservation[/-][+]Identity registration and invitation claims need a wallet-owned identity-slot lease[/+]fix(platform-wallet): leave claim recovery and slot reservation to th…
romchornyi commentedon Dec 1, 2026
Two more ways an identity slot loses its hold, from CodeRabbit's review of #6380. Both need the durable lease this issue asks for:
PendingRegistrationsListrelease: once the user confirms they checked the history, the index is free again. If the earlier registration did land and its identity row has not synced, a fresh registration on that index funds a new lock before Platform refuses the duplicate key. feat(swift-sdk)!: read Rust's payment class on every PlatformWalletError #6380 (comment)WalletManagerStore.activatereplaces the cached manager and itsRegistrationCoordinator, and the hold is gone. feat(swift-sdk)!: read Rust's payment class on every PlatformWalletError #6380 (comment)🤖 Generated with Claude Code