2026-08-20 23:33:50 +02:00
|
|
|
# Read the bank and hand the incoming credits to the server.
|
|
|
|
|
#
|
bank: the hourly pull asks nostrod, and holds no bunq key
tools/pull-and-ship-credits.sh ran this repo's own bunq client
(`catcrafts-server --pull-credits`) with the API key from .env: a key
that can initiate payments, where every program run in the checkout
could read it. It now asks nostrod (Nostro) for the account's
transactions over the system bus and turns the answer into the same
credit lines. nostrod lets a program look without a password and lets
nothing pay without one, so the pull holds no credential at all.
- Each run ships the last 90 days (CREDITS_DAYS), the longest window an
order can wait in, in place of an accumulating local copy fed by a
reader that only ever saw the newest 50 payments.
- --dry-run prints what would be shipped and ships nothing.
- deploy/README.md: how the pull works now, the polkit rule a timer
needs to look without a login session, and what the old reader is
still kept for (tools/register-bunq-webhook.sh, until `nostro
callbacks` of Nostro 1.1.0 has been seen to list the shop's webhook).
Checked on 2026-11-21 against the production account, through nostrod:
a dry run gave, for each of the 24 incoming payments the old client had
written, a line byte-identical to the old client's. A real run, with
the ship to the server, has not been made, and the timer is installed
nowhere yet.
No C++ changes: the two edits to sources are to comments.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-25 14:21:48 +01:00
|
|
|
# A USER unit, on the machine where nostrod holds the bunq connection, NOT on
|
|
|
|
|
# the web host. The web host cannot call bunq at all (the key is IP-restricted
|
|
|
|
|
# at the key level and bunq enforces it on every request), and it should not be
|
2026-08-20 23:33:50 +02:00
|
|
|
# able to: a bunq key can initiate payments, because bunq offers no read-only
|
bank: the hourly pull asks nostrod, and holds no bunq key
tools/pull-and-ship-credits.sh ran this repo's own bunq client
(`catcrafts-server --pull-credits`) with the API key from .env: a key
that can initiate payments, where every program run in the checkout
could read it. It now asks nostrod (Nostro) for the account's
transactions over the system bus and turns the answer into the same
credit lines. nostrod lets a program look without a password and lets
nothing pay without one, so the pull holds no credential at all.
- Each run ships the last 90 days (CREDITS_DAYS), the longest window an
order can wait in, in place of an accumulating local copy fed by a
reader that only ever saw the newest 50 payments.
- --dry-run prints what would be shipped and ships nothing.
- deploy/README.md: how the pull works now, the polkit rule a timer
needs to look without a login session, and what the old reader is
still kept for (tools/register-bunq-webhook.sh, until `nostro
callbacks` of Nostro 1.1.0 has been seen to list the shop's webhook).
Checked on 2026-11-21 against the production account, through nostrod:
a dry run gave, for each of the 24 incoming payments the old client had
written, a line byte-identical to the old client's. A real run, with
the ship to the server, has not been made, and the timer is installed
nowhere yet.
No C++ changes: the two edits to sources are to comments.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-25 14:21:48 +01:00
|
|
|
# scope. So the server only ever reads a file.
|
|
|
|
|
#
|
|
|
|
|
# This unit holds no key either. tools/pull-and-ship-credits.sh asks nostrod
|
|
|
|
|
# (https://forgejo.catcrafts.net/Catcrafts/Nostro) over the system bus, and
|
|
|
|
|
# nostrod lets a program look at the accounts without ever handing it the key.
|
2026-08-20 23:33:50 +02:00
|
|
|
#
|
|
|
|
|
# Install:
|
|
|
|
|
# mkdir -p ~/.config/systemd/user
|
|
|
|
|
# cp deploy/catcrafts-credits.{service,timer} ~/.config/systemd/user/
|
|
|
|
|
# systemctl --user daemon-reload
|
|
|
|
|
# systemctl --user enable --now catcrafts-credits.timer
|
bank: the hourly pull asks nostrod, and holds no bunq key
tools/pull-and-ship-credits.sh ran this repo's own bunq client
(`catcrafts-server --pull-credits`) with the API key from .env: a key
that can initiate payments, where every program run in the checkout
could read it. It now asks nostrod (Nostro) for the account's
transactions over the system bus and turns the answer into the same
credit lines. nostrod lets a program look without a password and lets
nothing pay without one, so the pull holds no credential at all.
- Each run ships the last 90 days (CREDITS_DAYS), the longest window an
order can wait in, in place of an accumulating local copy fed by a
reader that only ever saw the newest 50 payments.
- --dry-run prints what would be shipped and ships nothing.
- deploy/README.md: how the pull works now, the polkit rule a timer
needs to look without a login session, and what the old reader is
still kept for (tools/register-bunq-webhook.sh, until `nostro
callbacks` of Nostro 1.1.0 has been seen to list the shop's webhook).
Checked on 2026-11-21 against the production account, through nostrod:
a dry run gave, for each of the 24 incoming payments the old client had
written, a line byte-identical to the old client's. A real run, with
the ship to the server, has not been made, and the timer is installed
nowhere yet.
No C++ changes: the two edits to sources are to comments.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-25 14:21:48 +01:00
|
|
|
#
|
|
|
|
|
# WHO MAY LOOK. As nostrod ships, a program may look without a password only
|
|
|
|
|
# while you are logged in at this machine (an active local session, which a
|
|
|
|
|
# user unit counts as part of). So as installed above, this pulls while you are
|
|
|
|
|
# logged in and is refused otherwise: with nobody logged in, or on a machine
|
|
|
|
|
# you only reach over SSH. To have it run regardless, add the polkit rule in
|
|
|
|
|
# deploy/README.md ("Who may look"), and then, so the unit runs with nobody
|
|
|
|
|
# logged in at all:
|
|
|
|
|
# loginctl enable-linger "$USER"
|
|
|
|
|
# Lingering without the rule only produces a refused pull every hour.
|
2026-08-20 23:33:50 +02:00
|
|
|
#
|
|
|
|
|
# Watch: journalctl --user -u catcrafts-credits -f
|
|
|
|
|
[Unit]
|
bank: the hourly pull asks nostrod, and holds no bunq key
tools/pull-and-ship-credits.sh ran this repo's own bunq client
(`catcrafts-server --pull-credits`) with the API key from .env: a key
that can initiate payments, where every program run in the checkout
could read it. It now asks nostrod (Nostro) for the account's
transactions over the system bus and turns the answer into the same
credit lines. nostrod lets a program look without a password and lets
nothing pay without one, so the pull holds no credential at all.
- Each run ships the last 90 days (CREDITS_DAYS), the longest window an
order can wait in, in place of an accumulating local copy fed by a
reader that only ever saw the newest 50 payments.
- --dry-run prints what would be shipped and ships nothing.
- deploy/README.md: how the pull works now, the polkit rule a timer
needs to look without a login session, and what the old reader is
still kept for (tools/register-bunq-webhook.sh, until `nostro
callbacks` of Nostro 1.1.0 has been seen to list the shop's webhook).
Checked on 2026-11-21 against the production account, through nostrod:
a dry run gave, for each of the 24 incoming payments the old client had
written, a line byte-identical to the old client's. A real run, with
the ship to the server, has not been made, and the timer is installed
nowhere yet.
No C++ changes: the two edits to sources are to comments.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-25 14:21:48 +01:00
|
|
|
Description=Pull bank credits from nostrod and ship them to catcrafts.net
|
2026-08-20 23:33:50 +02:00
|
|
|
Documentation=file:deploy/README.md
|
|
|
|
|
# Pointless without a route to the bank or to the server.
|
|
|
|
|
After=network-online.target
|
|
|
|
|
|
|
|
|
|
[Service]
|
|
|
|
|
Type=oneshot
|
|
|
|
|
WorkingDirectory=%h/repos/catcrafts.net
|
|
|
|
|
ExecStart=%h/repos/catcrafts.net/tools/pull-and-ship-credits.sh
|
bank: the hourly pull asks nostrod, and holds no bunq key
tools/pull-and-ship-credits.sh ran this repo's own bunq client
(`catcrafts-server --pull-credits`) with the API key from .env: a key
that can initiate payments, where every program run in the checkout
could read it. It now asks nostrod (Nostro) for the account's
transactions over the system bus and turns the answer into the same
credit lines. nostrod lets a program look without a password and lets
nothing pay without one, so the pull holds no credential at all.
- Each run ships the last 90 days (CREDITS_DAYS), the longest window an
order can wait in, in place of an accumulating local copy fed by a
reader that only ever saw the newest 50 payments.
- --dry-run prints what would be shipped and ships nothing.
- deploy/README.md: how the pull works now, the polkit rule a timer
needs to look without a login session, and what the old reader is
still kept for (tools/register-bunq-webhook.sh, until `nostro
callbacks` of Nostro 1.1.0 has been seen to list the shop's webhook).
Checked on 2026-11-21 against the production account, through nostrod:
a dry run gave, for each of the 24 incoming payments the old client had
written, a line byte-identical to the old client's. A real run, with
the ship to the server, has not been made, and the timer is installed
nowhere yet.
No C++ changes: the two edits to sources are to comments.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-25 14:21:48 +01:00
|
|
|
# A failed pull must not look like a successful one. The script ships nothing
|
|
|
|
|
# when it could not read the account, and never overwrites the remote with an
|
|
|
|
|
# empty file, so a failure here leaves the server settling from the last good
|
|
|
|
|
# copy rather than from nothing.
|
2026-08-20 23:33:50 +02:00
|
|
|
SuccessExitStatus=0
|