Skip to content

Add payment link core and custom URI handling - #469

Open
piatoss3612 wants to merge 8 commits into
mainfrom
rowan/payment-links-core
Open

Add payment link core and custom URI handling#469
piatoss3612 wants to merge 8 commits into
mainfrom
rowan/payment-links-core

Conversation

@piatoss3612

@piatoss3612 piatoss3612 commented Aug 5, 2026

Copy link
Copy Markdown
Member

Problem

Vizor needs the payment-link core without adopting the upstream UI. A link carries an ephemeral mnemonic as an unencrypted bearer secret, so the secret must be saved before funding and inbound URIs must never be logged.

Claiming also opens and syncs an isolated wallet database. That sync shares the process-global Rust sync guard with the main wallet, so concurrent execution previously failed with Sync already running. A locally created claim transaction could also be lost when broadcast returned pending_broadcast or partial_broadcast because the isolated database was deleted.

Solution

  • Add a versioned vizor://payment-link?p=... payload with validation and a 16 KB input limit.
  • Derive a fresh one-time software account without adding it to the main wallet DB, then fund its shielded address.
  • Persist encrypted recovery records before funding and track draft, funded, shared, and archive state.
  • Import claims into a deterministic isolated database, sync from the recorded birthday, and sweep the maximum spendable balance to the recipient.
  • Pause and wait for the main foreground sync before the isolated claim sync, serialize isolated sync requests, then restore sync and mempool observation.
  • Retain the isolated claim database for pending_broadcast and partial_broadcast so normal sync can resubmit the locally created transaction. Delete it after a complete broadcast.
  • Queue multiple inbound links in arrival order instead of overwriting an earlier pending link.
  • Add cold- and warm-launch native URI intake for Android, iOS, macOS, Linux, and Windows. Preserve %u in the packaged Linux AppImage desktop entry.
  • Avoid logging inbound URLs because they contain recovery material.
  • Remove sender reclaim from this scope. It can be reconsidered after the product lifecycle and status-sync behavior are agreed.

Intentionally out of scope

  • Payment-link UI and navigation
  • Sender reclaim
  • Background claim-status monitoring
  • ZIP-321 parsing
  • Universal Links, App Links, or a redirect domain
  • Encryption of the shared bearer link itself

Validation

  • 35 focused Flutter tests passed for payment-link intake/recovery, claim broadcast retention, URI delivery, and sync serialization.
  • Focused flutter analyze passed.
  • bash -n scripts/package-linux-appimage.sh and explicit final-Exec %u checks passed.
  • git diff --check passed.
  • Full-project flutter analyze reports only 23 pre-existing Ironwood unused-declaration warnings outside this change.
  • Windows and Linux native delivery remain statically validated on the macOS host.

@piatoss3612
piatoss3612 force-pushed the rowan/payment-links-core branch from 3d3dd23 to 730e7e2 Compare August 6, 2026 07:48
@piatoss3612
piatoss3612 marked this pull request as ready for review August 6, 2026 08:44

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4165d70c81

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread lib/src/features/payment_links/services/payment_link_service.dart Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3df5c599e0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread lib/app.dart
Comment thread lib/src/features/payment_links/models/vizor_payment_link.dart

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b4e885847e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread lib/src/features/payment_links/services/payment_link_service.dart Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0e813dd6ac

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread lib/src/features/payment_links/services/payment_link_service.dart Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b1dd54bc3f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

final imported = await rust_wallet.importWallet(
mnemonic: link.mnemonic,
bip39Passphrase: '',
birthdayHeight: BigInt.from(link.birthdayHeight),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Bound the imported birthday before starting claim sync

When a user opens an attacker-crafted but structurally valid link, the payload can set birthdayHeight to any positive value (for example, 1), and this untrusted value is imported directly before _runBlockingSync runs. Because the claim sync downloads and scans compact blocks from that birthday while the normal wallet sync is paused, such a link can force a foreground full-chain scan of millions of blocks and make the wallet effectively unusable until it completes or the process is killed. Validate the birthday against a recent, locally derived bound before importing the claim account.

AGENTS.md reference: AGENTS.md:L391-L396

Useful? React with 👍 / 👎.

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.

1 participant