Skip to content
Open
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
4891bd4
docs(dashpay): DIP-13 invitations spec (reviewed + synced)
shumkov Jul 8, 2026
1d8b490
feat(platform-wallet): DIP-13 invitation link codec
shumkov Jul 8, 2026
c60b3e3
feat(platform-wallet): path-gated invitation voucher-key export
shumkov Jul 8, 2026
9e40ee8
feat(platform-wallet): invitation create + claim flows
shumkov Jul 8, 2026
5039946
fix(platform-wallet): fold invitation Rust-core review findings
shumkov Jul 8, 2026
6a730a9
test(qa): add DIP-13 invitation scenarios to the example-app QA contract
shumkov Jul 8, 2026
f59edf6
feat(platform-wallet): invitation create + claim FFI
shumkov Jul 8, 2026
55c9537
fix(platform-wallet): scrub the exported voucher scalar in create_inv…
shumkov Jul 8, 2026
4d39bdc
feat(swift-sdk): createInvitation / claimInvitation wrappers on Manag…
shumkov Jul 8, 2026
2b2a871
feat(platform-wallet): persist inviter-side invitation records (Rust …
shumkov Jul 8, 2026
8fd0613
feat(swift-sdk): add DashPay create-invitation UI (DIP-13)
shumkov Jul 8, 2026
bd60102
feat(platform-wallet-ffi): add parse-invitation preview FFI + Swift w…
shumkov Jul 8, 2026
5967661
feat(swift-sdk): add DashPay claim-invitation flow (DIP-13)
shumkov Jul 8, 2026
4e0dfbe
feat(swift-sdk): handle dashpay:// invitation deep links
shumkov Jul 8, 2026
01cd566
test(platform-wallet-storage): allow-list invitations.rs read-only re…
shumkov Jul 8, 2026
a50a806
fix(swift-sdk): present invitation claim sheet on cold-launch deep link
shumkov Jul 8, 2026
0b51001
fix(rs-sdk-ffi): enforce fully-hardened invitation export path
shumkov Jul 8, 2026
2d568b7
fix(platform-wallet): fold invitation review findings
shumkov Jul 8, 2026
c2ddfcf
docs(dip15): sync spec §4.1/§6 with as-built code + note scheme limit…
shumkov Jul 8, 2026
a001d26
fix(swift-sdk): re-present invitation claim sheet on a second deep link
shumkov Jul 8, 2026
10fbc57
fix(platform-wallet): persist asset-lock account used-index across re…
shumkov Jul 10, 2026
74675fc
test(platform-wallet): pin asset-lock funding-index persistence
shumkov Jul 10, 2026
55937e1
fix(platform-wallet): gate invitation broadcast on funding-index persist
shumkov Jul 10, 2026
096e52d
feat(platform-wallet-ffi): topup-from-existing-asset-lock FFI (invita…
shumkov Jul 10, 2026
ce6a04d
feat(platform-wallet-ffi): invitation persistence callback (Sent-invi…
shumkov Jul 10, 2026
4e49286
test(platform-wallet-ffi): pin InvitationEntryFFI ABI size (layout gu…
shumkov Jul 10, 2026
9a6188c
docs(dip15): reviewed Sent-invitations persistence + reclaim spec
shumkov Jul 10, 2026
c1f0c45
feat(swift-sdk): Sent-invitations SwiftData bridge + list (DIP-13)
shumkov Jul 10, 2026
0b12d2d
fix(rs-sdk-ffi): revert over-strict hardened invitation export gate
shumkov Jul 10, 2026
3f498ba
fix(platform-wallet): persist invitation record for non-hardened fund…
shumkov Jul 10, 2026
7b371fe
fix(SwiftExampleApp): add PersistentInvitation to Storage Explorer views
shumkov Jul 10, 2026
4e3a9b0
style(platform-wallet-ffi): sort invitation_persistence re-export
shumkov Jul 10, 2026
30ab23f
Merge branch 'v4.1-dev' into feat/dip15-dashpay-invitations
shumkov Jul 10, 2026
d7ebdaa
feat(swift-sdk): reclaim an unclaimed DashPay invitation as credits
shumkov Jul 10, 2026
3029ffe
feat(platform-wallet): enforce a minimum invitation amount
shumkov Jul 10, 2026
261e2f2
fix(swift-sdk): raise invitation default above the claimable floor
shumkov Jul 10, 2026
d14c02e
fix(swift-sdk): narrow already-consumed classifier to canonical Displ…
shumkov Jul 10, 2026
139a478
fix(swift-sdk): disable Cancel during an in-flight invitation reclaim
shumkov Jul 10, 2026
250976a
docs(swift-example-app): add QA004 invitation-reclaim AI-QA playbook
shumkov Jul 10, 2026
fb31b53
fix(swift-example-app): make the reclaim classifier nonisolated
shumkov Jul 11, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
636 changes: 636 additions & 0 deletions docs/dashpay/DIP15_INVITATIONS_SPEC.md

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions packages/rs-platform-wallet-ffi/src/dashpay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,20 @@ impl platform_wallet::ContactCryptoProvider for ResolverContactCryptoProvider {
.map_err(|e| platform_wallet::PlatformWalletError::InvalidIdentityData(e.to_string()))
}

async fn export_invitation_private_key(
&self,
path: &key_wallet::bip32::DerivationPath,
) -> Result<dashcore::secp256k1::SecretKey, platform_wallet::PlatformWalletError> {
let scalar = self
.signer
.export_invitation_private_key(path)
.map_err(|e| {
platform_wallet::PlatformWalletError::InvalidIdentityData(e.to_string())
})?;
dashcore::secp256k1::SecretKey::from_slice(scalar.as_ref())
.map_err(|e| platform_wallet::PlatformWalletError::InvalidIdentityData(e.to_string()))
}

async fn account_reference(
&self,
path: &key_wallet::bip32::DerivationPath,
Expand Down
618 changes: 618 additions & 0 deletions packages/rs-platform-wallet-ffi/src/invitation.rs

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions packages/rs-platform-wallet-ffi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ pub mod identity_top_up;
pub mod identity_transfer;
pub mod identity_update;
pub mod identity_withdrawal;
pub mod invitation;
pub mod logging;
pub mod managed_identity;
pub mod manager;
Expand Down Expand Up @@ -115,6 +116,7 @@ pub use identity_top_up::*;
pub use identity_transfer::*;
pub use identity_update::*;
pub use identity_withdrawal::*;
pub use invitation::*;
pub use logging::*;
pub use managed_identity::*;
pub use manager::*;
Expand Down
107 changes: 84 additions & 23 deletions packages/rs-platform-wallet-ffi/src/persistence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use key_wallet::account::{Account, AccountType, StandardAccountType};
use key_wallet::bip32::DerivationPath;
use key_wallet::bip32::ExtendedPubKey;
use key_wallet::managed_account::address_pool::{AddressPool, AddressPoolType, PublicKeyType};
use key_wallet::managed_account::managed_account_ref::ManagedAccountRefMut;
use key_wallet::wallet::managed_wallet_info::wallet_info_interface::WalletInfoInterface;
use key_wallet::wallet::managed_wallet_info::ManagedWalletInfo;
use key_wallet::wallet::Wallet;
Expand Down Expand Up @@ -2967,7 +2968,6 @@ fn build_wallet_start_state(
// restored wallet can hold a UTXO whose address the signer can't
// map back to a derivation path, breaking core-to-core spends.
{
use key_wallet::managed_account::managed_account_trait::ManagedAccountTrait;
let pool_entries: &[AccountAddressPoolFFI] =
if entry.core_address_pools.is_null() || entry.core_address_pools_count == 0 {
&[]
Expand Down Expand Up @@ -3004,48 +3004,109 @@ fn build_wallet_start_state(
continue;
}
};
let funds = match account_type {
// Route the persisted pool back to its managed account. Wrapped in
// `ManagedAccountRefMut` because funds accounts and the asset-lock
// key-accounts are distinct types that share `ManagedAccountTrait`.
//
// The asset-lock funding accounts (registration / top-up /
// invitation / …) MUST be restored here: their credit outputs are
// OP_RETURN-payload outputs that never appear as on-chain UTXOs, so
// SPV can never rediscover their used indices — the persisted pool
// is the ONLY thing that carries the next-unused index across a
// restart. Dropping them (the old `_ => None`) reset the pool to
// index 0 every launch; for `IdentityInvitation` that reused the
// EXPORTED one-time voucher key across invitations (a bearer-key
// reuse: one leaked link could then claim every same-key invite).
let funds: Option<ManagedAccountRefMut> = match account_type {
AccountType::Standard {
index,
standard_account_type: StandardAccountType::BIP44Account,
} => wallet_info.accounts.standard_bip44_accounts.get_mut(&index),
} => wallet_info
.accounts
.standard_bip44_accounts
.get_mut(&index)
.map(ManagedAccountRefMut::Funds),
AccountType::Standard {
index,
standard_account_type: StandardAccountType::BIP32Account,
} => wallet_info.accounts.standard_bip32_accounts.get_mut(&index),
AccountType::CoinJoin { index } => {
wallet_info.accounts.coinjoin_accounts.get_mut(&index)
}
} => wallet_info
.accounts
.standard_bip32_accounts
.get_mut(&index)
.map(ManagedAccountRefMut::Funds),
AccountType::CoinJoin { index } => wallet_info
.accounts
.coinjoin_accounts
.get_mut(&index)
.map(ManagedAccountRefMut::Funds),
AccountType::DashpayReceivingFunds {
index,
user_identity_id,
friend_identity_id,
} => wallet_info.accounts.dashpay_receival_accounts.get_mut(
&key_wallet::account::account_collection::DashpayAccountKey {
index,
user_identity_id,
friend_identity_id,
},
),
} => wallet_info
.accounts
.dashpay_receival_accounts
.get_mut(
&key_wallet::account::account_collection::DashpayAccountKey {
index,
user_identity_id,
friend_identity_id,
},
)
.map(ManagedAccountRefMut::Funds),
AccountType::DashpayExternalAccount {
index,
user_identity_id,
friend_identity_id,
} => wallet_info.accounts.dashpay_external_accounts.get_mut(
&key_wallet::account::account_collection::DashpayAccountKey {
index,
user_identity_id,
friend_identity_id,
},
),
} => wallet_info
.accounts
.dashpay_external_accounts
.get_mut(
&key_wallet::account::account_collection::DashpayAccountKey {
index,
user_identity_id,
friend_identity_id,
},
)
.map(ManagedAccountRefMut::Funds),
AccountType::IdentityRegistration => wallet_info
.accounts
.identity_registration
.as_mut()
.map(ManagedAccountRefMut::Keys),
AccountType::IdentityTopUp { registration_index } => wallet_info
.accounts
.identity_topup
.get_mut(&registration_index)
.map(ManagedAccountRefMut::Keys),
AccountType::IdentityTopUpNotBoundToIdentity => wallet_info
.accounts
.identity_topup_not_bound
.as_mut()
.map(ManagedAccountRefMut::Keys),
AccountType::IdentityInvitation => wallet_info
.accounts
.identity_invitation
.as_mut()
.map(ManagedAccountRefMut::Keys),
AccountType::AssetLockAddressTopUp => wallet_info
.accounts
.asset_lock_address_topup
.as_mut()
.map(ManagedAccountRefMut::Keys),
AccountType::AssetLockShieldedAddressTopUp => wallet_info
.accounts
.asset_lock_shielded_address_topup
.as_mut()
.map(ManagedAccountRefMut::Keys),
_ => None,
};
let Some(funds_account) = funds else {
let Some(mut funds_account) = funds else {
pools_dropped += 1;
tracing::warn!(
wallet_id = %hex::encode(entry.wallet_id),
?account_type,
"load: skipping persisted address pool with no matching funds account"
"load: skipping persisted address pool with no matching managed account"
);
continue;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//! Add the `invitations` table (DIP-13 DashPay invitations).
//!
//! Inviter-side records of created invitations, powering the "Sent invitations"
//! status list and (future) reclaim of an unclaimed voucher. **No key material
//! is stored** — the one-time voucher key is HD-derived and re-derivable from
//! `funding_index` on demand.
//!
//! All fields map to explicit columns (the entry is all-primitive), so no
//! opaque lifecycle blob is needed — the row reconstructs directly.

pub fn migration() -> String {
"CREATE TABLE invitations (
wallet_id BLOB NOT NULL,
outpoint BLOB NOT NULL,
status TEXT NOT NULL CHECK (status IN ('created', 'claimed', 'reclaimed')),
funding_index INTEGER NOT NULL,
amount_duffs INTEGER NOT NULL,
expiry_unix INTEGER NOT NULL,
created_at_secs INTEGER NOT NULL,
has_inviter INTEGER NOT NULL,
PRIMARY KEY (wallet_id, outpoint),
FOREIGN KEY (wallet_id) REFERENCES wallet_metadata(wallet_id) ON DELETE CASCADE
);"
.to_string()
}
3 changes: 3 additions & 0 deletions packages/rs-platform-wallet-storage/src/sqlite/persister.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1087,6 +1087,9 @@ fn apply_changeset_to_tx(
if let Some(locks) = cs.asset_locks.as_ref() {
schema::asset_locks::apply(tx, wallet_id, locks)?;
}
if let Some(invitations) = cs.invitations.as_ref() {
schema::invitations::apply(tx, wallet_id, invitations)?;
}
if let Some(balances) = cs.token_balances.as_ref() {
schema::token_balances::apply(tx, wallet_id, balances)?;
}
Expand Down
Loading
Loading