Skip to content

feat: add Paykit server accounts#1084

Open
ben-kaufman wants to merge 11 commits into
codex/paykit-rc33-receiversfrom
codex/paykit-watch-only-accounts
Open

feat: add Paykit server accounts#1084
ben-kaufman wants to merge 11 commits into
codex/paykit-rc33-receiversfrom
codex/paykit-watch-only-accounts

Conversation

@ben-kaufman

@ben-kaufman ben-kaufman commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Description

This PR builds on #1066 to add Paykit Server watch-only accounts:

  • Presents a dedicated watch-only consent step before the normal Pubky authorization screen.
  • Requires x-bitkit-claim=watch-only-account-v1 and the exact /pub/paykit/v0/bitkit/server/:rw capability, rejecting missing, unknown, duplicate, or mismatched companion parameters.
  • Uses Paykit approveAuthWithCompanionClaim, failing closed if companion delivery or normal authorization fails.
  • Allocates monotonic BIP84 accounts, reuses the same incomplete account on retry, and exports the exact versioned 84-byte claim payload.
  • Automatically names new accounts from the requesting service; users can rename them later from Settings.
  • Persists and backs up account metadata, serializes lifecycle and reconciliation changes, and supports disabling or restoring LDK tracking without deleting wallet state.
  • Configures additional-wallet scanning and the rolling 1,000-address lookahead.
  • Updates to Paykit 0.1.0-rc36, LDK Node 0.7.0-rc.56, and Bitkit Core 0.4.2; Bitkit Core now supplies trusted extended-public-key serialization, so BitcoinJ is no longer required.

The relay claim contains only the versioned account index, address type, and serialized xpub. Local names and tracking state are not disclosed. Ordinary Pubky Auth remains unchanged.

References:

QA Notes

Manual Tests

  • Scanner → exact Paykit Server setup request → approve watch-only sharing → complete normal Pubky authorization: the account becomes active.
  • Claimed xpub → externally derive a nonzero receive address → send funds → restart Bitkit: the additional-wallet full scan discovers the funds.
  • Spend the externally received funds from Bitkit.
  • Settings → Advanced → Server Accounts → disable and re-enable tracking: the same account and balance return without allocating another account.
  • Missing, duplicate, unknown, or mismatched companion parameters/capability are rejected; ordinary Pubky Auth remains unchanged.

Automated Checks

  • WatchOnlyAccountClaimCodecTest.kt
  • WatchOnlyAccountStoreTest.kt
  • WatchOnlyAccountRepoTest.kt
  • WatchOnlyAccountLifecycleCoordinatorTest.kt
  • WatchOnlyAccountRestoreTest.kt
  • PubkyAuthApprovalViewModelTest.kt
  • PubkyAuthRequestTest.kt
  • PubkyRepoTest.kt
  • LightningServiceTest.kt
  • ./gradlew compileDevDebugKotlin
  • ./gradlew testDevDebugUnitTest
  • ./gradlew detekt (passes with unrelated existing findings)

Comment thread app/src/main/java/to/bitkit/data/WatchOnlyAccountStore.kt Fixed
Comment thread app/src/main/java/to/bitkit/data/WatchOnlyAccountStore.kt Fixed
Comment thread app/src/main/java/to/bitkit/data/WatchOnlyAccountStore.kt Fixed
Comment thread app/src/main/java/to/bitkit/data/WatchOnlyAccountStore.kt Fixed
Comment thread app/src/main/java/to/bitkit/data/WatchOnlyAccountStore.kt Fixed
Comment thread app/src/main/java/to/bitkit/data/WatchOnlyAccountStore.kt Fixed
Comment thread app/src/main/java/to/bitkit/data/WatchOnlyAccountStore.kt Fixed
Comment thread app/src/main/java/to/bitkit/repositories/WatchOnlyAccountRepo.kt Fixed
Comment thread app/src/test/java/to/bitkit/data/WatchOnlyAccountStoreTest.kt Fixed
@greptile-apps

greptile-apps Bot commented Jul 15, 2026

Copy link
Copy Markdown

Greptile Summary

This PR adds Paykit Server watch-only accounts. The main changes are:

  • Companion-claim validation and a dedicated consent flow.
  • Monotonic BIP84 account allocation and LDK tracking.
  • Account lifecycle, settings, backup, and restore support.
  • Updated Paykit, LDK Node, and Bitkit Core dependencies.

Confidence Score: 5/5

No additional blocking issue qualifies for this follow-up review.

  • No distinct production failure remains beyond the previously reported authorization-completion issue.

Important Files Changed

Filename Overview
app/src/main/java/to/bitkit/ui/screens/profile/PubkyAuthApprovalViewModel.kt Coordinates consent, local authentication, companion delivery, remote authorization, and account activation.
app/src/main/java/to/bitkit/repositories/WatchOnlyAccountRepo.kt Manages watch-only account allocation, claims, lifecycle transitions, and LDK tracking.
app/src/main/java/to/bitkit/services/LightningService.kt Adds watch-only accounts to node configuration and reconciles their tracking state.

Reviews (2): Last reviewed commit: "fix: align Paykit auth UI" | Re-trigger Greptile

@ben-kaufman ben-kaufman marked this pull request as draft July 15, 2026 21:23
@ben-kaufman ben-kaufman force-pushed the codex/paykit-watch-only-accounts branch from 601cdaa to 3e1064d Compare July 16, 2026 11:14
@ben-kaufman ben-kaufman marked this pull request as ready for review July 16, 2026 15:19
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