Mounts the signer's link pages in a host's Phoenix router.
import Countersign.Router
scope "/" do
pipe_through :signing
countersign_routes "/sign", MyApp.Signing
endconfig_module is a module with config/0 answering the host's
Countersign.Config. The routes are:
GET <path>/:token, the landing page (Countersign.Web.LinkController);POST <path>/:token/code, which sends a code;POST <path>/:token/verify, which checks it;GET <path>/:token/review, the signing page (Countersign.Web.SigningLive, inlive_session :countersign);GET <path>/:token/documentandGET <path>/:token/copy, the PDFs (Countersign.Web.DocumentController).
The last three are behind Countersign.Web.Admit, which needs the
session's verified code. The two POST routes carry the code in their body
and are declared with log: false, so no host request-logs them. The
token is in every path: keep these paths out of the host's request log as
well, and send Referrer-Policy: no-referrer and Cache-Control: no-store
from the pipeline. The host's LiveView socket must offer the
:peer_data and :user_agent connect info, which the signature records.
Behind a proxy the peer is the proxy: a host there derives the client IP
in its own plug, keeps it in the session and names that key in the
config's :client_ip_session_key, and the signature records it instead.
A router mounts the signing page once: a second countersign_routes in
the same router repeats the :countersign live_session.
path must equal the config's :sign_path, which builds the links and the
page's redirects.
Summary
Functions
Declares the link routes under path for the config config_module.config().