feat(app): add the Nostro app, a window for phones and desktops
Linux phones have no banking apps, and a command line is no answer on a
phone. The app does everything the nostro command does and, like it, only
talks to nostrod: it holds no key and no token.
- Nostro.Ui, a toolkit whose screens are functions that fill a frame, ported
from imsd-messages ca5cd72d; Nostro.App, the app's state, forms and screens;
Nostro.Ui.Shell, which puts them on a Wayland window with Crafter.Graphics;
nostro-app; and Nostro.DebugCommands for the --debug-api build.
- Client: every method also in an asynchronous form for an sd-event loop,
with DaemonMissing and OutcomeUnknown.
- nostrod's Flatpak is net.catcrafts.Nostrod now and the app takes
net.catcrafts.Nostro; install.sh moves the state. The app's Flatpak, both
Flatpaks cross-built for aarch64, and the licence texts they carry.
- nostro-fake-system, a made-up bus and bank with a real nostrod on them, to
look at the app against. The README's screenshots are taken on it.
- The nostro command: an API key's environment is the key's own to say, so
--sandbox is for bunq-oauth alone, and a virtual card is listed as VIRTUAL.
The published contract changes in three places, before any release (design
rule 10):
- Transactions' query takes `stored`: answered from what nostrod has stored,
without asking the bank. The app searches with it; before, every search was
a call to bunq.
- AddBunq's `environment` no longer chooses over what the key says of itself:
a key of the other environment is refused.
- SetCardStatus refuses to freeze or unfreeze a virtual card. bunq reports one
as DEACTIVATED however well it pays, and leaves it as it is when asked,
without an error.
The app is GPL-3.0-only, the library stays LGPL-3.0-only, and no code moved
from one to the other (design rule 13). Transaction's schema is unchanged.
Verified: the 17 tests pass with every line, function and region of what they
link run, and the five lint runs are clean. Every screen was looked at on the
made-up system, at a phone's and a desktop's sizes in the light and the dark
look, on Plasma under Wayland. What is said of bunq's cards comes from its
sandbox, with throwaway users, and from one real virtual card. Known to have
been used against production: connecting, and reading accounts, payments and
cards. Not known to have been tried: a payment from the app against bunq,
OAuth against bunq, and anything on a phone.
Building the app takes --graphics=, a Crafter.Graphics checkout on its branch
claude/nostro-app, until that branch is merged and pinned here.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-19 12:27:14 +01:00
|
|
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
|
// SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
|
|
|
|
|
|
|
|
|
|
export module Nostro.App:App;
|
|
|
|
|
|
|
|
|
|
import std;
|
|
|
|
|
import Nostro;
|
|
|
|
|
import Nostro.Ui;
|
|
|
|
|
import :Banks;
|
|
|
|
|
import :Format;
|
|
|
|
|
import :Forms;
|
|
|
|
|
import :Errors;
|
|
|
|
|
|
|
|
|
|
// Nostro's window without the window: what it knows of the user's banks, where the user is in it, what is being
|
|
|
|
|
// filled in and what is under way, and the screens built from that. It asks nostrod through the asynchronous Client
|
|
|
|
|
// and never waits for it: a call's answer changes the state and asks for a new frame. Nothing here draws or reads a
|
|
|
|
|
// device (that is Nostro.Ui.Shell's), so a test builds a frame, reads what it says and taps it by name.
|
|
|
|
|
//
|
|
|
|
|
// The rules that keep a bank's client honest are here. A press acts on what it went down on, and every action names
|
|
|
|
|
// what it is about by value: an IBAN or the bank's id, never a place in a list. One change at a time: while one is
|
|
|
|
|
// under way its sheet covers the screen, so nothing else can be asked for and nothing is sent twice. A payment from
|
fix: close what the security review before the first release found
A review of the tree and its history before they are published found no
key and no bank data in them. It did find these, each closed here.
The password dialog could be emptied (daemon). Shown(), which makes a
payee's name fit for polkit's dialog, let an & through. GNOME's older
agent (polkit-gnome) and MATE's put the message into Pango markup
unescaped, where a bare & fails to parse and leaves the dialog without
a message: paying "Tom & Jerry", or an order an app names so at
checkout, asked for the password and showed no amount and no payee.
Line and paragraph separators passed too. Shown() now shows & as +,
leaves out what draws nothing or places text (control and format
characters, the separators, what Unicode ignores by default, private
use) and makes any run of spaces one space. An address is held to it
instead of made fit: an e-mail address the dialog could not show
unchanged is refused before anyone is asked, since "a&b@..." shown as
"a+b@..." is somebody else's address.
A refused caller could look (daemon). A call that names an account, a
card, a request, a draft or a connector had it looked up, at the bank
where that takes it, before polkit was asked. So a caller polkit
refused was told whether it was there ("no account is called ..."),
and had the bank asked. Such a call now asks for View first
(HandleLookup), a call that only sees looks its account up after its
yes, and the connectors are read, which refreshes the accounts at the
bank, on the first yes instead of on the first call.
An app at checkout was told too much (checkout). The refusal of an
order's reference with another amount named the amount on record, and
a refusal by the bank carried the call it answered, whose path has the
user's and the account's ids at bunq. Neither does now.
A key typed by hand could be read off the screen (app). The line under
a key field showed how the key begins and its last four characters,
which is every character of it as it is typed. It shows how the key
begins and how long it is.
Every change asks for the password (packaging, app). Change, the
action for what changes something and pays nobody, passed without a
password in an active session, so any program of the user's could
cancel a scheduled payment, ask for money in their name or freeze a
card. It asks now (auth_self), a draft saved and a card frozen
included: only View passes as shipped, and loosening is an
administrator's rule, of which the README has an example. The app says
of every change where it is confirmed (AsksPassword is gone), and the
request form sends on its button as the pay form does: its review
sheet would be a second confirmation of what the dialog confirms.
What is built is what was tested (build). Crafter.Network, Crafter.DB
and Crafter.LintRules are named at the commits the tests ran against.
Crafter.Thread still follows its branch, which Crafter.Network's own
project file names, and so does Crafter.Network in the app's debug
build, where Crafter.Debug names it too and crafter-build refuses a
module built twice. lib/json.hpp was nlohmann/json's develop branch at
95e9a593 less its last newline, and called 3.12.0: it is that file
byte for byte now, and called what it is.
The published contract changes with this, before any release (design
rule 10): an e-mail address the dialog cannot show as it is is
refused, a call that looks something up needs View as well as its own
action, the checkout's errors say less, and the policy asks for the
password for Change. The XML, the policy and ShouldServeEveryUser,
which now holds the policy to its defaults, change together.
Reproduced and verified on the fake bus and the fake bunq. The new
checks of ShouldServeEveryUser fail on the worker of before (50 of
them: the & shown, the lookups answered, the bank asked) and pass now.
crafter-build test (17 tests), lint for the library, the app and the
fake system, and tests/coverage.sh (every line, function and region)
pass. Looked at on the made-up system, 360x760 dp at scale 2, dark, on
KDE Wayland: the key form with a key typed, the request form with its
wait and its result, a card frozen, and About. No picture in the
README shows a screen that changed.
Not tried: bunq's sandbox, a real polkit agent, the Flatpak builds.
The README's example rule ran against a stand-in for polkit's rule
engine only.
Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
2026-11-19 16:09:48 +01:00
|
|
|
// the form, and a request for money from its form, is sent by the form's own button, with no question of the app's
|
|
|
|
|
// before it: what confirms it is the system's password dialog, which nostrod words itself and which every change
|
|
|
|
|
// meets, as nostro is shipped. What the app does ask about first is what one press on a sheet would do (a request or a
|
|
|
|
|
// draft to accept or reject, a schedule to cancel, a card to report), and it shows that built from the same values that
|
|
|
|
|
// are then sent. And an answer that leaves open whether money moved says so, and offers no button to try again.
|
feat(app): add the Nostro app, a window for phones and desktops
Linux phones have no banking apps, and a command line is no answer on a
phone. The app does everything the nostro command does and, like it, only
talks to nostrod: it holds no key and no token.
- Nostro.Ui, a toolkit whose screens are functions that fill a frame, ported
from imsd-messages ca5cd72d; Nostro.App, the app's state, forms and screens;
Nostro.Ui.Shell, which puts them on a Wayland window with Crafter.Graphics;
nostro-app; and Nostro.DebugCommands for the --debug-api build.
- Client: every method also in an asynchronous form for an sd-event loop,
with DaemonMissing and OutcomeUnknown.
- nostrod's Flatpak is net.catcrafts.Nostrod now and the app takes
net.catcrafts.Nostro; install.sh moves the state. The app's Flatpak, both
Flatpaks cross-built for aarch64, and the licence texts they carry.
- nostro-fake-system, a made-up bus and bank with a real nostrod on them, to
look at the app against. The README's screenshots are taken on it.
- The nostro command: an API key's environment is the key's own to say, so
--sandbox is for bunq-oauth alone, and a virtual card is listed as VIRTUAL.
The published contract changes in three places, before any release (design
rule 10):
- Transactions' query takes `stored`: answered from what nostrod has stored,
without asking the bank. The app searches with it; before, every search was
a call to bunq.
- AddBunq's `environment` no longer chooses over what the key says of itself:
a key of the other environment is refused.
- SetCardStatus refuses to freeze or unfreeze a virtual card. bunq reports one
as DEACTIVATED however well it pays, and leaves it as it is when asked,
without an error.
The app is GPL-3.0-only, the library stays LGPL-3.0-only, and no code moved
from one to the other (design rule 13). Transaction's schema is unchanged.
Verified: the 17 tests pass with every line, function and region of what they
link run, and the five lint runs are clean. Every screen was looked at on the
made-up system, at a phone's and a desktop's sizes in the light and the dark
look, on Plasma under Wayland. What is said of bunq's cards comes from its
sandbox, with throwaway users, and from one real virtual card. Known to have
been used against production: connecting, and reading accounts, payments and
cards. Not known to have been tried: a payment from the app against bunq,
OAuth against bunq, and anything on a phone.
Building the app takes --graphics=, a Crafter.Graphics checkout on its branch
claude/nostro-app, until that branch is merged and pinned here.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-19 12:27:14 +01:00
|
|
|
//
|
|
|
|
|
// Which bank an account is with makes no difference to any of it. A bank's own is in two places: what :Banks says of
|
|
|
|
|
// it, and the forms a connection to it is made with, which are the last pages of adding a connection in the settings
|
|
|
|
|
// (Nostro.App-Bunq.cpp has bunq's). Everything else says "your bank", and asks :Banks what a connection can do.
|
|
|
|
|
|
|
|
|
|
export namespace Nostro::App {
|
|
|
|
|
// What the app needs of the program around it.
|
|
|
|
|
struct Host {
|
|
|
|
|
// A client for nostrod, attached to the program's event loop. Throws when there is no system bus.
|
|
|
|
|
std::function<Client()> connect;
|
|
|
|
|
// Asks the desktop to open an address in the user's browser; `then` hears whether it took the request.
|
|
|
|
|
std::function<void(std::string_view uri, std::function<void(bool taken)> then)> openUri;
|
|
|
|
|
// The time, for "today" and for what is in the past. The system's clock when left empty.
|
|
|
|
|
std::function<std::chrono::system_clock::time_point()> now;
|
|
|
|
|
// A new state for an OAuth request, which ties the browser's answer to it. Random when left empty.
|
|
|
|
|
std::function<std::string()> oauthState;
|
|
|
|
|
std::string version;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// How far the asking for something is.
|
|
|
|
|
enum class LoadState : std::uint8_t {
|
|
|
|
|
Idle, // not asked for yet
|
|
|
|
|
Loading,
|
|
|
|
|
Loaded,
|
|
|
|
|
Failed
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Something nostrod is asked for.
|
|
|
|
|
template<typename T>
|
|
|
|
|
struct Loadable {
|
|
|
|
|
LoadState state = LoadState::Idle;
|
|
|
|
|
T value{};
|
|
|
|
|
Guidance problem; // why it failed
|
|
|
|
|
bool refreshing = false; // loaded, and asked for again: the old value shows meanwhile
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// A bank connection with its accounts: Connectors() and Accounts() joined.
|
|
|
|
|
struct Connection {
|
|
|
|
|
std::string name;
|
|
|
|
|
std::string bank; // as nostrod calls it; BankName() says it as the bank does
|
|
|
|
|
std::string environment; // "production" or "sandbox"
|
|
|
|
|
std::string auth; // the way it was made, as nostrod calls that; WayName() says it in words
|
|
|
|
|
bool working = false;
|
|
|
|
|
std::vector<Account> accounts;
|
|
|
|
|
// It pays between the user's own accounts and nobody else, by what :Banks knows of the way it was made.
|
|
|
|
|
bool ownAccountsOnly = false;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// One account, found by its key.
|
|
|
|
|
struct AccountRef {
|
|
|
|
|
const Connection* connection = nullptr;
|
|
|
|
|
const Account* account = nullptr;
|
|
|
|
|
std::string key; // names it in the app: its IBAN, or its name where the bank gave none
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class App {
|
|
|
|
|
public:
|
|
|
|
|
App(Ui::Context& context, Host host);
|
|
|
|
|
App(const App&) = delete;
|
|
|
|
|
App& operator=(const App&) = delete;
|
|
|
|
|
|
|
|
|
|
// Asks nostrod for the connections and accounts; the first frame shows them loading.
|
|
|
|
|
void Start();
|
|
|
|
|
// Builds the screen the user is on.
|
|
|
|
|
void Build(Ui::Frame& frame);
|
|
|
|
|
|
|
|
|
|
// Whether nostrod is still being waited for: for whoever runs the loop until the app has settled.
|
|
|
|
|
bool Busy() const noexcept;
|
|
|
|
|
// Whether a change is under way. The window may close then, and the process must not: the answer says whether
|
|
|
|
|
// money moved. onSettled is called when it has come.
|
|
|
|
|
bool Changing() const noexcept;
|
|
|
|
|
std::function<void()> onSettled;
|
|
|
|
|
// An answer came, to the method of that name, and whether it was an error: for a log or a debugger. Called once
|
|
|
|
|
// the app has taken the answer in, so what it shows is what the answer led to.
|
|
|
|
|
std::function<void(std::string_view member, bool failed)> onAnswer;
|
|
|
|
|
|
|
|
|
|
// Goes to a place by name: "accounts", "cards", "settings", "connections", "checkout", "about", "account:<IBAN>",
|
|
|
|
|
// or one of the steps of adding a connection: "add" for the banks, "add:<bank>" for a bank's ways and
|
|
|
|
|
// "add:<bank>:<way>" for a way's form, as in "add:bunq:key". False for a name that is none of them, and while
|
|
|
|
|
// a change is under way, which the screen waits out.
|
|
|
|
|
bool Navigate(std::string_view route);
|
|
|
|
|
// Where the user is, as a name of the same kind, with what is open over it after a '+': "account:NL…+filter".
|
|
|
|
|
std::string Screen() const;
|
|
|
|
|
// The connections and accounts as they are known.
|
|
|
|
|
const Loadable<std::vector<Connection>>& Overview() const noexcept;
|
|
|
|
|
// The state of the OAuth request that is being made, for a test that plays the browser.
|
|
|
|
|
std::string_view OAuthState() const noexcept;
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
// -- where the user is ---------------------------------------------------------------------------------------
|
|
|
|
|
enum class Place : std::uint8_t {
|
|
|
|
|
Accounts,
|
|
|
|
|
Cards,
|
|
|
|
|
Settings
|
|
|
|
|
};
|
|
|
|
|
enum class Page : std::uint8_t {
|
|
|
|
|
Account,
|
|
|
|
|
Pay,
|
|
|
|
|
Request,
|
|
|
|
|
Connections,
|
|
|
|
|
Banks, // adding a connection: the banks to choose from
|
|
|
|
|
Ways, // the ways to connect to the bank that was chosen
|
|
|
|
|
Connect, // the form of the way that was chosen
|
|
|
|
|
Checkout,
|
|
|
|
|
About
|
|
|
|
|
};
|
|
|
|
|
struct Route {
|
|
|
|
|
Page page = Page::Account;
|
|
|
|
|
std::string account; // the key of the account it is about
|
|
|
|
|
const Bank* bank = nullptr; // of Ways and Connect
|
|
|
|
|
const Way* way = nullptr; // of Connect
|
|
|
|
|
};
|
|
|
|
|
enum class Tab : std::uint8_t {
|
|
|
|
|
Activity,
|
|
|
|
|
Requests,
|
|
|
|
|
Incoming,
|
|
|
|
|
Scheduled,
|
|
|
|
|
Drafts
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// -- what is known -------------------------------------------------------------------------------------------
|
|
|
|
|
// One account's lists, each asked for when its tab is first shown.
|
|
|
|
|
struct AccountData {
|
|
|
|
|
Tab tab = Tab::Activity;
|
|
|
|
|
FilterForm filter;
|
|
|
|
|
TransactionQuery query; // the filter as it was last asked for
|
|
|
|
|
Loadable<std::vector<Transaction>> activity;
|
|
|
|
|
bool more = false; // the list is as long as was asked for: there may be more
|
|
|
|
|
Loadable<std::vector<BunqPaymentRequest>> requests;
|
|
|
|
|
Loadable<std::vector<BunqIncomingRequest>> incoming;
|
|
|
|
|
Loadable<std::vector<BunqScheduledPayment>> scheduled;
|
|
|
|
|
Loadable<std::vector<BunqDraftPayment>> drafts;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// One kind of call at a time, and at most one waiting behind it: the newest. nostrod's worker makes its calls
|
|
|
|
|
// to the bank one after another, and an answer dropped here does not stop it, so a queue of searches the user
|
|
|
|
|
// has already typed past would only use up the bank's patience.
|
|
|
|
|
struct Lane {
|
|
|
|
|
Client::Pending pending;
|
|
|
|
|
bool busy = false;
|
|
|
|
|
std::function<void()> next;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// -- what is open over the screen ----------------------------------------------------------------------------
|
|
|
|
|
struct Line {
|
|
|
|
|
std::string label;
|
|
|
|
|
std::string value;
|
|
|
|
|
// What a press on the line puts on the clipboard, where that is not the value as it is shown: an IBAN
|
|
|
|
|
// without the spaces it is read with.
|
|
|
|
|
std::string copied;
|
|
|
|
|
};
|
|
|
|
|
struct Choice {
|
|
|
|
|
std::string key;
|
|
|
|
|
std::string label;
|
|
|
|
|
Ui::ButtonKind kind = Ui::ButtonKind::Tonal;
|
|
|
|
|
bool enabled = true;
|
|
|
|
|
std::string reason; // why it cannot be chosen
|
|
|
|
|
std::function<void()> onTap;
|
|
|
|
|
};
|
|
|
|
|
// What is asked or told over the screen: a thing to look at with what can be done about it, a question before
|
|
|
|
|
// a change, the wait for its answer, and how it went.
|
|
|
|
|
struct Dialog {
|
|
|
|
|
enum class Kind : std::uint8_t {
|
|
|
|
|
Detail, // a row's own sheet
|
|
|
|
|
Ask, // before a change: what will be done, to confirm
|
|
|
|
|
Working, // the change is under way
|
|
|
|
|
Done, // it worked
|
|
|
|
|
Problem // it did not, or may not have
|
|
|
|
|
};
|
|
|
|
|
Kind kind = Kind::Detail;
|
|
|
|
|
std::string name; // for Screen(): "transaction", "confirm", "working"
|
|
|
|
|
std::string title;
|
|
|
|
|
std::vector<std::string> text;
|
|
|
|
|
std::vector<Line> lines;
|
|
|
|
|
std::vector<Choice> choices;
|
|
|
|
|
std::string link; // an address to copy or open
|
|
|
|
|
std::function<void()> onClose; // after it is sent away
|
|
|
|
|
};
|
|
|
|
|
enum class Picking : std::uint8_t {
|
|
|
|
|
None,
|
|
|
|
|
PayFrom,
|
|
|
|
|
RequestInto
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// -- nostrod -------------------------------------------------------------------------------------------------
|
|
|
|
|
Client& Nostrod();
|
|
|
|
|
void Reconnect();
|
|
|
|
|
void Note(const std::vector<std::string>& notes);
|
|
|
|
|
void Answered(std::string_view member, bool failed);
|
|
|
|
|
// A reading: `start` makes the call, given what to do with its answer, in the lane of that name.
|
|
|
|
|
template<typename T>
|
|
|
|
|
void Fetch(std::string lane, std::string member, std::function<Client::Pending(Client&, Client::Then<T>)> start, std::function<void(Answer<T>)> then);
|
|
|
|
|
// A change: shows the wait, makes the call, and shows how it went. `done` says what to tell the user; what it
|
|
|
|
|
// throws is told as the change having failed. `account` is the account it is about, if any.
|
|
|
|
|
template<typename T>
|
|
|
|
|
void Change(Operation operation, std::string member, std::string title, std::string account, std::function<Client::Pending(Client&, Client::Then<T>)> start, std::function<void(T&)> done);
|
|
|
|
|
void Failed(const Guidance& guidance, Operation operation, const std::string& account);
|
fix: close what the security review before the first release found
A review of the tree and its history before they are published found no
key and no bank data in them. It did find these, each closed here.
The password dialog could be emptied (daemon). Shown(), which makes a
payee's name fit for polkit's dialog, let an & through. GNOME's older
agent (polkit-gnome) and MATE's put the message into Pango markup
unescaped, where a bare & fails to parse and leaves the dialog without
a message: paying "Tom & Jerry", or an order an app names so at
checkout, asked for the password and showed no amount and no payee.
Line and paragraph separators passed too. Shown() now shows & as +,
leaves out what draws nothing or places text (control and format
characters, the separators, what Unicode ignores by default, private
use) and makes any run of spaces one space. An address is held to it
instead of made fit: an e-mail address the dialog could not show
unchanged is refused before anyone is asked, since "a&b@..." shown as
"a+b@..." is somebody else's address.
A refused caller could look (daemon). A call that names an account, a
card, a request, a draft or a connector had it looked up, at the bank
where that takes it, before polkit was asked. So a caller polkit
refused was told whether it was there ("no account is called ..."),
and had the bank asked. Such a call now asks for View first
(HandleLookup), a call that only sees looks its account up after its
yes, and the connectors are read, which refreshes the accounts at the
bank, on the first yes instead of on the first call.
An app at checkout was told too much (checkout). The refusal of an
order's reference with another amount named the amount on record, and
a refusal by the bank carried the call it answered, whose path has the
user's and the account's ids at bunq. Neither does now.
A key typed by hand could be read off the screen (app). The line under
a key field showed how the key begins and its last four characters,
which is every character of it as it is typed. It shows how the key
begins and how long it is.
Every change asks for the password (packaging, app). Change, the
action for what changes something and pays nobody, passed without a
password in an active session, so any program of the user's could
cancel a scheduled payment, ask for money in their name or freeze a
card. It asks now (auth_self), a draft saved and a card frozen
included: only View passes as shipped, and loosening is an
administrator's rule, of which the README has an example. The app says
of every change where it is confirmed (AsksPassword is gone), and the
request form sends on its button as the pay form does: its review
sheet would be a second confirmation of what the dialog confirms.
What is built is what was tested (build). Crafter.Network, Crafter.DB
and Crafter.LintRules are named at the commits the tests ran against.
Crafter.Thread still follows its branch, which Crafter.Network's own
project file names, and so does Crafter.Network in the app's debug
build, where Crafter.Debug names it too and crafter-build refuses a
module built twice. lib/json.hpp was nlohmann/json's develop branch at
95e9a593 less its last newline, and called 3.12.0: it is that file
byte for byte now, and called what it is.
The published contract changes with this, before any release (design
rule 10): an e-mail address the dialog cannot show as it is is
refused, a call that looks something up needs View as well as its own
action, the checkout's errors say less, and the policy asks for the
password for Change. The XML, the policy and ShouldServeEveryUser,
which now holds the policy to its defaults, change together.
Reproduced and verified on the fake bus and the fake bunq. The new
checks of ShouldServeEveryUser fail on the worker of before (50 of
them: the & shown, the lookups answered, the bank asked) and pass now.
crafter-build test (17 tests), lint for the library, the app and the
fake system, and tests/coverage.sh (every line, function and region)
pass. Looked at on the made-up system, 360x760 dp at scale 2, dark, on
KDE Wayland: the key form with a key typed, the request form with its
wait and its result, a card frozen, and About. No picture in the
README shows a screen that changed.
Not tried: bunq's sandbox, a real polkit agent, the Flatpak builds.
The README's example rule ran against a stand-in for polkit's rule
engine only.
Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
2026-11-19 16:09:48 +01:00
|
|
|
void Wait(std::string title);
|
feat(app): add the Nostro app, a window for phones and desktops
Linux phones have no banking apps, and a command line is no answer on a
phone. The app does everything the nostro command does and, like it, only
talks to nostrod: it holds no key and no token.
- Nostro.Ui, a toolkit whose screens are functions that fill a frame, ported
from imsd-messages ca5cd72d; Nostro.App, the app's state, forms and screens;
Nostro.Ui.Shell, which puts them on a Wayland window with Crafter.Graphics;
nostro-app; and Nostro.DebugCommands for the --debug-api build.
- Client: every method also in an asynchronous form for an sd-event loop,
with DaemonMissing and OutcomeUnknown.
- nostrod's Flatpak is net.catcrafts.Nostrod now and the app takes
net.catcrafts.Nostro; install.sh moves the state. The app's Flatpak, both
Flatpaks cross-built for aarch64, and the licence texts they carry.
- nostro-fake-system, a made-up bus and bank with a real nostrod on them, to
look at the app against. The README's screenshots are taken on it.
- The nostro command: an API key's environment is the key's own to say, so
--sandbox is for bunq-oauth alone, and a virtual card is listed as VIRTUAL.
The published contract changes in three places, before any release (design
rule 10):
- Transactions' query takes `stored`: answered from what nostrod has stored,
without asking the bank. The app searches with it; before, every search was
a call to bunq.
- AddBunq's `environment` no longer chooses over what the key says of itself:
a key of the other environment is refused.
- SetCardStatus refuses to freeze or unfreeze a virtual card. bunq reports one
as DEACTIVATED however well it pays, and leaves it as it is when asked,
without an error.
The app is GPL-3.0-only, the library stays LGPL-3.0-only, and no code moved
from one to the other (design rule 13). Transaction's schema is unchanged.
Verified: the 17 tests pass with every line, function and region of what they
link run, and the five lint runs are clean. Every screen was looked at on the
made-up system, at a phone's and a desktop's sizes in the light and the dark
look, on Plasma under Wayland. What is said of bunq's cards comes from its
sandbox, with throwaway users, and from one real virtual card. Known to have
been used against production: connecting, and reading accounts, payments and
cards. Not known to have been tried: a payment from the app against bunq,
OAuth against bunq, and anything on a phone.
Building the app takes --graphics=, a Crafter.Graphics checkout on its branch
claude/nostro-app, until that branch is merged and pinned here.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-19 12:27:14 +01:00
|
|
|
|
|
|
|
|
void Refresh(bool again = false);
|
|
|
|
|
void LoadAccounts(std::vector<ConnectorSummary> summaries, bool again);
|
|
|
|
|
void OverviewFailed(const Guidance& guidance);
|
|
|
|
|
void ListFailed(const Guidance& guidance);
|
|
|
|
|
void LoadActivity(const std::string& key, bool stored = false);
|
|
|
|
|
template<typename T>
|
|
|
|
|
void LoadList(const std::string& key, std::string_view member, Loadable<std::vector<T>> AccountData::* list, Client::Pending (Client::* call)(std::string_view, Client::Then<std::vector<T>>));
|
|
|
|
|
void LoadTab(const std::string& key, Tab tab, bool again = false);
|
|
|
|
|
void LoadCards(bool again = false);
|
|
|
|
|
void LoadCheckout();
|
|
|
|
|
void Changed(const std::string& key);
|
|
|
|
|
|
|
|
|
|
// -- going places --------------------------------------------------------------------------------------------
|
|
|
|
|
void Go(Place to);
|
|
|
|
|
void Push(Page page, std::string account = {}, const Bank* bank = nullptr, const Way* way = nullptr);
|
|
|
|
|
void Back();
|
|
|
|
|
void Show(Dialog shown);
|
|
|
|
|
void Close();
|
|
|
|
|
void Tell(std::string_view notice);
|
|
|
|
|
std::chrono::system_clock::time_point Today() const;
|
|
|
|
|
std::optional<AccountRef> Find(std::string_view key) const;
|
|
|
|
|
std::vector<AccountRef> Accounts() const;
|
|
|
|
|
AccountData& Data(const std::string& key);
|
|
|
|
|
bool Own(std::string_view iban) const;
|
|
|
|
|
|
|
|
|
|
// -- what the user asks for ----------------------------------------------------------------------------------
|
|
|
|
|
void OpenPay(std::string account);
|
|
|
|
|
void OpenRequest(std::string account);
|
|
|
|
|
void SubmitPayment();
|
|
|
|
|
void SendPayment(const std::string& key, Currency currency, const PaymentOrder& order);
|
fix: close what the security review before the first release found
A review of the tree and its history before they are published found no
key and no bank data in them. It did find these, each closed here.
The password dialog could be emptied (daemon). Shown(), which makes a
payee's name fit for polkit's dialog, let an & through. GNOME's older
agent (polkit-gnome) and MATE's put the message into Pango markup
unescaped, where a bare & fails to parse and leaves the dialog without
a message: paying "Tom & Jerry", or an order an app names so at
checkout, asked for the password and showed no amount and no payee.
Line and paragraph separators passed too. Shown() now shows & as +,
leaves out what draws nothing or places text (control and format
characters, the separators, what Unicode ignores by default, private
use) and makes any run of spaces one space. An address is held to it
instead of made fit: an e-mail address the dialog could not show
unchanged is refused before anyone is asked, since "a&b@..." shown as
"a+b@..." is somebody else's address.
A refused caller could look (daemon). A call that names an account, a
card, a request, a draft or a connector had it looked up, at the bank
where that takes it, before polkit was asked. So a caller polkit
refused was told whether it was there ("no account is called ..."),
and had the bank asked. Such a call now asks for View first
(HandleLookup), a call that only sees looks its account up after its
yes, and the connectors are read, which refreshes the accounts at the
bank, on the first yes instead of on the first call.
An app at checkout was told too much (checkout). The refusal of an
order's reference with another amount named the amount on record, and
a refusal by the bank carried the call it answered, whose path has the
user's and the account's ids at bunq. Neither does now.
A key typed by hand could be read off the screen (app). The line under
a key field showed how the key begins and its last four characters,
which is every character of it as it is typed. It shows how the key
begins and how long it is.
Every change asks for the password (packaging, app). Change, the
action for what changes something and pays nobody, passed without a
password in an active session, so any program of the user's could
cancel a scheduled payment, ask for money in their name or freeze a
card. It asks now (auth_self), a draft saved and a card frozen
included: only View passes as shipped, and loosening is an
administrator's rule, of which the README has an example. The app says
of every change where it is confirmed (AsksPassword is gone), and the
request form sends on its button as the pay form does: its review
sheet would be a second confirmation of what the dialog confirms.
What is built is what was tested (build). Crafter.Network, Crafter.DB
and Crafter.LintRules are named at the commits the tests ran against.
Crafter.Thread still follows its branch, which Crafter.Network's own
project file names, and so does Crafter.Network in the app's debug
build, where Crafter.Debug names it too and crafter-build refuses a
module built twice. lib/json.hpp was nlohmann/json's develop branch at
95e9a593 less its last newline, and called 3.12.0: it is that file
byte for byte now, and called what it is.
The published contract changes with this, before any release (design
rule 10): an e-mail address the dialog cannot show as it is is
refused, a call that looks something up needs View as well as its own
action, the checkout's errors say less, and the policy asks for the
password for Change. The XML, the policy and ShouldServeEveryUser,
which now holds the policy to its defaults, change together.
Reproduced and verified on the fake bus and the fake bunq. The new
checks of ShouldServeEveryUser fail on the worker of before (50 of
them: the & shown, the lookups answered, the bank asked) and pass now.
crafter-build test (17 tests), lint for the library, the app and the
fake system, and tests/coverage.sh (every line, function and region)
pass. Looked at on the made-up system, 360x760 dp at scale 2, dark, on
KDE Wayland: the key form with a key typed, the request form with its
wait and its result, a card frozen, and About. No picture in the
README shows a screen that changed.
Not tried: bunq's sandbox, a real polkit agent, the Flatpak builds.
The README's example rule ran against a stand-in for polkit's rule
engine only.
Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
2026-11-19 16:09:48 +01:00
|
|
|
void SubmitRequest();
|
feat(app): add the Nostro app, a window for phones and desktops
Linux phones have no banking apps, and a command line is no answer on a
phone. The app does everything the nostro command does and, like it, only
talks to nostrod: it holds no key and no token.
- Nostro.Ui, a toolkit whose screens are functions that fill a frame, ported
from imsd-messages ca5cd72d; Nostro.App, the app's state, forms and screens;
Nostro.Ui.Shell, which puts them on a Wayland window with Crafter.Graphics;
nostro-app; and Nostro.DebugCommands for the --debug-api build.
- Client: every method also in an asynchronous form for an sd-event loop,
with DaemonMissing and OutcomeUnknown.
- nostrod's Flatpak is net.catcrafts.Nostrod now and the app takes
net.catcrafts.Nostro; install.sh moves the state. The app's Flatpak, both
Flatpaks cross-built for aarch64, and the licence texts they carry.
- nostro-fake-system, a made-up bus and bank with a real nostrod on them, to
look at the app against. The README's screenshots are taken on it.
- The nostro command: an API key's environment is the key's own to say, so
--sandbox is for bunq-oauth alone, and a virtual card is listed as VIRTUAL.
The published contract changes in three places, before any release (design
rule 10):
- Transactions' query takes `stored`: answered from what nostrod has stored,
without asking the bank. The app searches with it; before, every search was
a call to bunq.
- AddBunq's `environment` no longer chooses over what the key says of itself:
a key of the other environment is refused.
- SetCardStatus refuses to freeze or unfreeze a virtual card. bunq reports one
as DEACTIVATED however well it pays, and leaves it as it is when asked,
without an error.
The app is GPL-3.0-only, the library stays LGPL-3.0-only, and no code moved
from one to the other (design rule 13). Transaction's schema is unchanged.
Verified: the 17 tests pass with every line, function and region of what they
link run, and the five lint runs are clean. Every screen was looked at on the
made-up system, at a phone's and a desktop's sizes in the light and the dark
look, on Plasma under Wayland. What is said of bunq's cards comes from its
sandbox, with throwaway users, and from one real virtual card. Known to have
been used against production: connecting, and reading accounts, payments and
cards. Not known to have been tried: a payment from the app against bunq,
OAuth against bunq, and anything on a phone.
Building the app takes --graphics=, a Crafter.Graphics checkout on its branch
claude/nostro-app, until that branch is merged and pinned here.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-19 12:27:14 +01:00
|
|
|
void SendRequest(const std::string& key, Currency currency, const RequestOrder& order);
|
|
|
|
|
void ShowTransaction(const std::string& key, const Transaction& transaction);
|
|
|
|
|
void ShowRequest(const std::string& key, const BunqPaymentRequest& request);
|
|
|
|
|
void ShowIncoming(const std::string& key, const BunqIncomingRequest& request);
|
|
|
|
|
void ShowScheduled(const std::string& key, const BunqScheduledPayment& scheduled);
|
|
|
|
|
void ShowDraft(const std::string& key, const BunqDraftPayment& draft);
|
|
|
|
|
void ShowCard(const BunqCard& card);
|
|
|
|
|
void ShowConnection(const Connection& connection);
|
|
|
|
|
// A change that needs a yes and no more: asks `question`, makes the change, and tells `told`.
|
|
|
|
|
void Simple(Operation operation, std::string member, std::string question, std::string detail, std::string confirm, std::string told, std::string account, std::function<Client::Pending(Client&, Client::Then<std::monostate>)> start);
|
|
|
|
|
void SetCard(std::uint64_t card, std::string lastFour, Operation operation, std::string status);
|
|
|
|
|
void RemoveConnection(const Connection& connection);
|
|
|
|
|
// What every way's form ends in: nostrod is asked to add the connection, as `start` asks it, and the user is
|
|
|
|
|
// told how that went. For the form's own button: which bank and which way it is are the page's that is open.
|
|
|
|
|
void Connect(std::string member, std::function<Client::Pending(Client&, Client::Then<AddedConnector>)> start);
|
|
|
|
|
void Connected(const AddedConnector& added, const Way& way);
|
|
|
|
|
void ForgetConnecting();
|
|
|
|
|
// bunq's two ways (Nostro.App-Bunq.cpp).
|
|
|
|
|
void ConnectBunqKey();
|
|
|
|
|
void BeginBunqOAuth();
|
|
|
|
|
void ConnectBunqOAuth();
|
|
|
|
|
void ChooseCheckout(const std::string& key, const std::string& name);
|
|
|
|
|
void Search(const std::string& key, bool now);
|
|
|
|
|
|
|
|
|
|
// -- the screens ---------------------------------------------------------------------------------------------
|
|
|
|
|
// A form's column inside a page: the page's rows run from edge to edge, a field keeps clear of the edges.
|
|
|
|
|
static Ui::Box Padded(const Ui::Frame& frame, Ui::Box box);
|
|
|
|
|
Ui::Box Scaffold(Ui::Frame& frame);
|
|
|
|
|
std::function<void()> Refresher();
|
|
|
|
|
std::string Title() const;
|
|
|
|
|
void Content(Ui::Frame& frame, Ui::Box area);
|
|
|
|
|
void Notes(Ui::Frame& frame, Ui::Column& column);
|
|
|
|
|
void Trouble(Ui::Frame& frame, Ui::Column& column, const Guidance& guidance, std::string_view key, std::function<void()> retry);
|
|
|
|
|
void Waiting(Ui::Frame& frame, Ui::Column& column, std::uint32_t rows);
|
|
|
|
|
void Empty(Ui::Frame& frame, Ui::Column& column, std::string_view text);
|
|
|
|
|
void Section(Ui::Frame& frame, Ui::Column& column, std::string_view title);
|
|
|
|
|
void HomePage(Ui::Frame& frame, Ui::Column& column);
|
|
|
|
|
void Welcome(Ui::Frame& frame, Ui::Column& column);
|
|
|
|
|
void AccountPage(Ui::Frame& frame, Ui::Column& column, const AccountRef& account, Ui::Box viewport);
|
|
|
|
|
void ActivityTab(Ui::Frame& frame, Ui::Column& column, const AccountRef& account, AccountData& data, Ui::Box viewport);
|
|
|
|
|
template<typename T, typename Make>
|
|
|
|
|
void ListTab(Ui::Frame& frame, Ui::Column& column, const std::string& key, Tab tab, Loadable<std::vector<T>>& list, std::string_view none, Ui::Box viewport, Make&& row);
|
|
|
|
|
void PayPage(Ui::Frame& frame, Ui::Column& column);
|
|
|
|
|
void RequestPage(Ui::Frame& frame, Ui::Column& column);
|
|
|
|
|
void AccountField(Ui::Frame& frame, Ui::Column& column, std::string_view key, std::string_view label, const std::string& account, Picking picking);
|
|
|
|
|
void CardsPage(Ui::Frame& frame, Ui::Column& column, Ui::Box viewport);
|
|
|
|
|
void SettingsPage(Ui::Frame& frame, Ui::Column& column);
|
|
|
|
|
void ConnectionsPage(Ui::Frame& frame, Ui::Column& column);
|
|
|
|
|
void BanksPage(Ui::Frame& frame, Ui::Column& column);
|
|
|
|
|
void WaysPage(Ui::Frame& frame, Ui::Column& column, const Bank& bank);
|
|
|
|
|
void BunqKeyPage(Ui::Frame& frame, Ui::Column& column);
|
|
|
|
|
void BunqOAuthPage(Ui::Frame& frame, Ui::Column& column);
|
|
|
|
|
void CheckoutPage(Ui::Frame& frame, Ui::Column& column);
|
|
|
|
|
void AboutPage(Ui::Frame& frame, Ui::Column& column);
|
|
|
|
|
void FilterSheet(Ui::Frame& frame, const AccountRef& account);
|
|
|
|
|
void PickSheet(Ui::Frame& frame);
|
|
|
|
|
void DialogSheet(Ui::Frame& frame);
|
|
|
|
|
|
|
|
|
|
Ui::Context& context;
|
|
|
|
|
Host host;
|
|
|
|
|
std::optional<Client> client;
|
|
|
|
|
std::map<std::string, Lane, std::less<>> lanes;
|
|
|
|
|
Client::Pending change; // the one change under way
|
|
|
|
|
bool changing = false;
|
|
|
|
|
std::vector<std::string> notes;
|
|
|
|
|
|
|
|
|
|
Loadable<std::vector<Connection>> overview;
|
|
|
|
|
std::map<std::string, AccountData, std::less<>> accounts;
|
|
|
|
|
Loadable<std::vector<ConnectorCards>> cards;
|
|
|
|
|
Loadable<std::optional<Account>> checkout;
|
|
|
|
|
|
|
|
|
|
Place place = Place::Accounts;
|
|
|
|
|
std::vector<Route> stack;
|
|
|
|
|
std::optional<Dialog> dialog;
|
|
|
|
|
std::string filtering; // the account whose filter sheet is open
|
|
|
|
|
Picking picking = Picking::None;
|
|
|
|
|
|
|
|
|
|
PaymentForm payment;
|
|
|
|
|
std::string payFrom;
|
|
|
|
|
RequestForm request;
|
|
|
|
|
std::string requestInto;
|
|
|
|
|
BunqKeyForm bunqKey;
|
|
|
|
|
BunqOAuthForm bunqOAuth;
|
|
|
|
|
std::string bunqOAuthError; // what was wrong with the address the browser was sent to
|
|
|
|
|
};
|
|
|
|
|
}
|