# `Countersign.Delivery`
[🔗](https://github.com/mkreyman/countersign/blob/v0.1.0/lib/countersign/delivery.ex#L1)

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

# `link_kind`

```elixir
@type link_kind() :: :initial | :reminder
```

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

# `result`

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

# `deliver_code`

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

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

# `deliver_link`

```elixir
@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`

```elixir
@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}`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
