API Reference Countersign v#0.1.0

Copy Markdown View Source

Modules

The signing certificate: one page saying who signed what, proven how, and when, built from the signed request and two labels the host gives (Countersign.Signable.type_label/1 and Countersign.Signable.role_label/2).

The signing certificate's page (Countersign.Certificate.html/4): one self-contained HTML document, its CSS inline, fetching nothing, so a PDF renderer with no network draws it whole.

A signing code (signing_codes): a six-digit one-time code sent to the address the link went to.

Everything Countersign needs from its host, passed to every call.

Encryption and digests under keys derived from the host's secret_key_base (Countersign.Config).

The behaviour that carries a signing link or a signing code to the signer, by the request's delivery_channel (email or sms; the host decides what each means).

The package's default consumer disclosure: what a signer reads and accepts before an electronic signature, in the spirit of the U.S. ESIGN Act's consumer consent (15 U.S.C. 7001(c)). It says what will be signed electronically, that the signer may sign on paper instead, that consent may be withdrawn before signing, what the signer needs to read the document, how to get a copy, and that the sender keeps the record.

The masked form of a delivery address, the only form a screen shows: m•••@gmail.com for an email, •••-•••-0142 for a phone number.

The behaviour an application implements once to run Countersign.

Creates and drops Countersign's tables from a host migration, in the shape of Oban.Migration.

A signing request (signing_requests): one invitation to one remote signer to sign one role of one subject.

The signing-request lifecycle.

Mounts the signer's link pages in a host's Phoenix router.

Seals a PDF so it proves by itself that it was not altered, and checks such a seal.

The seal's certificates and keys: a self-signed X.509 certificate for an Ed25519 or SLH-DSA key, what the seal reads from one, and their PEM form.

The behaviour for the thing being signed: a contract, a consent form, a plan of care. Countersign never stores the subject; it stores subject_type and subject_id and asks this module for everything else.

The daily sweep over pending requests (Countersign.Workers.Daily runs it): one reminder for each request sent long enough ago, then expiry for each request past its expires_at.

Signing-link tokens: 32 random bytes, URL-safe base64 without padding.

The gate of the signer's pages past the code: the signing page and its document, which sign, and the signed copy.

The signer's first pages, mounted by Countersign.Router.countersign_routes/2: the landing page, the code request and the code check.

The link pages' templates (Countersign.Web.LinkController). They render inside the host's root layout and use only plain HTML with a few class names (countersign-*), so they take the host's styles without needing its components. Every sentence is fixed here; the sender's name and the address hint are the only values shown.

The signing page, <sign_path>/:token/review, past the code and behind Countersign.Web.Admit.

The Oban worker that renders and stores one signed request's certificate (Countersign.Certificate). A host uses it and names it as the config's :certificate_worker; Countersign.Requests.sign/3 then inserts the job in the sign transaction.

The Oban worker that delivers one signing code. A host uses it and names it as the config's :code_worker; Countersign.Requests.request_code/2 then inserts the job in the transaction that wrote the code.

The Oban worker that runs the daily sweep (Countersign.Sweep): expiry, then one reminder for each request due one.

The Oban worker that delivers a request's link: the first send, a resend and the reminder.

Mix Tasks

Writes a migration that creates Countersign's tables by calling Countersign.Migrations.up/1 and down/1.

Writes two self-signed certificates and their PKCS #8 private keys, one Ed25519 and one SLH-DSA, as PEM files Countersign.Seal.Cert.from_pem/2 reads back