feat: send paykit payment proofs - #1178
Conversation
Greptile SummaryThis PR durably correlates incoming private Paykit requests with on-chain or Lightning payments and submits validated payment proofs through Paykit's private outbox. It also connects proof preparation, completion, failure cleanup, and restart reconciliation to the existing send lifecycle.
Confidence Score: 3/5This PR should not merge until pending proof state is invalidated during wallet wipe so sensitive payment correlations cannot be restored into a later wallet. The new singleton repository caches wallet-scoped proof records independently of the keychain lifecycle, allowing a later payment operation to repersist transaction identifiers or Lightning preimages that the wallet wipe had deleted. Files Needing Attention: app/src/main/java/to/bitkit/repositories/PaykitPaymentProofRepo.kt
|
| Filename | Overview |
|---|---|
| app/src/main/java/to/bitkit/repositories/PaykitPaymentProofRepo.kt | Implements durable proof correlation, validation, submission, and reconciliation, but its process-wide cache can resurrect proof data after wallet wipe. |
| app/src/main/java/to/bitkit/repositories/PaykitPaymentProofStore.kt | Serializes pending proofs into wallet-indexed encrypted keychain storage. |
| app/src/main/java/to/bitkit/viewmodels/AppViewModel.kt | Integrates proof preparation and cleanup into payment submission and completes proofs from wallet events. |
| app/src/main/java/to/bitkit/services/PaykitSdkService.kt | Adds the serialized SDK boundary for one-time payment-proof submission. |
| app/src/test/java/to/bitkit/repositories/PaykitPaymentProofRepoTest.kt | Covers proof retry, duplicate suppression, validation, failure cleanup, and on-chain submission, but not cache invalidation across wallet wipe. |
Sequence Diagram
sequenceDiagram
participant UI as Send flow
participant ProofRepo as Payment proof repository
participant Wallet as Bitcoin/Lightning wallet
participant Paykit as Paykit SDK
UI->>ProofRepo: Prepare request and selected endpoint
UI->>Wallet: Send payment
alt On-chain success
Wallet-->>UI: Transaction ID
UI->>ProofRepo: Complete with transaction ID
else Lightning payment
UI->>ProofRepo: Associate payment hash
Wallet-->>UI: Success event and preimage
UI->>ProofRepo: Complete with validated preimage
else Failure or cancellation
UI->>ProofRepo: Remove correlation
end
ProofRepo->>Paykit: Queue payment proof
ProofRepo->>Paykit: Process private outbox
Reviews (1): Last reviewed commit: "feat: send paykit payment proofs" | Re-trigger Greptile
This PR sends a Paykit payment proof back to the requester after Bitkit successfully pays an incoming private payment request.
Description
This PR is stacked on #1172. Companion iOS PR: synonymdev/bitkit-ios#683
Preview
N/A — there are no UI changes.
QA Notes
Manual Tests
Automated Checks
PaykitPaymentProofRepoTest.kt: 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.AppViewModelSendFlowTest.kt: covers proof persistence before private-list consumption and request acceptance, plus successful and failed payment lifecycle handling.git diff --checkpassed.