No description
  • Dart 79.1%
  • C++ 9.3%
  • CMake 6.7%
  • Ruby 1.9%
  • Swift 1.1%
  • Other 1.8%
Find a file
Zamir Amir 321f024949
All checks were successful
CI / chart (push) Successful in 4s
CI / image (push) Successful in 3m29s
Reach the adresregister and the pushgateway on hostnames of their own
On nvb every actor has its own hostname, so deriving the adresregister
and the pushgateway from MAILBOX_HOST_URL sent registrations and push
calls to the hoster, which answered 404. ADRESREGISTER_URL and
PUSHGATEWAY_URL name them; without them they keep sharing the mailbox
host, as on mijnbo. The achtergronddienst gets the pushgateway in its
keyring entry.
2026-11-25 16:40:06 +01:00
.forgejo/workflows Push images with the organisation's registry account 2026-11-23 13:09:25 +01:00
.vscode Reach the adresregister and the pushgateway on hostnames of their own 2026-11-25 16:40:06 +01:00
android added images 2026-11-25 13:16:27 +01:00
assets improve ui 2026-11-24 15:24:29 +01:00
helm Follow the blauwe-knop names in module, image, chart and Services 2026-11-23 20:10:14 +01:00
ios Reach the adresregister and the pushgateway on hostnames of their own 2026-11-25 16:40:06 +01:00
lib Reach the adresregister and the pushgateway on hostnames of their own 2026-11-25 16:40:06 +01:00
linux Open the vordering of a bericht in Mijn Betaaloverzicht and group the settings into cards 2026-11-25 11:09:14 +01:00
macos added images 2026-11-25 13:16:27 +01:00
nginx Serve the web build under /mailbox/ next to the mailbox host 2026-11-23 12:29:56 +01:00
test Reach the adresregister and the pushgateway on hostnames of their own 2026-11-25 16:40:06 +01:00
web Receive nudges through the push gateway and as browser notifications 2026-11-23 17:14:19 +01:00
windows Open the vordering of a bericht in Mijn Betaaloverzicht and group the settings into cards 2026-11-25 11:09:14 +01:00
.dockerignore Serve the web build under /mailbox/ next to the mailbox host 2026-11-23 12:29:56 +01:00
.fvmrc Receive nudges and show signals from the citizen's mailbox 2026-11-23 11:13:03 +01:00
.gitignore Receive nudges and show signals from the citizen's mailbox 2026-11-23 11:13:03 +01:00
.metadata Receive nudges and show signals from the citizen's mailbox 2026-11-23 11:13:03 +01:00
analysis_options.yaml Receive nudges and show signals from the citizen's mailbox 2026-11-23 11:13:03 +01:00
CHANGELOG.md added images 2026-11-25 13:16:27 +01:00
Dockerfile Build on buildpack-deps instead of installing packages with apt 2026-11-23 13:29:24 +01:00
LICENSE License under EUPL-1.2 2026-11-23 20:10:32 +01:00
Makefile Build the iOS app and upload it to TestFlight with fastlane 2026-11-24 16:15:37 +01:00
pubspec.lock Open the vordering of a bericht in Mijn Betaaloverzicht and group the settings into cards 2026-11-25 11:09:14 +01:00
pubspec.yaml Open the vordering of a bericht in Mijn Betaaloverzicht and group the settings into cards 2026-11-25 11:09:14 +01:00
README.md Reach the adresregister and the pushgateway on hostnames of their own 2026-11-25 16:40:06 +01:00

mailbox-app

Minimal citizen app for Notificatie voor Burgers: creates a signed mailbox at the mailbox host, receives nudges through the push gateway, opens the sealed signals and retrieves a message at the source organisation when the citizen opens it. The signal and the message follow the bronorganisatie's Dutch contract (signaal{afzender, verwijzing, volgnummer, tijdstempel}; the verwijzing points under /bronorganisatie/v1/berichten/), and an error shows the detail of its application/problem+json.

Flutter is pinned in .fvmrc; run everything through fvm.

fvm flutter test
fvm flutter run -d macos
fvm flutter run -d ios        # simulator
fvm flutter run -d android    # emulator; defaults to http://10.0.2.2:8080
fvm flutter run -d linux      # verified on the Linux desktop only
fvm flutter run -d windows    # scaffolded but unverified: no Windows build machine

Where the app finds the mailbox host:

  • --dart-define=MAILBOX_HOST_URL=… wins when set.
  • The adresregister and the pushgateway use the same hostname, unless --dart-define=ADRESREGISTER_URL=… or --dart-define=PUSHGATEWAY_URL=… names one of their own, as on nvb where every actor has its own hostname. The app also hands the pushgateway to the achtergronddienst (pushgatewayUrl in the keyring entry).
  • A web build uses the origin it is served from, but it only shows that the web is not supported (see Encryption).
  • Native builds use http://localhost:8080, and the Android emulator http://10.0.2.2:8080.

The container image (Dockerfile) has a test target that runs analyze and the tests with the pinned SDK, and a production target with nginx. CI builds the first before publishing the second.

Encryption

The app follows docs/encryptie.md in getting-started, with blauwe-knop's dart_connect for all cryptography:

  • Creating a brievenbus: the app makes an X-Wing key pair and an ECDSA P-256 key pair, signs the request as a JWS (typ brievenbus-aanvraag+jwt, both public keys as JWK, uitgegevenOp) and posts {ondertekend}. The hoster answers with the adreskaart; the app refuses one that does not carry its own X-Wing key. The citizen copies the adreskaart ("Kopieer adreskaart") and gives it to an organization.

  • Keys: kept with flutter_secure_storage, never in plain preferences: the login keychain on macOS (not the data protection keychain, which needs an entitlement an ad-hoc signed build cannot carry), the Secret Service on Linux, the Credential Manager on Windows, the Keystore on Android and the Keychain on iOS. A stored brievenbus without its keys is replaced by a new one.

  • Signals: each burgerenvelop is decrypted with the X-Wing key; the JWS inside must be ES256, its kid must be on the trust list, the signature must verify and afzender must equal kid. Anything else, including an envelope above 16 384 characters, shows as "Onbetrouwbaar signaal", without afzender, and cannot be opened.

  • Trust list: a JWK Set of the trusted afzenders with the afzendernaam as kid. Every environment has its own bronorganisatie key, so a build passes it with --dart-define=VERTROUWDE_AFZENDERS="$(cat vertrouwde-afzenders.json)"; without it the app uses assets/vertrouwde-afzenders.json, which is empty, so every signal is untrustworthy. Locally make local-secrets in getting-started writes the list to .build/vertrouwde-afzenders.json:

    fvm flutter run -d macos --dart-define=MAILBOX_HOST_URL=http://localhost:8080 \
      --dart-define=VERTROUWDE_AFZENDERS="$(cat ../getting-started/.build/vertrouwde-afzenders.json)"
    

    In VS Code the launch configurations "lokaal", "Fundament" and "nvb" do this for you: a pre-launch task writes the trust list, the adresregister key and, for Fundament and nvb, the hoster URL to .build/<omgeving>-defines.json, which they pass with --dart-define-from-file. Lokaal reads getting-started's .build/ and leaves out what is missing; Fundament and nvb read the fundament.json and nvb.json files of mailbox-app-installer and refuse to start without them. Fundament is the demo in tnt-mbo-voorbeeld--mijnbo; nvb are the actors of the Fundament plugin (hoster https://nvb-hoster.cluster-a.fieldlab2026.nl), whose files are the app-configuratie on the app-uitgever's page in the Fundament console. Without VS Code: fvm flutter run -d macos --dart-define-from-file=.build/nvb-defines.json after running the task once.

  • Adresregister (docs/adresregister.md in getting-started): under Instellingen the citizen registers the adreskaart under a BSN ("Registreer mijn adres") and can close it again ("Sluit mijn adres"). The app checks the elfproef, signs {soort, burgerservicenummer, adreskaart, ondertekenSleutel, ontvanger, uitgegevenOp} as a JWS (typ registratie+jwt) with the brievenbus's ECDSA key, seals it with X-Wing for the adresregister and posts {versleuteld} to /adresregister/v1/registraties. A sluiting carries no adreskaart and only works with the key of the last registration. The BSN stays in the secret store and is shown masked (*******53); after a new brievenbus the app asks to register again. Only test persons of the BRP mock work: without DigiD nothing proves a BSN is the citizen's. The register's X-Wing key comes per build as a JWK, never fetched: --dart-define=ADRESREGISTER_SLEUTEL='{"kty":"OKP","crv":"X-ML-KEM-768","x":"…"}'; without it the app offers no registration.

  • dart_connect version: pinned at 0.12.5. Its releases 0.12.6 to 0.12.10 carry no prebuilt binaries, so binary_build_mode: remote cannot download them, and local would need Go and a C toolchain in every build. The Dart API is the same.

  • Logging: the native library logs the plaintext it handles at debug level, so the app sets it to warn on start.

  • No web: dart_connect opens envelopes through a native library a browser cannot load. A web build compiles but only says the web is not supported, and the image is no longer deployed.

Nudges

  • Live connection: while the app is open it holds a WebSocket to the push gateway (/push/v1/verbinding). The first message is a token; the app registers it at the mailbox host as a device (PUT /hoster/v1/brievenbussen/{functioneelAdres}/apparaten/{apparaatId} with only {pushtoken}: the gateway sealed the kanaal inside, so the hoster never learns how the device is reached). On a desktop this only happens while "Meldingen op de achtergrond" is off.
  • Achtergronddienst, Linux, macOS and Windows: with "Meldingen op de achtergrond" on (the default) the app hands the brievenbus over to mailbox-app-push-agent and opens no live connection of its own, so a seintje is not announced twice. It refreshes the signals whenever the citizen comes back to the window. The handover is the keyring entry from the agent's README (service nl.overheid.digitaledienst.mailbox_app, user brievenbus, secret {"basisUrl","functioneelAdres","toegangstoken"}), written on every start and when the brievenbus is replaced, and removed when the switch goes off:
    • macOS: a generic password written with /usr/bin/security, the tool go-keyring reads through, so the agent reads it without a keychain prompt. Works in the sandboxed app.
    • Linux: a Secret Service item written with secret-tool (package libsecret-tools, a dependency of the installer's deb and rpm). Not verified on a Linux desktop yet.
    • Windows: a generic credential nl.overheid.digitaledienst.mailbox_app:brievenbus written with CredWrite. Unverified: no Windows build machine.
  • Agent's notifications refused, macOS: macOS drops the agent's notifications silently until the citizen allows them for the agent's own entry "Notificatie voor Burgers – meldingen", which System Settings lists next to the app's. The agent reports the permission back through the keychain (user meldingen under the same service, {"meldingenToegestaan":false,"sinds":"…"}, which go-keyring stores on macOS as go-keyring-base64: plus base64); while it says false and the switch is on, the app shows where to switch it on, with a button that opens System Settings > Notifications. The app reads the report on start, every 15 seconds and when the window comes back, so the warning goes soon after the citizen allowed it. Linux and Windows show or refuse a notification visibly, so they need no warning.
  • One instance: a second start, such as a click on the agent's notification, brings the running window forward. macOS does this itself; the Linux runner is a unique GApplication and the Windows runner checks a named mutex. Both unverified.
  • Web Push, browser: "Meldingen aanzetten" asks for permission, registers web/push-service-worker.js under /mailbox/, subscribes with the push gateway's VAPID key (/push/v1/vapid-sleutel) exchanges the subscription for a pushtoken at the gateway (POST /push/v1/pushtokens) and registers that pushtoken as a device. The push carries no payload; the notification only says "Er is post", never the sender or subject. When the app is visible the worker passes the nudge to the app instead of notifying.
  • FCM, iOS and Android: on start the app asks for notification permission, registers at Firebase Cloud Messaging for its Firebase Installation ID, exchanges that ID for a pushtoken at the gateway (POST /push/v1/pushtokens with kanaal fcm) and registers that pushtoken as a device. The gateway's message only says "Er is post", and the hoster never learns the ID. Needs the gateway to have the publisher's Firebase service account (make fcm-secret in getting-started); the Firebase configuration of the app (lib/firebase_options.dart, ios/Runner/GoogleService-Info.plist, android/app/google-services.json) is for the bundle id nl.digitalebrievenbus.fieldlab.
  • The pushtoken of a live connection changes with every connection, so the app registers again on every start and after every reconnect.

TestFlight

De iOS-app gaat via fastlane naar TestFlight. Dit draai je lokaal op een Mac met Xcode, fvm en Ruby (Bundler).

Eenmalig:

  1. Maak in App Store Connect onder Users and Access → Integrations → App Store Connect API een key met de rol Admin. Xcode heeft die rol nodig om met het cloud-managed distributiecertificaat te ondertekenen.
  2. Zet de .p8 in ios/fastlane/ en kopieer ios/fastlane/.env.example naar ios/fastlane/.env. Vul daarin de key-id, de issuer-id en de bestandsnaam van de key in. Beide bestanden staan in .gitignore.
  3. Installeer de gems in het project: cd ios && bundle config set --local path vendor/bundle && bundle install.
  4. Zorg dat ../mailbox-app-installer naast deze repo staat. De build leest daaruit de lijst vertrouwde afzenders en de adresregistersleutel van het Fundament, net als de launch-config in VS Code.

Daarna:

make ios-build   # ipa bouwen tegen het Fundament, buildnummer = laatste TestFlight-build + 1
make ios-deploy  # ipa uploaden naar TestFlight, zonder op de verwerking te wachten

Met MAILBOX_HOST_URL, VERTROUWDE_AFZENDERS_FILE en ADRESREGISTER_SLEUTEL_FILE bouw je tegen een andere omgeving. Tegen de actoren van de Fundament-plugin (nvb):

MAILBOX_HOST_URL=https://nvb-hoster.cluster-a.fieldlab2026.nl \
ADRESREGISTER_URL=https://nvb-adresregister.cluster-a.fieldlab2026.nl \
PUSHGATEWAY_URL=https://nvb-app-uitgever.cluster-a.fieldlab2026.nl \
VERTROUWDE_AFZENDERS_FILE=../mailbox-app-installer/vertrouwde-afzenders/nvb.json \
ADRESREGISTER_SLEUTEL_FILE=../mailbox-app-installer/adresregister-sleutel/nvb.json \
  make ios-build

Installer

The app does not install or start the agent itself. mailbox-app-installer ships both in one package per operating system and starts the agent at login. Registering the agent from the app with SMAppService on macOS is still to do.

License

EUPL-1.2, see LICENSE.