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>
This commit is contained in:
parent
1ea50c50bc
commit
5b4037955b
106 changed files with 17804 additions and 289 deletions
|
|
@ -153,9 +153,11 @@ namespace {
|
|||
}
|
||||
|
||||
void Connecting(Fake::Bunq& bunq) {
|
||||
// The key comes from the prompt, here stdin, never from the command line.
|
||||
Works({"connectors", "add", "bunq", "--sandbox"}, "added Ann (sandbox, 2 accounts)", "key-ann\n");
|
||||
// The key comes from the prompt, here stdin, never from the command line. It says itself which environment
|
||||
// it is of, by how it starts: there is no flag for that, and the one OAuth has is refused before a key is read.
|
||||
Works({"connectors", "add", "bunq"}, "added Ann (sandbox, 2 accounts)", "sandbox_key-ann\n");
|
||||
Works({"connectors", "add", "bunq", "*"}, "added Bob (production, 1 accounts)", "key-bob\n");
|
||||
Fails({"connectors", "add", "bunq", "--sandbox"}, "--sandbox goes with bunq-oauth: an API key is a sandbox key when it starts with sandbox_");
|
||||
Fails({"connectors", "add", "bunq"}, "nothing given for 'bunq API key: '");
|
||||
Fails({"connectors", "add"}, "connector type not provided");
|
||||
Fails({"connectors", "add", "unknown"}, "unknown connector type 'unknown'");
|
||||
|
|
@ -246,8 +248,17 @@ namespace {
|
|||
std::lock_guard lock(bunq.mutex);
|
||||
bunq.cardsActivate = false;
|
||||
}
|
||||
Fails({"cards", "unfreeze", card}, std::format("bunq kept card {} DEACTIVATED (its order status is VIRTUAL_DELIVERY)", card));
|
||||
Fails({"cards", "unfreeze", card}, std::format("bunq kept card {} DEACTIVATED (its order status is DELIVERED_TO_CUSTOMER)", card));
|
||||
Works({"cards", "lost", card}, std::format("card {} is now LOST", card));
|
||||
// A virtual card is listed as one, since bunq has it as DEACTIVATED however well it pays. It is not frozen or
|
||||
// unfrozen: bunq would leave it as it is and answer as if it had been done.
|
||||
const std::string number = std::to_string(bunq.AddCard(ann, "DEACTIVATED", json{{"order_status", "VIRTUAL_DELIVERY"}}));
|
||||
Works({"cards"}, std::format("\t{}\tVIRTUAL\tMASTERCARD_DEBIT", number));
|
||||
const std::size_t asked = bunq.Count("PUT", "/user/");
|
||||
Fails({"cards", "freeze", number}, std::format("card {} is a virtual card, which bunq does not freeze or unfreeze when asked", number));
|
||||
Fails({"cards", "unfreeze", number}, "do that in the bunq app");
|
||||
Equal(bunq.Count("PUT", "/user/"), asked, "bunq is not asked to freeze a virtual card");
|
||||
Works({"cards", "stolen", number}, std::format("card {} is now STOLEN", number));
|
||||
Fails({"cards", "melt", card}, "unknown card action 'melt'");
|
||||
Fails({"cards", "freeze", "1"}, "no card has id 1");
|
||||
Fails({"cards", "freeze"}, "card id not provided");
|
||||
|
|
@ -265,7 +276,7 @@ namespace {
|
|||
void Removing(Fake::Bunq& bunq) {
|
||||
bunq.AddAccount(bunq.AddPerson("Ann", "key-ann2"), "NL84BUNQ2025333333", "Other", 0);
|
||||
Works({"connectors", "add", "bunq"}, "added Ann (production", "key-ann2\n");
|
||||
Fails({"connectors", "remove", "Ann"}, "2 connectors are called 'Ann': use the number");
|
||||
Fails({"connectors", "remove", "Ann"}, "2 connectors are called 'Ann': use its number");
|
||||
Fails({"connectors", "remove", "Nobody"}, "no connector is called or numbered 'Nobody'");
|
||||
Works({"connectors", "remove", "4"}, "removed Ann");
|
||||
|
||||
|
|
@ -309,7 +320,7 @@ int main(int argc, char* argv[]) {
|
|||
}
|
||||
|
||||
Fake::Bunq bunq(port);
|
||||
const std::uint64_t ann = bunq.AddPerson("Ann", "key-ann");
|
||||
const std::uint64_t ann = bunq.AddPerson("Ann", "sandbox_key-ann");
|
||||
const std::uint64_t annMain = bunq.AddAccount(ann, annIban, "Main", 100000);
|
||||
bunq.AddAccount(ann, savingsIban, "Savings", 100);
|
||||
bunq.AddAccount(bunq.AddPerson("Bob", "key-bob"), bobIban, "Main", 0);
|
||||
|
|
|
|||
Loading…
Reference in a new issue