Skip to main content
This page follows one seat from the code request to the signed status, and the group from opening to sealing.

Overview

Guards before the engine

The signer routes run these checks before calling the engine: The order lock applies to customer seats only and only when there is more than one; company representatives follow the workflow.

Requesting a code

sendSignerOtp:
  1. Refuses a seat that has already signed, rejected or been cancelled (409).
  2. Applies the phase gate: the seat’s side must be the one whose turn it is (409 otherwise). See Workflows.
  3. Applies a resend budget per seat (429 when it is spent).
  4. Creates a new six-digit code, stores only its salted hash and invalidates any earlier code for the seat.
  5. Hands the email to the notification core, which queues it. If the core skips it or fails, the call fails and nothing is recorded as sent.
  6. Appends otp_sent to the audit chain and answers the masked email and the expiry time.

The signing gesture

registerSignerAction with sign and the code:
  1. Applies the phase gate again.
  2. Validates the code: it must not be expired, used or past its wrong-attempt limit.
  3. Resolves the document number recorded for the gesture (below).
  4. Computes one hash over the hashes of every document in the group: a single gesture signs all of them.
  5. Marks the seat signed, stores its evidence and appends signer_signed to the audit chain.
  6. Advances the group (below).

The document number

The signer types only the code. The engine resolves the document number from the signer’s verified identity, in this order:
  1. The latest verified identity of the signer, counted only if it happened after the contract started (when it has started). When the signer has a person account, only identity records for that account’s RUT count (person accounts that disagree on the RUT fail with 422). Since the card serial is no longer stored, the verified RUT is the document number.
  2. Only for the primary signer (the seat with signing_order = 1) with no identity record at all: the RUT on their person account, or else the RUT of the contract’s account.
  3. Any other case is refused with 400: the signer must verify their identity first.
The evidence keeps only a SHA-256 hash of the normalized number.

Rejecting

registerSignerAction with reject (and an optional reason) marks the seat and the group rejected and appends signer_rejected to the audit chain. No other seat can sign afterwards. The phase gate does not apply to a rejection.

How the group advances

The diagram shows company_phase = last. With first, the group waits for the company side before any customer seat can sign, and the last customer signature seals the group. The consumer decides what each outcome means for its own record. The engine also exposes cancelSignatureRequest, which invalidates the pending codes of the signers listed when the request was opened and marks the request cancelled.

Code

Paths are relative to backend/horizon-api/.