Branded Bsn value object with the elfproef (11-test) checksum in shared/kernel/bsn.ts,
wired into the DigiD login boundary so login does real BSN validation (hint + e2e BSNs
updated to a valid 123456782). Consolidate the pure maskers into shared/kernel/pii.ts
(maskBsn/maskTail/REDACTED); debug-state keeps redactProfile (needs the registratie
BigProfile — boundary). New <app-masked-value> atom (+story) centralises the masked
`.includes('*')` detection + reveal affordance; behandel-scherm refactored onto it.
Session.bsn stays string (persistence boundary drops it for privacy). +specs for bsn/pii.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
3.0 KiB
3.0 KiB
WP-40 — PII kernel: branded Bsn VO + masked-value atom
Status: done Phase: 8 — platform/DX/showcase Priority: P2
Outcome
shared/kernel/bsn.ts—Bsnbranded VO +parseBsnwith the elfproef (11-test) checksum (+spec). Wired into the DigiD login boundary (digid.adapter): login now does real BSN validation instead of "any 9 digits" — login hint + e2e BSNs updated to a valid one (123456782).shared/kernel/pii.ts— puremaskBsn/maskTail/REDACTED(+spec), the functional core. Moved out ofdebug-state/mask.ts, which keeps onlyredactProfile(it depends on the registratieBigProfile, so it can't live inshared/kernel— boundary; debug-state is the sanctioned cross-context devtool).mask.specported topii.spec.<app-masked-value>atom (shared/ui/masked-value) + story — masked-by-default value with an optional reveal affordance; centralises the.includes('*')masked-detection thatbehandel-schermused to sniff inline (now refactored to the atom). The atom only emitsreveal; the caller keeps the step-up confirm + audited fetch.- Deviation (flagged):
Session.bsnstays typedstring— the brand guards the login ENTRY, but Session crosses a persistence boundary where the restore path deliberately drops the bsn (privacy) and JSON can't carry a brand, so re-typing it would add a''/nullable ripple for no real gain. BackendMaskTailtwin unchanged (still in sync).
Why
Masking is real but ad-hoc: pure helpers live in debug-state/mask.ts, the BSN is a bare string
in session.ts (no branded VO / checksum, unlike BigNummer/Postcode), and masked state is
detected by .includes('*') sniffing — no reusable atomic-design component. For a register this is
AVG art. 9 (BSN = special category) territory; the pieces should be first-class and reusable.
Decisions
Bsnbranded value object +parseBsnwith the elfproef (9 digits, weighted mod-11) checksum — parity with the other value objects. Replace the barestringinsession.ts.- Consolidate the pure maskers into
shared/kernel/pii.ts(functional core):maskBsn,maskTail,redactProfile, … Keep the backendMaskTailtwin in sync. <app-masked-value>atom (shared/ui) — masked by default, optional reveal affordance + a11y; replaces.includes('*')sniffing and composes into the behandel-scherm reveal.
Files
- New
src/app/shared/kernel/bsn.ts(+spec, elfproef cases) andshared/kernel/pii.ts(+spec). src/app/auth/domain/session.ts—bsn: Bsn.- New
src/app/shared/ui/masked-value/atom (+ story). src/app/shared/ui/debug-state/mask.ts— re-export/move to the kernel module.
Acceptance criteria
parseBsnaccepts valid elfproef numbers, rejects bad checksum/length/all-zeros (spec).<app-masked-value>renders masked by default with an optional reveal; behandel-scherm uses it (no more inline sniff).- Pure maskers have specs (no TestBed); backend
MaskTailparity noted;npm run cigreen.