Countersign.Delivery behaviour (Countersign v0.1.0)

Copy Markdown View Source

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).

Each delivery answers :ok, {:error, :retry} for a transient failure the caller may retry, or {:error, {:permanent, reason}}, which marks a pending request failed (failed_reason) and audits and notifies :fail (Countersign.Requests.deliver_link/3, request_code/2).

Summary

Types

Whether a link is the first send (or a resend) or the reminder.

Callbacks

Sends the six-digit signing code to the request's address.

Sends the signing link url to the request's address. Countersign fills the request's virtual, redacted address field with the decrypted address before it calls any callback of this behaviour.

Whether the request's address can still be reached on its channel (for example, a phone number that has not opted out). Answers :ok or {:error, reason}.

Types

result()

@type result() :: :ok | {:error, :retry} | {:error, {:permanent, term()}}

Callbacks

deliver_code(t, code)

@callback deliver_code(Countersign.Request.t(), code :: String.t()) :: result()

Sends the six-digit signing code to the request's address.

deliver_link(t, url, link_kind)

@callback deliver_link(Countersign.Request.t(), url :: String.t(), link_kind()) ::
  result()

Sends the signing link url to the request's address. Countersign fills the request's virtual, redacted address field with the decrypted address before it calls any callback of this behaviour.

reachable(t)

@callback reachable(Countersign.Request.t()) :: :ok | {:error, term()}

Whether the request's address can still be reached on its channel (for example, a phone number that has not opted out). Answers :ok or {:error, reason}.