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

@ -7,7 +7,7 @@
# Build in this directory: makepkg -si
pkgname=nostro-system
pkgver=0.1.0
pkgrel=1
pkgrel=2
pkgdesc="System files for nostro, a banking client for Linux whose daemon runs from a Flatpak"
arch=(any)
license=(LGPL-3.0-only)
@ -19,10 +19,8 @@ package() {
install -Dm644 "$system/nostro.sysusers" "$pkgdir/usr/lib/sysusers.d/nostro.conf"
install -Dm644 "$system/net.catcrafts.Nostro1.conf" "$pkgdir/usr/share/dbus-1/system.d/net.catcrafts.Nostro1.conf"
install -Dm644 "$system/net.catcrafts.Nostro1.service" "$pkgdir/usr/share/dbus-1/system-services/net.catcrafts.Nostro1.service"
install -Dm644 "$system/net.catcrafts.Nostro1.Checkout.service" "$pkgdir/usr/share/dbus-1/system-services/net.catcrafts.Nostro1.Checkout.service"
install -Dm644 "$system/net.catcrafts.Nostro1.policy" "$pkgdir/usr/share/polkit-1/actions/net.catcrafts.Nostro1.policy"
install -Dm644 "$system/nostrod.service" "$pkgdir/usr/lib/systemd/system/nostrod.service"
install -Dm755 "$system/nostro" "$pkgdir/usr/bin/nostro"
install -Dm644 "$startdir/../dbus/net.catcrafts.Nostro1.xml" "$pkgdir/usr/share/dbus-1/interfaces/net.catcrafts.Nostro1.xml"
install -Dm644 "$startdir/../dbus/net.catcrafts.Nostro1.Checkout.xml" "$pkgdir/usr/share/dbus-1/interfaces/net.catcrafts.Nostro1.Checkout.xml"
}

View file

@ -1,54 +0,0 @@
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<!-- SPDX-License-Identifier: LGPL-3.0-only -->
<!-- SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts® -->
<!-- nostro's checkout: how an app has the user's nostro pay an order. The bus name net.catcrafts.Nostro1.Checkout on
the system bus, at /net/catcrafts/Nostro1; a Flatpak app asks for it with the finish-arg
system-talk-name=net.catcrafts.Nostro1.Checkout. C++ programs can use the module Nostro.Checkout (nostro built with
product=checkout) instead. A test in nostro keeps this file the interface nostrod serves.
Pay(payeeIban, payeeName, amount, currency, reference, options) returns (paymentId, results)
payeeIban who is paid: an IBAN, the only payee checkout pays
payeeName their name, as the bank and the prompt show it
amount in the currency's smallest unit (1250 is 12.50), more than zero
currency an ISO code: "EUR"
reference the order's own number, not empty: the payment's description, and what tells orders apart
options none yet; keys nostrod does not know are ignored
paymentId the paying bank's id of the payment
results repeated (b): the order was paid by an earlier call, and nothing was paid now. Later versions may
add keys: ignore the ones you do not know.
nostrod pays the order from the account the user chose for checkouts (nostro checkout account), once the user has
confirmed it at a password prompt that shows the amount, the payee, the reference and that account. The app never
names nor sees the account. Allow interactive authorization on the call, make it asynchronously, and give it a
timeout of minutes: the user may take a while.
An order is paid once. Pay with the same payeeIban and reference again, after a timeout or a crash, answers with
the first payment (repeated is true) without asking the user, or waits for the first call while the user is still
at the prompt; the same reference with another amount is refused. A payment id is not a receipt: confirm the money
arrived with your own bank.
Errors:
net.catcrafts.Nostro1.Error.Cancelled the user did not confirm: nothing was paid
net.catcrafts.Nostro1.Error.NoCheckoutAccount the user has no account chosen to pay checkouts from: nothing was paid
net.catcrafts.Nostro1.Error.InvalidArgument the order was refused before anything was paid
net.catcrafts.Nostro1.Error.Bank the bank refused; its message says when it may have paid all the same
net.catcrafts.Nostro1.Error.Failed anything else, such as an earlier call for this order whose outcome was
lost: it may have been paid
org.freedesktop.DBus.Error.AccessDenied the system's policy refused
org.freedesktop.DBus.Error.InteractiveAuthorizationRequired the call did not allow a password prompt
org.freedesktop.DBus.Error.ServiceUnknown nostro is not installed -->
<node>
<interface name="net.catcrafts.Nostro1.Checkout">
<method name="Pay">
<arg type="s" name="payeeIban" direction="in"/>
<arg type="s" name="payeeName" direction="in"/>
<arg type="x" name="amount" direction="in"/>
<arg type="s" name="currency" direction="in"/>
<arg type="s" name="reference" direction="in"/>
<arg type="a{sv}" name="options" direction="in"/>
<arg type="t" name="paymentId" direction="out"/>
<arg type="a{sv}" name="results" direction="out"/>
</method>
</interface>
</node>

View file

@ -54,17 +54,21 @@
well it pays, so that status says nothing of it until it is LOST, STOLEN,
CANCELLED or EXPIRED. SetCardStatus refuses to set such a card ACTIVE or
DEACTIVATED (InvalidArgument): bunq would leave it as it is, without an error
account / chosen (ssssx): the account apps' checkouts pay from (net.catcrafts.Nostro1.Checkout),
as in Accounts; DefaultCheckoutAccount has none until one is chosen, or once
it is gone. An account reached through OAuth cannot pay a shop, and is refused.
account / chosen (ssssx): the account a pay link's form starts from in the Nostro app, as in
Accounts; DefaultCheckoutAccount has none until one is chosen, or once it is
gone. An account reached through OAuth cannot pay a shop, and is refused.
nostrod pays nothing from it by itself: it is a choice kept for the user.
Until 2026-11-22 it paid an app's order at net.catcrafts.Nostro1.Checkout, an
interface nostrod no longer has: a website or an app that wants to be paid
opens a payto:// link, which the Nostro app shows as a payment to make.
Errors, besides org.freedesktop.DBus.Error.AccessDenied (refused, or polkit did not answer) and
org.freedesktop.DBus.Error.InteractiveAuthorizationRequired:
net.catcrafts.Nostro1.Error.InvalidArgument refused before anything was sent
net.catcrafts.Nostro1.Error.Cancelled the user did not authenticate: nothing was done
net.catcrafts.Nostro1.Error.Bank the bank's own refusal
net.catcrafts.Nostro1.Error.Bank the bank's own refusal; its message says when what was asked for
may have been carried out all the same
net.catcrafts.Nostro1.Error.OAuthCannotPay an OAuth connection may only pay the user's own accounts
net.catcrafts.Nostro1.Error.NoCheckoutAccount (checkout) no account is chosen to pay checkouts from
net.catcrafts.Nostro1.Error.Failed anything else; a payment that failed this way may have been made -->
<node>
<interface name="net.catcrafts.Nostro1">

View file

@ -6,11 +6,12 @@ Type=Application
Name=Nostro
GenericName=Banking
Comment=See your bank accounts and pay from them
Exec=nostro-app
Exec=nostro-app %u
Icon=net.catcrafts.Nostro
Terminal=false
Categories=Office;Finance;
Keywords=bank;banking;bunq;payment;money;IBAN;
MimeType=x-scheme-handler/payto;
StartupNotify=false
SingleMainWindow=true
X-KDE-FormFactor=handset;tablet;desktop;

View file

@ -16,9 +16,6 @@
bank connections where no program of theirs can read them; the nostro command and the Nostro app ask it over the
system bus, and your password is asked for before anything is paid or changed.
</p>
<p>
Apps can have Nostro pay an order at checkout, from an account you chose, once you have confirmed the payment.
</p>
</description>
<url type="homepage">https://catcrafts.net</url>
<provides>

View file

@ -12,8 +12,10 @@
# themselves instead)
#
# Running it again updates. nostrod's Flatpak was net.catcrafts.Nostro until the app took that id: this moves the state a
# nostrod installed under it kept, and removes that Flatpak. packaging/arch/PKGBUILD installs the same system files from
# a package; uninstall.sh removes them.
# nostrod installed under it kept, and removes that Flatpak. It also takes away the activation file of
# net.catcrafts.Nostro1.Checkout, a second bus name nostrod had until it lost its checkout over D-Bus: left behind, the
# bus would start nostrod for a name nostrod no longer takes. packaging/arch/PKGBUILD installs the same system files
# from a package; uninstall.sh removes them.
set -eu
here=$(cd "$(dirname "$0")" && pwd)
@ -31,7 +33,7 @@ install -Dm644 "$here/nostro.sysusers" /usr/lib/sysusers.d/nostro.conf
systemd-sysusers /usr/lib/sysusers.d/nostro.conf
install -Dm644 "$here/net.catcrafts.Nostro1.conf" /usr/share/dbus-1/system.d/net.catcrafts.Nostro1.conf
install -Dm644 "$here/net.catcrafts.Nostro1.service" /usr/share/dbus-1/system-services/net.catcrafts.Nostro1.service
install -Dm644 "$here/net.catcrafts.Nostro1.Checkout.service" /usr/share/dbus-1/system-services/net.catcrafts.Nostro1.Checkout.service
rm -f /usr/share/dbus-1/system-services/net.catcrafts.Nostro1.Checkout.service
install -Dm644 "$here/net.catcrafts.Nostro1.policy" /usr/share/polkit-1/actions/net.catcrafts.Nostro1.policy
install -Dm644 "$here/nostrod.service" /etc/systemd/system/nostrod.service
install -Dm755 "$here/nostro" /usr/local/bin/nostro

View file

@ -1,8 +0,0 @@
# SPDX-License-Identifier: LGPL-3.0-only
# SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
# An app's first checkout starts nostrod, through systemd. Install: /usr/share/dbus-1/system-services/
[D-BUS Service]
Name=net.catcrafts.Nostro1.Checkout
Exec=/bin/false
User=nostro
SystemdService=nostrod.service

View file

@ -3,8 +3,12 @@
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<!-- SPDX-License-Identifier: LGPL-3.0-only -->
<!-- SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts® -->
<!-- nostrod owns its two names as the user nostro, and anyone may call them: nostrod answers each caller for their own
bank connections alone, and asks polkit first (net.catcrafts.Nostro1.policy).
<!-- nostrod owns its name as the user nostro, and anyone may call it: nostrod answers each caller for their own bank
connections alone, and asks polkit first (net.catcrafts.Nostro1.policy).
The second name is one nostrod no longer takes. The nostrod of 0.0.0 asks for it when it starts, for a checkout
over D-Bus that later versions do not have, and ends when it is refused: these files may be newer than the
Flatpak nostrod runs from, so it may still own the name. This file lets nobody call it.
Install: /usr/share/dbus-1/system.d/net.catcrafts.Nostro1.conf -->
<busconfig>
<policy user="nostro">
@ -13,6 +17,5 @@
</policy>
<policy context="default">
<allow send_destination="net.catcrafts.Nostro1"/>
<allow send_destination="net.catcrafts.Nostro1.Checkout"/>
</policy>
</busconfig>

View file

@ -8,13 +8,13 @@
Every action is owned by unix-user:nostro, the user nostrod runs as: polkit lets only root or an action's owner
check a call made by another user, or pass the details the dialog shows. $(summary) is what nostrod read for the
call itself, such as the amount, the payee and the account of a payment; the details amount_minor, currency,
counterparty, account_iban, environment, at checkout reference, and for a card card (its id) and status (ACTIVE,
DEACTIVATED, LOST or STOLEN) are there for rules (an amount above which an administrator must approve, say).
counterparty, account_iban, environment, and for a card card (its id) and status (ACTIVE, DEACTIVATED, LOST or
STOLEN) are there for rules (an amount above which an administrator must approve, say).
No action keeps an authorization: polkit ties a kept one to the calling process, so the CLI would ask every time
anyway. Viewing is free in an active session, and nothing else is. Whatever pays (an app's checkout included),
whatever changes anything at the bank (a request for money, a draft, a schedule cancelled, a card frozen), and
whatever changes the bank connections or the account checkouts pay from asks for the user's password every time.
anyway. Viewing is free in an active session, and nothing else is. Whatever pays, whatever changes anything at
the bank (a request for money, a draft, a schedule cancelled, a card frozen), and whatever changes the bank
connections or the account a pay link's form starts from asks for the user's password every time.
That is the default, and it is the strict one on purpose: no program of the user's does anything at their bank
without them. Loosening it is an administrator's choice, made with a rule, and polkit cannot tell one program of
@ -89,18 +89,7 @@
</action>
<action id="net.catcrafts.Nostro1.Connectors">
<description>Add or remove a bank connection, or choose the account apps may ask you to pay from</description>
<message>Authentication is required to $(summary)</message>
<defaults>
<allow_any>auth_self</allow_any>
<allow_inactive>auth_self</allow_inactive>
<allow_active>auth_self</allow_active>
</defaults>
<annotate key="org.freedesktop.policykit.owner">unix-user:nostro</annotate>
</action>
<action id="net.catcrafts.Nostro1.Checkout">
<description>Pay an order an app asks you to pay</description>
<description>Add or remove a bank connection, or choose the account a pay link's form starts from</description>
<message>Authentication is required to $(summary)</message>
<defaults>
<allow_any>auth_self</allow_any>

View file

@ -1,10 +1,10 @@
# SPDX-License-Identifier: LGPL-3.0-only
# SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
#
# nostrod: every local user's bank connections, one worker process per user, behind net.catcrafts.Nostro1 and
# net.catcrafts.Nostro1.Checkout on the system bus. The first call starts it (D-Bus activation), and it ends by itself
# once idle, so an updated Flatpak takes over at the next call. It runs from the net.catcrafts.Nostrod Flatpak as the
# system user nostro, whose home, the state directory, holds the connections: no other user can read it.
# nostrod: every local user's bank connections, one worker process per user, behind net.catcrafts.Nostro1 on the
# system bus. The first call starts it (D-Bus activation), and it ends by itself once idle, so an updated Flatpak takes
# over at the next call. It runs from the net.catcrafts.Nostrod Flatpak as the system user nostro, whose home, the
# state directory, holds the connections: no other user can read it.
#
# The hardening is what bubblewrap, which flatpak runs the daemon in, works under. Not here, because it breaks it:
# RestrictSUIDSGID= (systemd answers openat2() with ENOSYS for it, and bubblewrap 0.13 has no fallback; NoNewPrivileges=

View file

@ -15,6 +15,7 @@ if flatpak info --system --show-metadata net.catcrafts.Nostro 2>/dev/null | grep
flatpak uninstall --system -y --noninteractive net.catcrafts.Nostro 2>/dev/null
fi
flatpak remote-delete --system nostro-local 2>/dev/null
# The Checkout file among them is one an install from before the checkout over D-Bus went left behind.
rm -f /usr/share/dbus-1/system.d/net.catcrafts.Nostro1.conf \
/usr/share/dbus-1/system-services/net.catcrafts.Nostro1.service \
/usr/share/dbus-1/system-services/net.catcrafts.Nostro1.Checkout.service \