feat: open payto links on the pay form, and take the checkout over D-Bus out

An app could have nostrod pay an order: it called Pay of
net.catcrafts.Nostro1.Checkout on the system bus, and nostrod paid from
an account the user had chosen, after a dialog of its own. On 2026-11-22
the owner decided that a link takes its place. The app registers for
payto links (RFC 8905), so that an app or a website can hand one to the
desktop, and shows a link as its pay form filled in.

The link:

- The app's desktop entry takes the scheme (Exec=nostro-app %u,
  MimeType=x-scheme-handler/payto), and nostro-app takes an argument
  that is no option as a link: it overwrites it in argv and hands it to
  App::Open once the app has started.
- ReadPaymentLink (Nostro.App:Forms) reads payto://iban/<IBAN> with the
  options amount, receiver-name and message, and refuses a link rather
  than guess at it, in a sentence of the app's own with nothing of the
  link in it. Among what it refuses: an IBAN whose check digits do not
  hold, one of the three options given twice, instruction, a comma in
  the amount, and a name or a message with a code point that is Unshown,
  or Blank and no plain space.
- A link that is read waits until the accounts are read and
  DefaultCheckoutAccount has answered or failed, with a line on the
  accounts' page. Then App::TakeLink fills in the pay form, which says
  in a banner that a link filled it in, and with more than one account
  opens it under the choice of accounts that the form's From row has. A
  link pays nothing: the form's button sends, and polkit's dialog
  confirms as for any payment (design rule 12, and 14, which is new).
- Unshown and Blank are the two tables the worker's Shown() works from.
  They move into Nostro:Utils, where the app's reader asks them too.
  The move is within the library. The reader holds a link's name to
  those two and to no more of Shown(): a name with an & is read, and
  the dialog shows it with a + as it does any name.

The checkout:

- nostrod serves one interface under one bus name. Gone are
  net.catcrafts.Nostro1.Checkout with its XML and its activation file,
  the polkit action Checkout, the module Nostro.Checkout with
  --product=checkout, and the worker's record of orders. That changes
  the published contract after a release, 0.0.0, and design rule 10
  records it as the owner's decision.
- DefaultCheckoutAccount and SetDefaultCheckoutAccount keep their names
  and signatures. The account they keep is where a link's pay form
  starts: nostrod's dialog for choosing it says "have pay links start
  from", the app's setting reads "Pay links start from", and `nostro
  checkout account` prints "pay links start from".
- The D-Bus policy still lets nostrod own the old name: the nostrod of
  0.0.0 asks for it when it starts, and the system files can be newer
  than the Flatpak it runs from. install.sh removes the old name's
  activation file. A user's checkouts.cdb is read by nothing any more,
  and is left where it is.
- The Arch package stops installing the checkout's two files, and its
  pkgrel goes up to 2. Where makepkg -si finds a package of the version
  already built it installs that one again, which would bring the
  activation file back. The guide now says that pkgrel goes up with a
  change to what the package installs.
- Bus::Interface goes too: the worker called it in two places, to tell
  a call to the checkout from one to the main interface.

The review's own files follow. gate0 loses the build of
--product=checkout, and the three lens sections that named the checkout
no longer do, and ask about a link.

The README has "Pay links" in place of "Checkout for apps", and
AGENTS.consumer.md says what the app reads of a link. Its line on
lib/json.hpp no longer gives a release: the file is of none, and the
guide names its commit. The pay form and the accounts' page change only
by a banner each, shown while a link is in play, which
docs/screenshots/take.sh never has: the README's pictures stand.

Tests: ShouldValidateForms reads and refuses links and fills the form
from one. ShouldDriveTheApp opens links against a real nostrod on the
fake bus: before the accounts are known, with no account, with one and
with several, with the accounts known and the system bus gone, for a
second user whose first connection pays their own accounts only, one
that cannot be read, one whose name has an &, and through polkit's
dialog to the payment. It now counts nostrod's answers to hold that the
account pay links start from is read again once a connection is
removed: the check it had there passed without that.
ShouldHandleMoneyAndText holds the two tables at the ends of their
ranges. ShouldServeEveryUser holds that nostrod serves no checkout, that
the bus's policy lets an older nostrod own the old name, and the account
pay links start from. ShouldRunCommands holds the CLI's wording.

The review's gate0 passes at this commit: the version check, 17 tests,
the builds of the CLI, the library, nostrod, the fake system, the app
and its --debug-api build, and five lint runs that report nothing.
tests/coverage.sh reports lines, functions and regions at 100.00%.

Looked at on 2026-11-22 on the made-up system (run fake), on a desktop
(KWin at a scale of 1.85). At 420x760, at --scale 3 --size 360x760 and
at 1100x720 in the light look: a link's pay form under the choice of
accounts, the form after a tap beside that choice, and the accounts'
page while a link waits, its line above the rows that stand in for the
accounts (--bank-delay 10000). At 420x760: that line above what the
page says when the accounts cannot be read (--polkit deny) and above
the accounts themselves (--polkit slow, the link opened in the running
app), the settings' row and page for the account pay links start from,
the sheet for a link that cannot be read, and with --empty the sheet
for no account.
This commit is contained in:
Jorijn van der Graaf 2026-11-22 13:35:51 +01:00
commit b43ab124a6
Signed by: jorijnvdgraaf
GPG key ID: 2937E59CDCC1BCFB
42 changed files with 1234 additions and 994 deletions

View file

@ -33,6 +33,7 @@ The accounts and the people in these pictures are made up.
- The Pay and Request forms send on their button, and your system's password dialog is where you confirm it: read what it says. Closing the dialog pays nothing.
- A connection that its bank lets pay between your own accounts only, as bunq does one made through OAuth, is marked Limited. A payment from it to anyone else is saved as a draft, to approve in your bank's app.
- A `payto://iban/…` link opens the Pay form filled in, see Pay links.
- Press a line of a payment's, a request's or a card's details to copy it.
- With a keyboard: Tab moves, Enter presses, Escape goes back, F5 reads the screen again and Ctrl+F searches.
@ -73,7 +74,7 @@ nostro scheduled {account} [cancel {id}]
nostro draft {account} {to} {name} {amount} {description, optional}
nostro drafts {account} [accept|reject {id}]
nostro cards [freeze|unfreeze|lost|stolen {card id}]
nostro checkout account [{account}] # the account apps may ask you to pay from, see Checkout
nostro checkout account [{account}] # the account a pay link's form starts from in the app
```
- `{account}` is an account's name or its IBAN. `{to}` and `{from}` are an IBAN, an e-mail address, or a phone number starting with `+`.
@ -84,9 +85,17 @@ nostro checkout account [{account}] # the account apps may ask y
[Bunq](https://doc.bunq.com/api-reference/start-here)
## Checkout for apps
## Pay links
An app, such as a shop, can have Nostro pay an order from the account you chose for that, in the app's settings or with `nostro checkout account {account}`, once you confirm the payment with your password. It calls `Pay` of `net.catcrafts.Nostro1.Checkout` on the system bus, which [packaging/dbus/net.catcrafts.Nostro1.Checkout.xml](packaging/dbus/net.catcrafts.Nostro1.Checkout.xml) documents, or links the `Nostro.Checkout` module (`crafter-build --product=checkout`). It gets a payment id back, which is not a receipt: confirm the money arrived with your own bank.
A website or an app can offer a `payto://` link ([RFC 8905](https://www.rfc-editor.org/rfc/rfc8905)) that pays an IBAN, and Nostro opens it on its Pay form, filled in:
```
payto://iban/NL91ABNA0417164300?amount=EUR:12.50&receiver-name=Shop%20BV&message=Order%201234
```
Nostro reads `amount` (in EUR), `receiver-name` and `message`, and refuses a link it cannot read. A link only fills in the form: nothing is paid until you press Pay and confirm it with your password. Whoever offered the link hears nothing back, and sees the payment arrive at their own bank.
Links take the place of the checkout over D-Bus that Nostro 0.0.0 had (`net.catcrafts.Nostro1.Checkout`), which is gone.
## Contributing
@ -107,13 +116,14 @@ What Nostro protects you from, and what it does not:
- Programs you run cannot read your bank connections, and cannot pay or change anything at your bank without your password. They can look: in your desktop session any of them can read your accounts, payments, requests and cards.
- The app is one of those programs. It holds no key, and its Flatpak has no network and none of your files.
- The password dialog is your desktop's. A program could draw one that looks the same, so type your password only for something you asked for, and read what the dialog says.
- A link only fills in the Pay form, but what it fills in is its writer's choice: read who is paid and how much. A link is passed to the app as a program argument, and other users of the computer can read those.
- Over SSH, or in any session without a polkit agent, nothing can ask for your password, so whatever needs it is refused.
- The bank connections are not encrypted on disk: use full-disk encryption.
- An administrator can change what asks for a password, with polkit rules for the actions in [the policy](packaging/system/net.catcrafts.Nostro1.policy). A rule cannot tell Nostro from any other program you run, and one that lets `Pay` or `Change` pass makes one press on a form a payment or a draft.
## License
The library, nostrod, the `nostro` command and the checkout library are LGPL-3.0-only, see [LICENSE](LICENSE). The app is GPL-3.0-only, see [LICENSE.GPL](LICENSE.GPL): the modules `Nostro.Ui`, `Nostro.App` and `Nostro.Ui.Shell`, and `nostro-app`.
The library, nostrod and the `nostro` command are LGPL-3.0-only, see [LICENSE](LICENSE). The app is GPL-3.0-only, see [LICENSE.GPL](LICENSE.GPL): the modules `Nostro.Ui`, `Nostro.App` and `Nostro.Ui.Shell`, and `nostro-app`.
The app is set in Noto Sans, under the SIL Open Font License ([assets/OFL.txt](assets/OFL.txt)); [packaging/licenses/NOTICE](packaging/licenses/NOTICE) lists what else the Flatpaks carry.