Skip to main content

Certificates and representatives

The engine signs with two kinds of PKCS#12 certificates, all read from the server environment through internal-signer.config.ts and never from the database: A representative in the catalogue points to its certificate through a credential reference. The application starts without the certificates loaded; they are read when an unattended seat signs and when a group is sealed.

The unattended company signature

With company_phase = last, the company side runs after the customers. In digital contracting the enterprise worker (contract-enterprise-sign) calls applyUnattendedEnterpriseSignatures, which signs every pending unattended seat and, once both sides are complete, seals the PDFs and reports sealed. If attended company seats are still pending, the worker invites those representatives instead. It is idempotent: a sealed group is never sealed again. Every run emits a structured enterprise_signing.metric log line with a success or failure event.

Stuck groups and retry

A group counts as stuck when it has not changed for more than 30 minutes and one of these holds:
  • the group is in awaiting_enterprise_signature;
  • a company_phase = first group in in_progress or partially_signed whose company side is still incomplete; or
  • a sealed group whose contract is still in pending_signature, in_signature, partially_signed or awaiting_enterprise_signature.
The scan only reports; retrying is a manual decision.

Monitoring

Better Stack alerts on the engine’s structured logs; the configuration lives in infra/betterstack/ and is described in Monitoring — Terraform.

Local development

  • Queues. With QUEUE_PROVIDER=inline, the company-side job runs in the same process, so a full signature can be completed locally.
  • Certificates. Sealing needs the platform certificate configured in the local environment (see backend/horizon-api/.env.example). Local seeds can point a representative to a placeholder credential, which then uses the platform certificate; production refuses that placeholder.
  • Without the API. The portal’s mock mode simulates the signature and what happens after it; see Digital contracting — Operations.

Runbooks

Step-by-step runbooks live in the repository under docs/operations/:

Code

Paths are relative to backend/horizon-api/ unless they start with infra/ or docs/.