- Go 97.9%
- Makefile 1.2%
- Dockerfile 0.6%
- Go Template 0.3%
| .forgejo/workflows | ||
| api | ||
| cmd/mailbox-host-process | ||
| helm | ||
| internal | ||
| .dockerignore | ||
| Dockerfile | ||
| go.mod | ||
| go.sum | ||
| LICENSE | ||
| Makefile | ||
| README.md | ||
mailbox-host-process
The business logic of the hoster in Notificatie voor Burgers: it checks the app's signed request to
create a mailbox, declares the mailbox to the delivery service with a signed address declaration and
hands back the adreskaart, checks the citizen's access token, accepts deliveries and asks the
push gateway to nudge the registered devices. It holds no state: all data lives in
mailbox-host-service (data access) and mailbox-host-db (Postgres), following the blauwe-knop
layering, so this process can restart without losing a mailbox.
API
The contract is api/openapi.yaml (OpenAPI 3.1, Dutch interface following the NL
API Design Rules), committed with a generated api/openapi.json like in blauwe knop, and served as JSON and YAML on both listeners (/hoster/v1/openapi.json and .yaml publicly, /v1/openapi.json and .yaml internally). Every response carries
API-Version; errors are application/problem+json.
Public listener (:8080, routed at /hoster, prefix /hoster/v1), for the citizen:
POST /hoster/v1/brievenbussen{ondertekend}→201 {functioneelAdres, toegangstoken, adreskaart};ondertekendis the app's JWS with both its keys as JWK,401when the signature or its moment is not acceptedGET /hoster/v1/publieke-sleutels→ the hoster's ECDSA key as a JWK Set, for the delivery service's trust listGET /hoster/v1/brievenbussen/{functioneelAdres}/signalenwithAuthorization: Bearer <toegangstoken>→200 {items: [{burgerenvelop}]}PUT/DELETE /hoster/v1/brievenbussen/{functioneelAdres}/apparaten/{apparaatId}with the same header; body{pushtoken}only: the push gateway sealed the kanaal inside the token, so the hoster never learns how a device is reached; any other field is refused
Internal listener (:8082, Service <release>-internal, never routed), for delivery-process only:
POST /v1/brievenbussen/{functioneelAdres}/bezorgingen{burgerenvelop}→202; the envelope is a compact JWE for the citizen, kept as an opaque string
The access token is stored only as a SHA-256 hash and compared in constant time; the functional
address in the path is public by design, like a postal address, and opens nothing on its own.
After each delivery the process sends every device a seintje through the pushgateway (POST /v1/seintjes {pushtoken}); a 410 removes
that device version only (If-Match), so a device that re-registered meanwhile keeps its new
token. A failed nudge never fails the delivery. Management lives in mailbox-host-management-process.
Configuration
MAILBOX_HOST_SERVICE_URL,MAILBOX_HOST_SERVICE_API_KEY: the data layer and this process's service keyDELIVERY_SERVICE_URL:delivery-process, where each new mailbox is declared withPUT /v1/adressen/{functioneelAdres}{versleuteld}: the signed declaration sealed for the delivery service; it answers with the adres-stickerSIGNING_KEY: PEM of the hoster's ECDSA P-256 private key (chart: Secretmailbox-host-process-sleutel); the format isdocs/encryptie.mdin getting-startedDELIVERY_SERVICE_KEYS: JWK Set with the delivery service's X-Wing key (kiddelivery-process) that each declaration is sealed for (chart:config.deliveryServiceKeys); the process does not start without itTECHNICAL_ADDRESS_PREFIX: the base URL at which the delivery service reaches the internal listener (chart defaulthttp://mailbox-host-process-internal)PUSH_GATEWAY_URL: the internal URL of the push gatewayLISTEN_ADDRESS(:8080),INTERNAL_LISTEN_ADDRESS(:8082),ALLOWED_ORIGINS(*)
Development
go test ./...
golangci-lint run ./...
CI
.forgejo/workflows/ci.yml tests and lints, checks the OpenAPI document with Redocly and the ADR
checker, lints the chart, and on main pushes
code.digitaledienst.overheid.nl/mijn-betaaloverzicht/mailbox-host-process:<commit>.
Release
make release VERSION=1.2.3 # on an up-to-date main: writes helm/Chart.yaml, commits, tags v1.2.3
git push --follow-tags
The tag pipeline tags the image 1.2.3 and v1.2.3 and publishes the chart at 1.2.3 to the
Forgejo Helm registry (see the charts repository). The environments repository pins that
version.
License
EUPL-1.2, see LICENSE.