Skip to content

feat: send paykit payment proofs - #683

Open
ben-kaufman wants to merge 5 commits into
masterfrom
codex/paykit-payment-proofs
Open

feat: send paykit payment proofs#683
ben-kaufman wants to merge 5 commits into
masterfrom
codex/paykit-payment-proofs

Conversation

@ben-kaufman

@ben-kaufman ben-kaufman commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

This PR sends a Paykit payment proof back to the requester after Bitkit successfully pays an incoming private payment request.

Description

  1. Persists the payer identity, request, and selected endpoint before request acceptance, then associates the Lightning payment hash before sending so restart recovery keeps the correct correlation.
  2. Persists successful on-chain transaction IDs and validated Lightning preimages before submitting them against the original one-time request and exact endpoint.
  3. Uses Paykit's durable private outbox, retries incomplete submissions during normal request refresh, and suppresses duplicate proofs already recorded by the SDK.
  4. Preserves earlier in-flight correlations across retries, clears the request after one proof is queued, and reads the secure store directly so wallet wipes cannot resurrect cached proof state.
  5. Attempts immediate SDK delivery if persisting a completed proof fails, without adding any user-facing UI.

This PR is stacked on #676. Companion Android PR: synonymdev/bitkit-android#1178

Linked Issues/Tasks

N/A

Screenshot / Video

N/A — there are no UI changes.

QA Notes

Manual Tests

  • 1. iOS → create a private request for Android → Android receives and pays on regtest: iOS records the proof against the exact request, endpoint, and transaction ID.
  • 2. Android → create a private request for iOS → iOS receives and pays on regtest: Android records the proof against the exact request, endpoint, and transaction ID.

Automated Checks

  • PaykitPaymentProofServiceTests.swift: 8 tests cover restart retry, duplicate suppression, invalid Lightning preimage rejection, failed-payment cleanup, exact on-chain proof submission, overlapping retries, wallet-store clearing, and completed-proof persistence failure.
  • Focused iOS proof tests passed: 8 tests, 0 failures.
  • Final iOS simulator Debug test build passed.
  • SwiftFormat and git diff --check passed.
@greptile-apps

This comment has been minimized.

Comment thread Bitkit/Services/PaykitPaymentProofService.swift Outdated
Comment thread Bitkit/Views/Wallets/Send/SendConfirmationView.swift
@ben-kaufman
ben-kaufman force-pushed the codex/paykit-payment-proofs branch from 8801387 to c5d04c7 Compare August 24, 2026 18:33

@ovitrif ovitrif left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On-chain payment proofs cannot recover after a store-load failure, so a successful send can still leave the requester without proof.

Comment thread Bitkit/Services/PaykitPaymentProofService.swift
Base automatically changed from codex/paykit-payment-request-ui to master August 25, 2026 17:02
ovitrif
ovitrif previously approved these changes Aug 25, 2026

@ovitrif ovitrif left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QA Notes

Ran on iPhone 17 Pro simulator and Pixel_9a emulator on regtest.

  • iOS created a private request for Android, Android paid, and iOS recorded the proof against that request.
  • Android created a private request for iOS, iOS paid, and Android recorded the proof against that request.

Approve.

@ben-kaufman

Copy link
Copy Markdown
Contributor Author

Added the cross-platform proof-state hardening in c3f2d8c: corrupt persisted proof state is discarded instead of permanently blocking reconciliation, empty state removes the Keychain entry, and the frequent refresh path returns before calling Paykit when there is nothing to reconcile. The full payment-proof suite passes 22/22 on the restacked subscriptions head.

@ben-kaufman
ben-kaufman force-pushed the codex/paykit-payment-proofs branch from c3f2d8c to 281b865 Compare August 31, 2026 18:30
@ben-kaufman

Copy link
Copy Markdown
Contributor Author

Follow-up after the final cleanup: the hardening commit is now 281b8654 (signed). I removed the unnecessary decoder-only test hook while keeping the meaningful regression that proves empty reconciliation skips the Paykit SDK. PaykitPaymentProofServiceTests: 21/21 passing.

@ben-kaufman

Copy link
Copy Markdown
Contributor Author

CI note: the remaining pubky_paykit red check is test-harness instability rather than a proof-code failure. Its three internal attempts failed at Appium session creation, waiting for the generic send slider, and teardown/profile cleanup respectively; the final attempt had already dragged the send slider successfully. The same Paykit staging scenario passes on stacked PR #685 with this exact proof implementation. GitHub currently refuses an isolated rerun because this workflow’s unrelated local E2E job is still queued; I will rerun the failed job once the workflow finishes.

@ovitrif ovitrif left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants