Documentation

Sign3x8 min readPage 1 of 1
On this page 21

Sign3x is a MODX 3 component for storing, managing and signing PDF documents with a simple electronic signature under Russian Federal Law No. 63-FZ “On Electronic Signature”. The signature records the signer’s full name, position, date/time and a unique SHA-256 hash key.

1. Requirements

ComponentVersionNote
MODX Revolution3.xRequired
PHP8.1 or higherRequired
MySQL / MariaDBany current versionRequired
pdoToolsany current versionOptional — only needed for Fenom templates (&fenom=`1`)
FPDI + TCPDF—Included in the package — only needed for the visual PDF stamp

2. Installation

  1. Install the package via the MODX Package Manager (or copy the files manually).
  2. Installation creates two database tables:
    • sign3x_documents — documents
    • sign3x_profiles — signer profiles
  3. Go to System Settings → Namespace: sign3x and configure the parameters (see System settings).
  4. Be sure to create signer profiles on the “Employees” tab for every user who should be able to sign.

Access. The Sign3x panel is only available to users logged in to the MODX manager (mgr). The right to sign is further restricted by user groups via the sign3x_allowed_groups setting.

3. System settings

All settings are in the sign3x namespace. Open System Settings → filter “sign3x”.

General

Setting keyDefaultDescription
sign3x_allowed_groups(empty)IDs of user groups allowed to sign, comma-separated: 1,5,12. Sudo users skip the group check — a signer profile is enough for them.
sign3x_secret_salt(empty)Secret salt for the SHA-256 hash key. Set any long random string. Never change it after the first signature — this invalidates the existing hash keys.
sign3x_upload_dirassets/sign3x/uploads/Upload folder for PDF files relative to the site root. Must be writable by the web server.
sign3x_filename_modetranslitFile naming: translit — transliteration, original — the original name, unique — a unique UUID.
sign3x_delete_filesYesDelete the PDF files on disk when a document is deleted.
sign3x_frontend_cssassets/components/sign3x/css/frontend.cssURL of the built-in frontend styles. If the field is empty, no styles are added.

Visual PDF stamp

The default stamp texts are in Russian; change them in the settings below if you need another language.

Setting keyDefaultDescription
sign3x_pdf_stampNoAdd a visual stamp to the PDF when signing.
sign3x_pdf_stamp_modeoverlayMode: overlay — on top of the last page, newpage — a separate “signature sheet” page.
sign3x_stamp_titleЭЛЕКТРОННАЯ ПОДПИСЬ (ПЭП)Stamp title (both modes).
sign3x_stamp_page_titleЛИСТ ЭЛЕКТРОННОЙ ПОДПИСИSignature page title (newpage).
sign3x_stamp_hash_labelПрограммный ключ (SHA-256):Label above the hash key (newpage).
sign3x_stamp_law_textText on compliance with Law 63-FZLegal compliance text inside the frame (newpage).
sign3x_stamp_verify_textVerification textText below the frame (newpage).
sign3x_stamp_footer_textСформировано автоматически системой Sign3xPage footer (newpage).

4. Administration

The Sign3x panel is opened from the menu: Extras → Sign3x. It has two tabs.

4.1. “Employees” tab

Here you manage signer profiles — records linking a MODX user with their full name and position.

FieldDescription
MODX userThe linked manager user account
Full nameThe signer’s full name (recorded in the signature)
PositionThe signer’s position (recorded in the signature)

Important: a user must both have a signer profile and belong to one of the groups listed in sign3x_allowed_groups. If either condition is missing, the “Sign” button is not shown. The exception is users with the sudo flag: the group check is skipped for them.

4.2. “Documents” tab

A table of all uploaded documents with search, pagination and colour coding.

  • Grey row — draft (status = 0, not signed)
  • Green row — signed (status = 1)

Search works on the document name, the signer’s name and the hash key.

ButtonDescriptionCondition
Upload documentUploads a PDF file and creates a document with the “Draft” statusAlways available
SignOpens the signature confirmation dialogDrafts only + the current user has the right to sign
DeleteDeletes the document from the database (and the file, if the setting is on)Always available; asks for confirmation

4.3. Signing

  1. Click “Sign” next to the document.
  2. The dialog shows:
    • The document name and a link to preview the PDF
    • Your full name, position and the signing date/time
    • A warning that the action cannot be undone
  3. Click “Confirm”. The system:
    • Records the full name, position and exact signing time in the database
    • Generates a unique SHA-256 hash key
    • Sets the document status to “Signed”
    • Adds the visual stamp to the file if the PDF stamp is enabled

Signing cannot be undone. A signed document cannot be turned back into a draft from the interface.

5. The Sign3x snippet

The snippet outputs signed documents (status = 1) on the site with an electronic signature icon and the signer’s details.

5.1. Snippet parameters

ParameterTypeDefaultDescription
&idintnot setID of a specific document. If set, only this document is shown.
&limitint20Maximum number of documents. Sorted by signing date (newest first).
&tplstringsign3x.doc.defaultTemplate for one document: a chunk name or inline Fenom (@INLINE {$name}, requires &fenom=`1`).
&fenom0 / 10Process the template with Fenom (pdoTools). With 1 the {$placeholder} syntax is used.

Template placeholders

PlaceholderDescription
idDocument ID
nameDocument name (HTML-escaped)
file_urlFull URL of the PDF file
file_pathFile path relative to the site root
signer_fioSigner’s full name
signer_positionSigner’s position
signed_atSigning date and time (dd.mm.yyyy hh:mm:ss)
hash_keySHA-256 signature hash key
aria_labelFull ARIA text for the icon (accessibility)
assets_urlURL of the assets/ folder — for SVG icon links

5.2. Call examples

<!-- Last 20 signed documents, default template -->
[[!Sign3x]]

<!-- With a limit -->
[[!Sign3x? &limit=`5`]]

<!-- One specific document -->
[[!Sign3x? &id=`3`]]

<!-- Your own chunk (MODX syntax) -->
[[!Sign3x? &tpl=`sign3x.doc.bs5`]]

<!-- Your own chunk (Fenom syntax, requires pdoTools) -->
[[!Sign3x? &tpl=`sign3x.doc.bs5.fenom` &fenom=`1`]]

<!-- Inline Fenom template -->
[[!Sign3x? &tpl=`@INLINE <a href="{$file_url}">{$name}</a>` &fenom=`1`]]

6. Ready-made chunks

The component comes with six ready-made template chunks:

ChunkCSS frameworkSyntaxNote
sign3x.doc.defaultBuilt-in (frontend.css)MODX [[+]]Default chunk
sign3x.doc.default.fenomBuilt-in (frontend.css)Fenom {$}Requires pdoTools
sign3x.doc.bs5Bootstrap 5MODX [[+]]—
sign3x.doc.bs5.fenomBootstrap 5Fenom {$}Requires pdoTools
sign3x.doc.uikit3UIKit 3MODX [[+]]—
sign3x.doc.uikit3.fenomUIKit 3Fenom {$}Requires pdoTools

All chunks can be edited in Elements → Chunks. They contain the signature SVG icon, a tooltip with the name, position, date and hash, a link to the PDF and ARIA attributes for accessibility.

7. Fenom templates

Fenom is a template engine with {$var} syntax and {if}...{/if} conditions, provided by pdoTools. It does not depend on the MODX “Allow Fenom on pages” setting.

When to use Fenom chunks: when the template needs logic — conditional fields or loops. For example, showing the position only if it is set.

Syntax comparison

TaskMODX syntaxFenom syntax
Output a variable[[+name]]{$name}
Conditional block—{if $signer_position}...{/if}
EscapingDone in PHPDone in PHP

A Fenom chunk with a condition:

<div class="sign3x-document">
  <span class="sign3x-stamp" aria-label="{$aria_label}">
    <img src="{$assets_url}components/sign3x/img/sign3x.svg" width="32" height="32" alt="">
  </span>
  <a href="{$file_url}">{$name}</a>
  {if $signer_position}
    <small>{$signer_position}</small>
  {/if}
</div>

Calling the snippet with a Fenom chunk:

[[!Sign3x? &tpl=`sign3x.doc.default.fenom` &fenom=`1`]]

8. CSS and styles

The built-in styles are added automatically if sign3x_frontend_css is not empty. To disable the built-in styles and use your own CSS, clear the sign3x_frontend_css setting.

Key CSS classes

ClassDescription
.sign3x-listWrapper of the default template: a vertical flex list with gaps
.sign3x-documentOne document: a flex row (icon + link)
.sign3x-stampIcon trigger element with a tooltip
.sign3x-stamp-iconElectronic signature SVG icon
.sign3x-stamp-tooltipTooltip with the signature details
.sign3x-stamp-keyHash key (monospace font, wrapping)
.sign3x-doc-linkLink to the PDF document

9. Visual PDF stamp

When sign3x_pdf_stamp is on, a visual stamp is added to the PDF file after signing. The FPDI and TCPDF libraries are included in the package.

Stamp modes

ModeDescription
overlayA blue rectangular stamp on top of the last page of the document (bottom right corner)
newpageA separate “electronic signature sheet” page is appended to the document

When the stamp is created successfully, the original file is replaced with the signed version and the path is updated in the database. On error the document is kept without the stamp and the error is written to the MODX log.

All stamp texts are configured with the sign3x_stamp_* system settings.

10. Signature verification

Every signature comes with a unique SHA-256 hash key built from the following data:

SHA-256(id|name|file_path|fio|position|signed_at|salt)
ComponentValue
idDocument ID in the database
nameDocument name
file_pathFile path at the moment of signing
fioSigner’s full name from the profile
positionSigner’s position from the profile
signed_atExact signing date/time (MySQL datetime)
saltSecret salt from the sign3x_secret_salt setting

The hash key is shown:

  • In the documents table (“Documents” tab)
  • In the tooltip on the site when hovering over the signature icon
  • In the PDF stamp (if enabled)

Do not change sign3x_secret_salt after the first signature. Changing the salt makes it impossible to reproduce the hash keys and effectively voids the verifiability of all existing signatures.