Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
8d4ed2b
fix: stop profile deletion after incomplete cleanup
ben-kaufman Oct 25, 2026
76e0f80
chore: rename changelog fragment
ben-kaufman Oct 25, 2026
a062618
fix: preserve sessions after uncertain profile deletion
ben-kaufman Oct 25, 2026
2fee532
fix: reject stale SDK waiters before wipe enqueue
ben-kaufman Oct 26, 2026
3a7210b
chore: rename changelog fragment
ben-kaufman Oct 26, 2026
8b6cd5d
fix: bind profile removal to its original owner
ben-kaufman Oct 27, 2026
2ca19ed
chore: rename changelog fragment
ben-kaufman Oct 27, 2026
7e172c6
Merge current profile recovery parent
ben-kaufman Oct 27, 2026
8592e58
Merge validated profile cleanup parent
ben-kaufman Oct 27, 2026
c18e747
Merge latest profile recovery parent
ben-kaufman Oct 27, 2026
6c0a160
Merge validated profile cleanup parent into SDK queue fix
ben-kaufman Oct 27, 2026
0eef45d
Integrate recovery updates and harden profile removal
ben-kaufman Oct 27, 2026
60b1485
Merge finalized recovery dependency
ben-kaufman Oct 27, 2026
91379a5
test: synchronize profile admission and keyboard setup
ben-kaufman Oct 28, 2026
f1fa5ee
fix: retain receipt contacts during profile cleanup
ben-kaufman Oct 28, 2026
1f1bead
fix: drain receipt and restore writes before wallet wipe
ben-kaufman Oct 28, 2026
c26d7b1
Merge current profile recovery parent
ben-kaufman Oct 28, 2026
3f88708
Merge current profile cleanup parent
ben-kaufman Oct 28, 2026
86fb0c5
Merge validated profile cleanup dependency
ben-kaufman Oct 28, 2026
a2b2186
fix: refuse profile removal with active subscriptions
ben-kaufman Oct 29, 2026
ef1286d
Merge active-subscription cleanup safeguards into SDK queue fix
ben-kaufman Oct 29, 2026
9519507
Merge active subscription guards into profile removal recovery
ben-kaufman Oct 29, 2026
acc028f
test: synchronize profile creation admission setup
ben-kaufman Oct 29, 2026
08f2990
test: expose reservation cleanup acknowledgement fault
ben-kaufman Oct 29, 2026
b426e65
fix: allow local disconnect when subscriptions block removal
ben-kaufman Oct 29, 2026
2aed345
fix: describe local disconnect without remote state promises
ben-kaufman Oct 29, 2026
6665a44
Explain finite subscription expiration before profile removal
ben-kaufman Oct 29, 2026
2df5bad
Merge current profile deletion parent into acknowledged cleanup
ben-kaufman Oct 29, 2026
35e267d
Merge current profile cleanup parent into atomic SDK queue
ben-kaufman Oct 29, 2026
81ef10a
Merge current SDK queue parent and preserve profile admission
ben-kaufman Oct 29, 2026
b14d5a1
Merge validated deletion parent into strict profile cleanup
ben-kaufman Oct 29, 2026
53b67b0
Merge validated cleanup parent into atomic SDK admission
ben-kaufman Oct 29, 2026
594688f
Merge #1125 while preserving profile removal admission
ben-kaufman Oct 29, 2026
6e5dccb
Require acknowledged endpoint withdrawal with Paykit RC3
ben-kaufman Oct 30, 2026
2c6cbdb
test: isolate auth cancellation admission
ben-kaufman Oct 30, 2026
de683f3
Merge current deletion recovery parent into profile cleanup
ben-kaufman Oct 30, 2026
6dca681
chore: merge current profile cleanup recovery
ben-kaufman Oct 30, 2026
0e4ab09
fix: retain original grant cleanup and disabled sharing withdrawals
ben-kaufman Oct 30, 2026
3e49570
fix: integrate profile removal with RC4 sharing
ben-kaufman Oct 30, 2026
d6c1d9a
fix: retire unavailable profile retries at confirmation
ben-kaufman Oct 31, 2026
f6b4587
fix: register public sharing intent before admission
ben-kaufman Oct 31, 2026
630be75
fix: retry unfinished public profile cleanup
ben-kaufman Oct 31, 2026
dd180c6
Merge validated deletion parent into profile cleanup
ben-kaufman Oct 31, 2026
7e0c8e5
chore: merge validated profile cleanup parent
ben-kaufman Oct 31, 2026
fd5d978
fix: retain allowance recovery during profile removal
ben-kaufman Nov 1, 2026
1cd0730
Merge validated restore parent while preserving cleanup composition
ben-kaufman Nov 1, 2026
3991f3a
merge: incorporate validated profile recovery parent
ben-kaufman Nov 1, 2026
3f90df9
Merge current profile cleanup and allowance admission
ben-kaufman Nov 1, 2026
429a8c4
fix: retain profile ownership through recovery
ben-kaufman Nov 1, 2026
e8aaa4b
merge: preserve cached backups during profile cleanup
ben-kaufman Nov 3, 2026
14ce885
Merge cached backup read protection and use explicit paste in profile…
ben-kaufman Nov 3, 2026
2bc43e9
Merge cached backup protection and profile clipboard checks
ben-kaufman Nov 3, 2026
ce0784b
Merge scheduled backup completion fix into profile cleanup
ben-kaufman Nov 3, 2026
9fbc9e0
Merge scheduled backup completion fix into SDK wipe queue
ben-kaufman Nov 3, 2026
40be059
Merge scheduled backup completion and clipboard diagnostics
ben-kaufman Nov 3, 2026
21d6a22
merge: compose backup authentication transport recovery
ben-kaufman Nov 3, 2026
5f5fcf5
merge: compose backup authentication transport recovery
ben-kaufman Nov 3, 2026
21d5ee2
Merge backup authentication transport recovery
ben-kaufman Nov 3, 2026
063bdef
Merge durable wipe recovery into profile cleanup
ben-kaufman Nov 4, 2026
39ecf15
Merge durable wipe recovery into SDK queue ownership
ben-kaufman Nov 5, 2026
6de9ad9
Merge expired wallet cleanup admission fix
ben-kaufman Nov 5, 2026
6306930
Merge expired wallet cleanup admission fix
ben-kaufman Nov 5, 2026
91eb82b
Merge durable wallet wipe with profile admission
ben-kaufman Nov 5, 2026
fc4b5b7
Merge expired cleanup admission into profile recovery
ben-kaufman Nov 5, 2026
f9890dc
fix: finish blocked-peer cleanup and wipe reservations by scope
ben-kaufman Nov 5, 2026
065a4c6
docs: correct blocked-peer cleanup journey sequence
ben-kaufman Nov 5, 2026
fb8cddb
test: await both Jade connection teardown effects
ben-kaufman Nov 5, 2026
1491b85
Merge metadata recovery into profile cleanup
ben-kaufman Nov 5, 2026
814a837
Merge metadata recovery into SDK wipe queue
ben-kaufman Nov 6, 2026
25ac19c
fix: report Paykit operation and profile cleanup failures accurately
ben-kaufman Nov 6, 2026
43c72a5
Merge saved-contact payment routing into profile recovery
ben-kaufman Nov 6, 2026
0f2b654
fix: restore contact actions for the original session
ben-kaufman Nov 6, 2026
bb26b03
fix: preserve external payments during Send startup
ben-kaufman Nov 6, 2026
e9354eb
test: wait for scheduled wallet backup failure
ben-kaufman Nov 7, 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
2 changes: 1 addition & 1 deletion Bitkit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1200,7 +1200,7 @@
repositoryURL = "https://github.com/pubky/paykit-rs";
requirement = {
kind = exactVersion;
version = "0.1.1-rc2";
version = "0.1.1-rc4";
};
};
18D65DFE2EB9649F00252335 /* XCRemoteSwiftPackageReference "vss-rust-client-ffi" */ = {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

161 changes: 97 additions & 64 deletions Bitkit/AppScene.swift
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@ struct PaykitPaymentRequestPollingSchedule {
enum AppRootContent: Equatable {
case wipeGate
case trezorEmulatorTest
case profileRecovery
case migrationLoading
case recovery
case criticalUpdate
Expand All @@ -381,14 +382,18 @@ enum AppRootContent: Equatable {
isTrezorEmulatorTesting: Bool,
isShowingMigrationLoading: Bool,
isRecoveryShown: Bool,
hasCriticalUpdate: Bool
hasCriticalUpdate: Bool,
isProfileRecoveryBlocking: Bool = false
) -> AppRootContent {
if isWipeGateUp {
return .wipeGate
}
if isTrezorEmulatorTesting {
return .trezorEmulatorTest
}
if isProfileRecoveryBlocking, !hasCriticalUpdate {
return .profileRecovery
}
if isShowingMigrationLoading {
return .migrationLoading
}
Expand Down Expand Up @@ -541,21 +546,24 @@ struct AppScene: View {
private func configurePrivatePaykitContactResolvers() {
CoreService.shared.activity.setPrivatePaykitContactResolvers(
invoice: { paymentHash in
await PrivatePaykitService.shared.contactPublicKey(forPrivateInvoicePaymentHash: paymentHash)
await PrivatePaykitService.shared.contactPublicKeyForReceipt(paymentHash: paymentHash)
},
onchainAddresses: { @MainActor address, outputAddresses in
let identity = pubkyProfile.publicKey
let contacts = paykitPaymentRequestManager.receivedPaymentContacts
guard (try? ProfileOperationAdmission.shared.checkReceiptAttribution()) != nil else { return nil }
let reservations = PrivatePaykitAddressReservationStore.shared
let reservationRevision = await reservations.attributionRevision
guard let combined = try? await contacts.includingReservations(for: outputAddresses, lookup: {
try await reservations.contactPublicKeyForAttribution(forReservedAddress: $0)
}), pubkyProfile.authState == .authenticated,
PubkyPublicKeyFormat.matches(identity, pubkyProfile.publicKey),
contacts == paykitPaymentRequestManager.receivedPaymentContacts,
await reservations.attributionRevision == reservationRevision
let revision = await reservations.attributionRevision
let contacts = pubkyProfile.authState == .authenticated
? paykitPaymentRequestManager.receivedPaymentContacts : PaykitReceivedPaymentContacts()
guard let combined = try? await reservations.contactsForReceipt(
contacts,
outputAddresses: outputAddresses,
expectedRevision: revision
)
else { return nil }
return combined.contact(receivingAddress: address, outputAddresses: outputAddresses)
},
receiptOperation: { operation in
try await ProfileOperationAdmission.shared.withReceiptAttribution(operation)
}
)
}
Expand Down Expand Up @@ -585,7 +593,7 @@ struct AppScene: View {
) {
config in AppUpdateSheet(config: config)
}
.task(priority: .userInitiated, setupTask)
.task(id: pubkyProfile.removalRecovery.blocksWalletStartup, priority: .userInitiated, setupTask)
.task(id: [
scenePhase == .active,
wallet.walletExists == true,
Expand Down Expand Up @@ -712,7 +720,14 @@ struct AppScene: View {
return
}
guard let pk = activatedAutomaticPaykitIdentity else { return }
Task { await paykitAllowanceManager.activate(identity: pk) }
do {
try pubkyProfile.scheduleAutomaticPaykitSession { session in
guard areAllowancesEnabled, PubkyPublicKeyFormat.matches(pk, session.publicKey) else { return }
await paykitAllowanceManager.activate(identity: pk)
}
} catch {
Logger.debug("Allowance activation was not admitted: \(error)", context: "AppScene")
}
}
.onChange(of: pubkyProfile.isDeletingProfile) { _, isDeleting in
if !isDeleting {
Expand Down Expand Up @@ -884,7 +899,7 @@ struct AppScene: View {
}

private var isLockedForDeepLinks: Bool {
settings.pinEnabled && !isPinVerified
pubkyProfile.removalRecovery.blocksWalletStartup || (settings.pinEnabled && !isPinVerified)
}

private var mainContent: some View {
Expand All @@ -894,12 +909,15 @@ struct AppScene: View {
isTrezorEmulatorTesting: Env.isTrezorEmulatorTesting,
isShowingMigrationLoading: migrations.isShowingMigrationLoading,
isRecoveryShown: showRecoveryScreen,
hasCriticalUpdate: hasCriticalUpdate
hasCriticalUpdate: hasCriticalUpdate,
isProfileRecoveryBlocking: pubkyProfile.removalRecovery.blocksWalletStartup
) {
case .wipeGate:
WipeGateView(coordinator: wipeCoordinator)
case .trezorEmulatorTest:
trezorEmulatorTestContent
case .profileRecovery:
NavigationStack { ProfileRemovalRecoveryView() }
case .migrationLoading:
migrationLoadingContent
case .recovery:
Expand All @@ -912,7 +930,9 @@ struct AppScene: View {
}

// The launch that would remove the splash does not run behind the wipe gate.
if !Env.isTrezorEmulatorTesting, !wipeCoordinator.isGateUp, !removeSplash, !session.skipSplashOnce {
if !Env.isTrezorEmulatorTesting, !wipeCoordinator.isGateUp, !pubkyProfile.removalRecovery.blocksWalletStartup, !removeSplash,
!session.skipSplashOnce
{
SplashView()
.opacity(hideSplash ? 0 : 1)
}
Expand Down Expand Up @@ -1074,7 +1094,7 @@ struct AppScene: View {
}
}

guard wallet.walletExists == true, !wipeCoordinator.isGateUp else { return }
guard wallet.walletExists == true, !wipeCoordinator.isGateUp, !pubkyProfile.removalRecovery.blocksWalletStartup else { return }

// Don't start wallet if we're in recovery mode
guard !showRecoveryScreen else { return }
Expand Down Expand Up @@ -1104,6 +1124,7 @@ struct AppScene: View {
}

private func startWallet(completingBackupRestore: Bool = false, playsErrorHaptic: Bool = true) async {
guard !pubkyProfile.removalRecovery.blocksWalletStartup else { return }
let hasPendingRestore = BackupService.shared.hasPendingWalletRestore()
guard !WalletBackupRestoreGate.blocksWalletStart(
isRestoreRunning: isWalletBackupRestoreRunning,
Expand Down Expand Up @@ -1159,7 +1180,9 @@ struct AppScene: View {

// Ahead of the orphaned keychain check, migration and wallet state: a pending wipe resumes here, even after a
// reinstall, and a lockout state that cannot be read holds the launch.
guard await wipeCoordinator.prepareForLaunch(), checkOrphanedKeychain() else { return }
guard await wipeCoordinator.prepareForLaunch() else { return }
pubkyProfile.refreshRemovalRecovery()
guard !pubkyProfile.removalRecovery.blocksWalletStartup, checkOrphanedKeychain() else { return }
await continueLaunch()
}

Expand Down Expand Up @@ -1245,26 +1268,32 @@ struct AppScene: View {
}

private func restoreWalletBackupAndStart() async {
guard !isWalletBackupRestoreRunning, !wipeCoordinator.isGateUp else { return }
guard !isWalletBackupRestoreRunning, !wipeCoordinator.isGateUp, !pubkyProfile.removalRecovery.blocksWalletStartup else { return }
isWalletBackupRestoreRunning = true
walletIsInitializing = true
didWalletBackupRestoreFail = false
defer { isWalletBackupRestoreRunning = false }

let didRestore: Bool = if BackupService.shared.hasPendingWalletRestore() {
await restoreVssBackup()
} else {
await restoreFromMostRecentBackup()
}
guard didRestore else {
do {
let didRestore = try await ProfileOperationAdmission.shared.withWalletRestore {
let restored: Bool = if BackupService.shared.hasPendingWalletRestore() {
await restoreVssBackup()
} else {
await restoreFromMostRecentBackup()
}
guard restored else { return false }

widgets.loadSavedWidgets()
widgets.objectWillChange.send()
pubkyProfile.scheduleInitializationAfterRestore()
await startWallet(completingBackupRestore: true)
return true
}
didWalletBackupRestoreFail = !didRestore
} catch {
Logger.warn("Wallet backup restore could not complete: \(error)", context: "AppScene")
didWalletBackupRestoreFail = true
return
}

widgets.loadSavedWidgets()
widgets.objectWillChange.send()
pubkyProfile.scheduleInitializationAfterRestore()
await startWallet(completingBackupRestore: true)
}

private func retryWalletStart() async {
Expand All @@ -1279,7 +1308,7 @@ struct AppScene: View {
}

private func retryPendingWalletRestoreIfNeeded() -> Bool {
if isWalletBackupRestoreRunning {
if pubkyProfile.removalRecovery.blocksWalletStartup || ProfileOperationAdmission.shared.isWalletWiping || isWalletBackupRestoreRunning {
return true
}
guard BackupService.shared.hasPendingWalletRestore() else { return false }
Expand Down Expand Up @@ -1318,7 +1347,9 @@ struct AppScene: View {

if shouldRestoreRN {
do {
try await MigrationsService.shared.restoreFromRNRemoteBackup(mnemonic: mnemonic, passphrase: passphrase)
try await MigrationsService.shared.restoreFromRNRemoteBackup(mnemonic: mnemonic, passphrase: passphrase) {
try await ProfileOperationAdmission.shared.withWalletRestore($0)
}
} catch {
Logger.error("RN remote backup restore failed: \(error)", context: "AppScene")
// Fall back to VSS
Expand Down Expand Up @@ -2139,39 +2170,41 @@ struct AppScene: View {
}

private func startAutomaticPaykitSession() {
guard let session = pubkyProfile.automaticPaykitSession,
!PubkyPublicKeyFormat.matches(session.publicKey, activatedAutomaticPaykitIdentity)
else { return }
let pk = session.publicKey
activatedAutomaticPaykitIdentity = pk
Task {
if areAllowancesEnabled {
await paykitAllowanceManager.activate(identity: pk)
} else {
paykitAllowanceManager.pause(identity: pk)
}
await handlePendingPaykitSubscriptionNotification()
guard pubkyProfile.automaticPaykitSession == session else {
// A deletion or session change cut this start short; let the session's next appearance run it again.
if activatedAutomaticPaykitIdentity == pk {
activatedAutomaticPaykitIdentity = nil
do {
try pubkyProfile.scheduleAutomaticPaykitSession { session in
let pk = session.publicKey
guard !PubkyPublicKeyFormat.matches(pk, activatedAutomaticPaykitIdentity) else { return }
activatedAutomaticPaykitIdentity = pk
if areAllowancesEnabled {
await paykitAllowanceManager.activate(identity: pk)
} else {
paykitAllowanceManager.pause(identity: pk)
}
await handlePendingPaykitSubscriptionNotification()
guard pubkyProfile.automaticPaykitSession == session else {
// A deletion or session change cut this start short; let the session's next appearance run it again.
if activatedAutomaticPaykitIdentity == pk {
activatedAutomaticPaykitIdentity = nil
}
// A new session for the same key may already have appeared while this one waited.
startAutomaticPaykitSession()
return
}
try? await contactsManager.loadContacts(for: pk)
if !PaykitFeatureFlags.isUIEnabled, wallet.walletExists == true {
await retryPendingPaykitEndpointRemoval()
}
guard isPaykitSceneActive, pubkyProfile.authState == .authenticated,
PubkyPublicKeyFormat.matches(pk, pubkyProfile.publicKey)
else { return }
await refreshPrivateOnlyPaykitApp()
await refreshIncomingPaykitPaymentRequests(presentItems: false, onlyWhileActive: true)
if PaykitSubscriptionNotificationTargetStore.load() == nil {
await presentNextIncomingPaykitItem()
}
// A new session for the same key may already have appeared while this one waited.
startAutomaticPaykitSession()
return
}
try? await contactsManager.loadContacts(for: pk)
if !PaykitFeatureFlags.isUIEnabled, wallet.walletExists == true {
await retryPendingPaykitEndpointRemoval()
}
guard isPaykitSceneActive, pubkyProfile.authState == .authenticated,
PubkyPublicKeyFormat.matches(pk, pubkyProfile.publicKey)
else { return }
await refreshPrivateOnlyPaykitApp()
await refreshIncomingPaykitPaymentRequests(presentItems: false, onlyWhileActive: true)
if PaykitSubscriptionNotificationTargetStore.load() == nil {
await presentNextIncomingPaykitItem()
}
} catch {
Logger.debug("Automatic Paykit startup was not admitted: \(error)", context: "AppScene")
}
}

Expand Down
30 changes: 23 additions & 7 deletions Bitkit/MainNavView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,9 @@ struct MainNavView: View {
} else if let profile = contactsManager.pendingImportProfile {
ContactImportOverviewView(
profile: profile,
contacts: contactsManager.pendingImportContacts
contacts: contactsManager.pendingImportContacts,
importGeneration: contactsManager.importGeneration,
owner: pubkyProfile.removalPresentationOwner
)
} else {
missingPendingImportView(fallbackRoute: .payContacts)
Expand All @@ -577,7 +579,11 @@ struct MainNavView: View {
} else if let fallbackRoute = fallbackRouteForMissingPendingImport(hasPendingImport: contactsManager.hasPendingImport) {
missingPendingImportView(fallbackRoute: fallbackRoute)
} else {
ContactImportSelectView(contacts: contactsManager.pendingImportContacts)
ContactImportSelectView(
contacts: contactsManager.pendingImportContacts,
importGeneration: contactsManager.importGeneration,
owner: pubkyProfile.removalPresentationOwner
)
}
case let .addContact(publicKey):
if isPaykitUIActive {
Expand All @@ -592,7 +598,9 @@ struct MainNavView: View {
paykitDisabledRedirectView
}
case .profile:
if !isPaykitUIActive {
if pubkyProfile.removalRecovery != .ready {
ProfileRemovalRecoveryView()
} else if !isPaykitUIActive {
ComingSoonScreen()
} else if let initializationErrorMessage = pubkyProfile.initializationErrorMessage {
pubkyInitializationErrorView(message: initializationErrorMessage)
Expand All @@ -602,25 +610,33 @@ struct MainNavView: View {
ProfileDestinationView(hasSeenIntro: app.hasSeenProfileIntro)
}
case .profileIntro:
if isPaykitUIActive {
if pubkyProfile.removalRecovery != .ready {
ProfileRemovalRecoveryView()
} else if isPaykitUIActive {
ProfileIntroView()
} else {
ComingSoonScreen()
}
case .pubkyChoice:
if isPaykitUIActive {
if pubkyProfile.removalRecovery != .ready {
ProfileRemovalRecoveryView()
} else if isPaykitUIActive {
PubkyChoiceView()
} else {
paykitDisabledRedirectView
}
case .createProfile:
if isPaykitUIActive {
if pubkyProfile.removalRecovery != .ready {
ProfileRemovalRecoveryView()
} else if isPaykitUIActive {
CreateProfileView()
} else {
paykitDisabledRedirectView
}
case .editProfile:
if isPaykitUIActive {
if pubkyProfile.removalRecovery != .ready {
ProfileRemovalRecoveryView()
} else if isPaykitUIActive {
EditProfileView()
} else {
paykitDisabledRedirectView
Expand Down
Loading
Loading