## Nostro
The primary problem with linux phones is that they don't have banking apps, Nostro tries to change that.
By making a open source app that interfaces with bank APIs.
## How Nostro runs
Nostro keeps your bank connections out of reach of the programs you run. Its daemon, nostrod, runs as a system user of its own and holds the bank connections of every user of the machine, each user's in a process of its own. The `nostro` command asks nostrod over the system bus, and nostrod asks polkit whether you may:
- Looking at accounts, transactions, requests and cards needs nothing more in your desktop session.
- Paying, scheduling a payment, accepting a request or a draft payment, unfreezing or blocking a card, and changing your bank connections ask for your password every time.
Your desktop draws the password dialog, and it says what it is for: the amount, who is paid, and from which account. Nothing secret goes on the command line: Nostro asks for an API key at a prompt.
## Installing
Nostro comes as a Flatpak, `net.catcrafts.Nostro`, installed for the whole system. A Flatpak cannot install a few system files Nostro needs: nostrod's user, its D-Bus and polkit policies, its systemd unit, and the `nostro` command. Install both as root:
```
flatpak install --system packaging/flatpak/net.catcrafts.Nostro.flatpakref # the Flatpak, from the Catcrafts repository
packaging/system/install.sh # the system files
```
To install a Flatpak you built yourself (see Building) instead, run `packaging/system/install.sh --repo
/repo`. On Arch Linux, `makepkg -si` in `packaging/arch` installs the system files as the `nostro-system` package instead of `install.sh`. nostrod starts with the first `nostro` command and stops by itself once it has nothing to do.
`packaging/system/uninstall.sh` removes everything again. Your bank connections stay in `/var/lib/nostro` until you give it `--purge`.
## Moving from an older Nostro
Before nostrod, Nostro kept your bank connections in `~/.config/nostro/connectors.json`, where any program you ran could read your API key, and the `nostro` command warns while that file exists. To move:
1. Revoke the key in the bunq app, under Developers, then API keys.
2. Add a new key with `nostro connectors add bunq`.
3. Delete `~/.config/nostro` and `~/.cache/nostro`.
Nostro fetches your transaction history from bunq again.
## Building
This project uses [Crafter.Build](https://forgejo.catcrafts.net/Catcrafts/Crafter.Build) for its building system
```
crafter-build --banks={lists of banks you want to enable} # the library and the nostro command
crafter-build --banks=bunq --product=daemon # nostrod
crafter-build --product=checkout # the checkout library for apps, see Checkout for apps
```
The `nostro` command talks to an installed nostrod, so it needs one to do anything. The Flatpak builds on crafter-build's own Flatpak, which must be installed:
```
flatpak run --filesystem= org.flatpak.Builder --user --force-clean --repo=/repo --state-dir=/state /build packaging/flatpak/net.catcrafts.Nostro.yaml
```
`--filesystem=` is only needed for a `` outside your home.
## CLI
```
nostro connectors # connectors, numbered, and whether they work
nostro connectors add bunq [allowed ips, default *] [--sandbox] # asks for the API key
nostro connectors add bunq-oauth {client id} {redirect uri} [--sandbox] # asks for the client secret
nostro connectors remove {name or number} # logs out and deletes its stored transactions
nostro accounts # all accounts of all connectors
nostro transactions {account} [--search text] [--amount n] [--from date] [--to date] [--limit n]
nostro send {account} {to} {name} {amount} {description, optional}
nostro request {account} {from} {name} {amount} {description, optional}
nostro requests {account} [revoke {id}] # requests for money you sent
nostro incoming {account} [accept|reject {id}] # requests for money you received
nostro schedule {account} {to} {name} {amount} {start date} {once|daily|weekly|monthly|yearly} {description, optional} [--every n] [--until date]
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
```
- `{account}` is an account's name or its IBAN. Use the IBAN when two accounts share a name.
- `{to}` and `{from}` are an IBAN, an e-mail address, or a phone number starting with `+`. IBANs are checked before anything is sent.
- Amounts are in the smallest unit of your currency, so for EUR `1250` is €12.50.
- Dates are `YYYY-MM-DD` or `"YYYY-MM-DD hh:mm"`, in local time.
## bunq
Connect with an API key: in the bunq app's settings, open Developers, then API keys, and add one. Nostro asks for it without echoing it, or reads it from stdin, and never takes it from the command line, which every user of the machine can read. A key added with the default allowed IP `*` works from any address, which a phone needs. Sandbox keys start with `sandbox_` and connect to the sandbox automatically. Adding the same bunq user again replaces the connector, which is how you renew a key.
OAuth is the other way in. Any bunq user can create an OAuth client in the bunq app or at [bunq Developer](https://developer.bunq.com) and register a redirect URL for it. `nostro connectors add bunq-oauth` prints an address to open, where you approve the connection by scanning a QR code with the bunq app. Paste the address your browser lands on afterwards back into Nostro. bunq only lets OAuth connections pay between your own accounts. A payment to someone else has to be a draft payment (`nostro draft`) that you approve in the bunq app, and incoming requests can be read but not paid. An API key has none of these limits.
## Supported banks
[Bunq](https://doc.bunq.com/api-reference/start-here)
## Checkout for apps
An app, such as a shop, can have the user's Nostro pay an order. Nostro pays it from the account the user chose once with `nostro checkout account {account}`, after the user has confirmed the payment with their password at a prompt that shows the amount, the payee, the reference and that account. The app never names or sees the account, and gets back only the payment's id. An account connected through OAuth cannot pay a shop, so it cannot be chosen.
Apps talk to `net.catcrafts.Nostro1.Checkout` on the system bus. A Flatpak app asks for it with `--system-talk-name=net.catcrafts.Nostro1.Checkout` in its finish-args, which reaches nothing else of Nostro. The interface is one method, documented in [packaging/dbus/net.catcrafts.Nostro1.Checkout.xml](packaging/dbus/net.catcrafts.Nostro1.Checkout.xml):
```
Pay(payeeIban s, payeeName s, amount x, currency s, reference s, options a{sv}) -> (paymentId t, results a{sv})
```
- The payee is an IBAN. The amount is in the currency's smallest unit (`1250` is €12.50), and the currency is `EUR`. The reference is your order number: it becomes the payment's description, and it tells orders apart.
- Allow interactive authorization on the call, make the call asynchronously, and give it a timeout of minutes, because the user may take a while at the prompt.
- An order is paid once. Calling `Pay` again with the same IBAN and reference, after a timeout or a crash, returns the first payment with `repeated` set to true in `results`, without asking the user. While the user is still at the prompt, the second call waits for the first. The same reference with another amount is refused.
- `net.catcrafts.Nostro1.Error.Cancelled` means the user did not confirm, and `NoCheckoutAccount` that they have not chosen an account. `org.freedesktop.DBus.Error.ServiceUnknown` means Nostro is not installed. The XML lists the other errors.
- Ignore keys you do not know in `results`, because later versions may add some. Nostro ignores options it does not know.
- A payment id is not a receipt. Confirm the money arrived with your own bank.
From a shell:
```
busctl call --system --timeout=10min net.catcrafts.Nostro1.Checkout /net/catcrafts/Nostro1 \
net.catcrafts.Nostro1.Checkout Pay 'ssxssa{sv}' NL91ABNA0417164300 'Shop BV' 1250 EUR order-1234 0
```
Generate a proxy from the XML with `gdbus-codegen` (GLib and GTK), `qdbusxml2cpp` (Qt) or `zbus-xmlgen` (Rust). A C++ app built with Crafter.Build can depend on Nostro with `--product=checkout` instead. That builds the `Nostro.Checkout` module alone, which links only libsystemd:
```cpp
import Nostro.Checkout;
const Nostro::Checkout::Paid paid = Nostro::Checkout::Pay({.payeeIban = "NL91ABNA0417164300", .payeeName = "Shop BV", .amount = 1250, .reference = "order-1234"});
```
`Pay` blocks until the user has answered, so call it off the UI thread. It throws `Nostro::Checkout::Cancelled`, `Nostro::Checkout::NoCheckoutAccount`, or `Nostro::Checkout::Error` with the D-Bus error name.
Any app the user runs with access to the checkout can ask whether an order was paid, by asking for it again with the same IBAN, reference and amount: it gets the payment id without a prompt. Nostro cannot tell which app is asking, so a reference should be hard to guess.
## Testing
```
crafter-build test --banks=bunq # every test, against a fake bunq and a fake system bus in the test itself
tests/coverage.sh # the same with coverage: a report per file, and every line no test ran
```
`tests/coverage.sh` needs `llvm-profdata` and `llvm-cov`, and a toolchain with compiler-rt's profile runtime; for one without it, pass the path of its `libclang_rt.profile` archive as the argument.
## Contributing
Nostro gladly accepts contributions to add more banks!
Please add a connector for the bank you want to add and send the patch to jorijnvdgraaf@catcrafts.net
Please add thorough testing coverage for te bank you are submitting.
For 100% certainity blind submissions for connectors are not be accepted, they must be tested against either the live or sandbox API.
## Security
Please report security vuneribilities to jorijnvdgraaf@catcrafts.net before publishing them.
What Nostro protects you from, and what it does not:
- Programs you run cannot read your bank connections, which belong to nostrod's own user, and cannot move money without your password.
- The password dialog is your desktop's. A program running as you could still draw one that looks the same, so type your password only for something you asked for, and check what the dialog says.
- 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: root, and anyone holding the disk, can read them. Use full-disk encryption.
- An administrator can change what needs a password with polkit rules in `/etc/polkit-1/rules.d/`, for example an amount above which an administrator must approve a payment. Each dialog gives rules `amount_minor`, `currency`, `counterparty`, `account_iban` and `environment`, and at checkout `reference`.
## License
LGPL-3.0-only, see [LICENSE](LICENSE).
## Copyright
Copyright (C) 2026 Catcrafts®
catcrafts.net