All notable changes to this project are recorded here. The format follows Keep a Changelog, and the project follows Semantic Versioning; breaking changes are allowed in 0.x and are marked Breaking.
Unreleased
0.1.0 - 2026-12-05
The first release on Hex.
Added
- HexDocs guides: Getting started, one page per behaviour (
Countersign.Host,Countersign.Signable,Countersign.Delivery) and the security model. Countersign.Config :client_ip_session_key: the session key under which the host's plug keeps the signer's client IP. The signing page records that IP, and the socket's peer only when the session holds none, so a page served behind a proxy records the signer and not the proxy.Countersign.Seal:seal/3adds an Ed25519 and an SLH-DSA PAdES signature (ETSI.CAdES.detached) to a PDF as two incremental updates;verify/1checks them.Countersign.Seal.Certmakes and reads the self-signed certificates and PKCS #8 keys, andmix countersign.gen.seal_keyswrites them.- The behaviours
Countersign.Host,Countersign.SignableandCountersign.Delivery. Countersign.Config, validated byCountersign.Config.new!/1.- The schemas
Countersign.Request(signing_requests) andCountersign.Code(signing_codes), created by the idempotent, versionedCountersign.Migrations(version 1), andmix countersign.gen.migration. Countersign.Token,Countersign.HintandCountersign.Crypto.Countersign.Requests:send/3,open/2,request_code/2,verify_code/3,consent/3,sign/3,deliver_link/3,link_url/2,verification_seconds/0. A verified code lets the signer consent and sign for 30 minutes; a permanent delivery failure fails the request and frees its role; a superseded request is audited and notified.Countersign.Config :sign_path(default"/sign"), where the host mounts the signing page.- The sender's side of
Countersign.Requests:send/4takes:before_insertand:after_inserthooks run in its transaction after the subject lock;resend/3(a new token, at most 5 sends by default,:before_resend/:after_resendhooks, a changed subject supersedes);revoke/4;supersede/4(:all,:stale,{:filled, roles, except_id}; audited in the caller's transaction, notified after commit throughnotify_superseded/2);get_by_token/2,list/3andcount/2. The host event set gains:resend. Countersign.Workers.DeliveryandCountersign.Workers.Daily, Oban workers a hostuses. A delivery job carries the request id, scope andsend_count(no token), drops itself once the request is resent, ended or pastexpires_at, snoozes while the scope is switched off, and fails the request on its last attempt. The daily job runsCountersign.Sweep: expiry, then one reminder per request, paged per scope.Requests.fail/3is public.- The signer's first pages:
Countersign.Web.LinkController(landing, code request, code check) with its templatesCountersign.Web.LinkHTML, mounted byCountersign.Router.countersign_routes/2, which declares the two POST routes that carry the code withlog: false. A verified code puts the request id and the time in the session under the config's new:session_key. Requests.landing/2opens a live request or a signed one still inside its 30-day copy window (Request.copyable?/2);request_code/2andverify_code/3accept both.request_code/2now also refuses while the scope is switched off (:disabled) and when the delivery says the address can no longer be reached ({:unreachable, reason}).Countersign.Workers.Code, an Oban worker a hostuses and names as the config's:code_worker:request_code/2then queues the code's delivery in the transaction that wrote it, andRequests.deliver_code/3sends it.Requests.code_attempts_left/2.- The signing page:
Countersign.Web.SigningLiveat<sign_path>/:token/review(consent to the disclosure, the document, a drawn or typed signature, decline, sign on paper instead, the signed page with its copy), andCountersign.Web.DocumentController's<sign_path>/:token/documentand<sign_path>/:token/copyPDFs (each render a:viewaudit naming its purpose), all behindCountersign.Web.Admit, a gate on the session's verified code (30 minutes), the scope's switch and the request's state.countersign_routes/2mounts them, the LiveView inlive_session :countersign. Countersign.Disclosure, the default consumer disclosure, and the config's:signature_pad({module, function}), the function component a host renders to capture a drawn signature.Requests.decline/4(:declinedor:paper_requested, a reason of at most 1000 characters; likesign/3it needs the URL's:tokenand a switched-on scope),Requests.review/2(the subject, checked against the request, or the request superseded) andRequests.copy_subject/2.- The demo app in
examples/demo. - The signing certificate:
Countersign.Certificate(facts/3,html/4,render/3, the pageCountersign.Certificate.HTML) and the worker templateCountersign.Workers.Certificate, whichRequests.sign/3enqueues in the sign transaction when the config names a:certificate_worker; it renders throughHost.html_to_pdf/1, stores throughSignable.store_document/4with the request row locked, and pinscertificate_refonce. Its text wraps between words (overflow-wrap: anywhere, withword-wrap: break-wordfor older PDF engines); only ids and hashes incodebreak at any character. Countersign.Migrationsversion 2:signing_requests.resent_times,verified_times(every resend and every code verification) andsign_method(:drawnor:typed). A host that ran version 1 adds a migration callingup(version: 2)anddown(version: 2);mix countersign.gen.migrationwrites the current version.
Changed
- Breaking:
Requests.sign/3takes:token, the token of the URL the signing page was opened on, and signs only when it hashes to the row'stoken_hash; it signs nothing while the scope is switched off ({:error, :disabled}, the request stays pending); a subject no longer found or signable supersedes the request, and so does a role already signed ({:error, :already_signed}), which used to roll back. Config's:disclosuredefaults toCountersign.Disclosure.default/0;nilstill turns consent off.Host.reminder_days/1may answer0, which sends no reminder.- Breaking:
Countersign.Signablegainstype_label/1, the subject's kind as the certificate names it, andstore_document/4may answer{:cancel, reason}for a failure no retry fixes. Requests.open/2looks the token up whatever its shape, so a malformed token costs the same as an unknown one.