HrContract Docs

Signature QR

Watermarks from PKCS#7 serials on signed PDFs

After Emzagar returns a signed PDF:

  1. Overwrite canonical signed/ (this is what Hovita gets on the next round).
  2. Upsert DocumentSignatureCert (serial + role).
  3. Rebuild signed-pdf-with-qr/ by stamping all known role QRs on the last page.

There is no immutable first-backup folder. The old signed-pdf-first-backup/ path existed when a QR-stamped PDF could be sent back to Hovita and overwrite the canonical file; that flow is gone. Hovita / Emzagar always receive the canonical signed/ PDF — never the QR overlay.

Payload

s=<serial>|r=<role>|k=<main|attachment>|c=<contractId>|cn=<optional>

Built by buildSignatureQrPayload in src/lib/signature-qr/qr-visual.ts.

Storage layout

Unsigned PDFs are not stored. Generate / Emzagar / variant=pdf rebuild from frozen HrContract.contentHtml on the fly.

hr-contracts/
  signed/{nationalCode}/hr-{contractId}.pdf
  signed-pdf-with-qr/{nationalCode}/…

Starter vs full port

This kit stamps with qrcode + pdf-lib. The full performance-web port also uses @napi-rs/canvas for role labels, logo color modes, and admin position settings UI — see that repo’s docs/v2-port/signature-qr-v2-port.md.