Countersign.Web.Admit (Countersign v0.1.0)

Copy Markdown View Source

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

A page is admitted only when the session entry under the config's :session_key (put there by the code check of Countersign.Web.LinkController on a correct code) names the request the path's token opens, its "verified_at" is less than Countersign.Requests.verification_seconds/0 old, the scope is switched on (Countersign.Host.enabled?/1), and the request is live, or, for :copy, signed and inside its copy window (Countersign.Request.copyable?/2). Anything else goes back to the landing page, which asks for a new code or shows the dead link, so the gate never says which check failed.

Countersign.Router.countersign_routes/2 mounts it: on_mount/4 in front of Countersign.Web.SigningLive, call/2 in front of the document and copy downloads. Both assign :countersign_config (the Countersign.Config), :signing_request and :signing_token.

Summary

Functions

{:ok, request} when entry (the session's value under the config's :session_key) admits token's request for mode, else :error. The config's host clock decides the age of the verification.

The landing page of token.

Types

mode()

@type mode() :: :sign | :copy

Functions

admit(config, mode, token, arg4)

@spec admit(Countersign.Config.t(), mode(), String.t(), term()) ::
  {:ok, Countersign.Request.t()} | :error

{:ok, request} when entry (the session's value under the config's :session_key) admits token's request for mode, else :error. The config's host clock decides the age of the verification.

landing_path(config, token)

@spec landing_path(Countersign.Config.t(), String.t()) :: String.t()

The landing page of token.