Skip to content

feat: send paykit payment proofs - #683

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

feat: send paykit payment proofs#683
ben-kaufman wants to merge 4 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 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.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants