- Go 98.7%
- Makefile 0.7%
- Dockerfile 0.4%
- Go Template 0.2%
| .forgejo/workflows | ||
| api | ||
| cmd/source-organization-process | ||
| helm | ||
| internal | ||
| .dockerignore | ||
| CHANGELOG.md | ||
| Dockerfile | ||
| go.mod | ||
| go.sum | ||
| LICENSE | ||
| Makefile | ||
| README.md | ||
source-organization-process
The business logic of the bronorganisatie in Notificatie voor Burgers (blauwe-knop layering: process, service, db).
It puts a message in the postvak, gives it a volgnummer and an unguessable id, offers a shipment whose signal
only points to the message, records the first retrieval as the moment of aflevering and takes the
ontvangstbevestiging. It keeps no state of its own: everything lives in source-organization-service.
API
Contract: api/openapi.yaml (OpenAPI 3.1, Dutch, NL API Design Rules), with the generated
api/openapi.json committed next to it. Both are served at
/bronorganisatie/v1/openapi.yaml and /bronorganisatie/v1/openapi.json; CI checks that the JSON matches
the YAML. Regenerate after a change:
npx -y js-yaml@4 api/openapi.yaml > api/openapi.json
The public API has its own prefix, /bronorganisatie/v1, because the hostname is shared and every public API
publishes its own specification.
Organisation side, the postvak (later behind PKIo):
-
POST /bronorganisatie/v1/burgers/zoeken{naam}→200 {items: [{id, naam, bereikbaar}]}: the burgers whose name contains the term, at most 50; a POST so no name lands in a URL.GET /bronorganisatie/v1/burgers/{burgerId}gives the same three fields. The BSN and the adreskaart never appear in this API. -
POST /bronorganisatie/v1/postvak/berichten{burgerId, berichtsoort, onderwerp, tekst, ontvangstbevestigingGevraagd}→201Bericht;400when invalid;422"Burger niet bereikbaar" when the burger is unknown or closed his address (nothing is kept: fall back to paper);502when the verzenddienst refuses (the message is removed again). When the bezorgdienst does not know the brievenbus or cannot open the envelope, the message stays as a retour:201with statusonbestelbaarandretourOp -
GET /bronorganisatie/v1/postvak/berichten→200 {items}, newest first, each with itsburger{id, naam, bereikbaar},opgehaaldOp,ontvangstbevestigingandretourOp(nulluntil then) and a derivedstatus:opgehaaldonce retrieved, elseonbestelbaaronce returned, elseverstuurd -
GET /bronorganisatie/v1/publieke-sleutels→200JWK Set with this organisation's ECDSA signing key (usesig, for the trust lists of apps) and its X-Wing key (useenc, which the adresregister seals adreskaartleveringen for), both withkidits afzendernaam
Citizen side (later behind FSC voor Burgers):
GET /bronorganisatie/v1/berichten/{berichtId}→200 {afzender, berichtsoort, onderwerp, tekst, aangemaaktOp, ontvangstbevestigingGevraagd, ontvangstbevestigingUrl?}; the first retrieval is recorded as the afleveringPOST /bronorganisatie/v1/berichten/{berichtId}/ontvangstbevestiging{ondertekend}: a JWS (ES256,typ ontvangstbevestiging+jwt) over{berichtId, bevestigdOpApparaat, ontvanger, uitgegevenOp}, signed with the signing key of the burger's brievenbus that the adresregister delivered with his adreskaart →201for the first,200for a repeat (the first stays, with its signed statement as evidence),401when the signature, bericht, ontvanger or moment does not hold,409when none was requested or the message was not retrieved yet,400,404
Errors are application/problem+json with Dutch title and detail; every response carries API-Version.
berichtsoort is brief, mededeling or rechtstoestandsmelding. The signal never carries content:
{afzender, verwijzing, volgnummer, tijdstempel}, with verwijzing = <PUBLIC_BASE_URL>/bronorganisatie/v1/berichten/{berichtId};
the volgnummer counts per adreskaart.
The adreskaart (nvb1.<X-Wing key>.<adres-sticker>) comes from the adresregister, per BSN, and the data layer
keeps it with the name the organisation looks up in the BRP. The organisation
signs the signal (JWS ES256, kid its afzendernaam), encrypts it for the burger with the key from the adreskaart
(the burgerenvelop), and encrypts that together with the adres-sticker for the bezorgdienst (the bezorgenvelop).
It never learns the functioneel adres. All cryptography comes from blauwe-knop's go-connect; the format is
docs/encryptie.md in getting-started.
The ontvangstbevestiging is not yet attributable to an identified citizen: like retrieval it only requires
the unguessable reference until FSC voor Burgers and an ML-DSA signature take over.
Zendingen go to the verzenddienst with POST /v1/zendingen, header Afzender (until PKIo over FSC
authenticates the afzender) and {bezorgdienst, bezorgenvelop}, the bezorgenvelop a compact JWE. When the
bezorgdienst does not know the brievenbus or cannot open the envelope, the verzenddienst answers 422 "Onbestelbaar"; the message then stays in the postvak with
retourOp and the status onbestelbaar, as if it came back at once. Otherwise the verzenddienst answers
202 {zendingReferentie}, which is stored with the message.
Internal listener (INTERNAL_LISTEN_ADDRESS, default :8082; Service source-organization-process-internal,
never routed): POST /v1/retouren {zendingReferentie, reden: onbestelbaar} → 202, from the verzenddienst when
the bezorgdienst gave up. The message gets retourOp and the status onbestelbaar: fall back to paper.
404 "Zending onbekend" for an unknown reference.
The same listener takes POST /v1/adreskaartleveringen {versleuteld} from the adresregister: a JWS
(adreskaartlevering+jwt) signed by an adresregister on TRUSTED_ADDRESS_REGISTERS and sealed for this
organisation's X-Wing key, with {burgerservicenummer, adreskaart (null when closed), versie, ontvanger, uitgegevenOp}.
The process checks the recipient and the moment (at most 5 minutes old), looks up the name in the BRP and keeps the
burger → 204, also when the version is older than the one kept. 400 when it does not open, 401
"Ongeldige handtekening" without saying which check failed, 502 when the BRP gives no name (the adresregister
tries again). The BSN never lands in a URL or a log line. See docs/adresregister.md in getting-started.
Configuration
Set through config in helm/values.yaml, plus the Secrets source-organization-api-keys and
source-organization-process-sleutel:
SENDER_ID: identity of this organisation as senderDISPATCH_SERVICE_URL: base URL of the verzenddienstDELIVERY_SERVICE: name of the bezorgdienst to address the shipment toSOURCE_ORGANIZATION_SERVICE_URL: the data layer, defaults tohttp://source-organization-serviceSOURCE_ORGANIZATION_SERVICE_API_KEY: this process's key for the data layer, from the Secret keySOURCE_ORGANIZATION_PROCESS_API_KEYPUBLIC_BASE_URL: origin at which citizens retrieve messagesALLOWED_ORIGINS: comma-separated CORS origins, defaults to*SIGNING_KEY: the ECDSA P-256 private key as PEM (EC PRIVATE KEY) that signs every signal, from the Secretsource-organization-process-sleutelDELIVERY_SERVICE_KEYS: JWK Set with the X-Wing key (ktyOKP,crvX-ML-KEM-768,useenc) of each bezorgdienst,kidits name; the process refuses to start without a key forDELIVERY_SERVICEDECRYPTION_KEY: the X-Wing private key as PEM (HPKE PRIVATE KEY) that opens adreskaartleveringen, from the same Secretsource-organization-process-sleutelTRUSTED_ADDRESS_REGISTERS: JWK Set with the ES256 key of each trusted adresregister,kidits name (address-register-process)BRP_URL: the BRP (Haal Centraal BRP Personen), defaults tohttp://mock-brp-api:8008/haalcentraal/api/brp
Development
go test ./...
golangci-lint run ./...
docker build --target production -t code.digitaledienst.overheid.nl/mijn-betaaloverzicht/source-organization-process:dev .
CI
.forgejo/workflows/ci.yml tests and lints every push and pull request, checks the specification
(JSON matches YAML, Redocly, ADR checker) and on main pushes the image
code.digitaledienst.overheid.nl/mijn-betaaloverzicht/source-organization-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.