← All writing2026.10.23 · COMMERCE · Commerce Systems in Production

Document Signing: Preserve the Content and the Event History

Versioned templates, document fingerprints, expiring links and serialized state changes make a signing workflow traceable.

A signature image alone does not explain which document was accepted or how the request reached completion. The signing workflow I implemented records the document version, validates the submitted fields, and produces a completed PDF with the relevant event history.

The following describes the engineering pattern without customer documents, field definitions or identifying information.

Bind the request to its document

A signing request refers to a template version and the original document’s hash. Before accepting a signature, the server loads the document and compares its hash with the recorded value. A mismatch stops the operation.

This separates editing a template from changing a document that someone has already been asked to sign. Each signature belongs to a specific document, not whichever file currently occupies a familiar name.

The application issues random links with an expiry and stores a hash of the signing token. The server checks both the request’s effective status and the signer’s status before accepting values or signature images.

Field validation enforces which fields that signer may fill. Unknown signature fields, invalid formats and missing required values are rejected. The interface helps the signer complete the form; the server establishes what is accepted.

Serialize competing updates

Signing, declining and voiding a request can compete. The implementation locks the request and signer records in a consistent order before changing state.

This gives each operation a current view of the request and prevents two callers from independently completing an already-resolved step. The final document is produced after the required signatures have been collected.

Connect the events

Consent, signing and completion events retain their place in a hash chain. Each event hash includes the previous hash and a canonical representation of the current event.

Tests modify an event or remove an intermediate event and verify that the chain check identifies the break. Document hashes separately connect the original and completed files to their recorded fingerprints.

These mechanisms support integrity checks within the workflow. They are distinct from independently verified signer identity or a certificate-based digital signature. Keeping that distinction explicit makes the evidence useful without overstating what it proves.

The result is a reviewable package: the accepted content, the completed PDF, and the sequence of recorded actions that produced it.