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

A signing request (`signing_requests`): one invitation to one remote signer
to sign one role of one subject.

The delivery address is stored encrypted (`to_address`), as a keyed digest
(`to_digest`) and as a masked hint (`to_hint`). The link token is stored
only as its SHA-256 hash (`token_hash`) and, encrypted, as
`last_token_ciphertext` while the request is pending. The virtual
`address` field holds the decrypted address only while Countersign hands
the request to a `Countersign.Delivery` callback; it is never persisted
and is redacted from `inspect/2`.

# `status`

```elixir
@type status() ::
  :pending | :signed | :declined | :expired | :revoked | :superseded | :failed
```

# `t`

```elixir
@type t() :: %Countersign.Request{
  __meta__: term(),
  address: String.t() | nil,
  certificate_ref: String.t() | nil,
  codes: term(),
  consent_sha256: String.t() | nil,
  consent_version: pos_integer() | nil,
  consented_at: DateTime.t() | nil,
  content_sha256: String.t() | nil,
  decline_kind: :declined | :paper_requested | nil,
  decline_reason: String.t() | nil,
  declined_at: DateTime.t() | nil,
  delivery_channel: :email | :sms | nil,
  expires_at: DateTime.t() | nil,
  failed_reason: String.t() | nil,
  id: Ecto.UUID.t() | nil,
  inserted_at: DateTime.t() | nil,
  last_sent_at: DateTime.t() | nil,
  last_token_ciphertext: binary() | nil,
  opened_at: DateTime.t() | nil,
  reminded_at: DateTime.t() | nil,
  resent_times: [DateTime.t()],
  revoke_reason: String.t() | nil,
  revoked_at: DateTime.t() | nil,
  revoked_by_ref: String.t() | nil,
  role: String.t() | nil,
  scope_id: Ecto.UUID.t() | nil,
  send_count: non_neg_integer() | nil,
  sent_by_ref: String.t() | nil,
  sign_ip: String.t() | nil,
  sign_method: :drawn | :typed | nil,
  sign_user_agent: String.t() | nil,
  signature_ref: String.t() | nil,
  signed_at: DateTime.t() | nil,
  signer_name: String.t() | nil,
  signer_ref: String.t() | nil,
  signer_relationship: String.t() | nil,
  status: status() | nil,
  subject_id: String.t() | nil,
  subject_type: String.t() | nil,
  to_address: binary() | nil,
  to_digest: binary() | nil,
  to_hint: String.t() | nil,
  token_hash: binary() | nil,
  updated_at: DateTime.t() | nil,
  verified_at: DateTime.t() | nil,
  verified_times: [DateTime.t()]
}
```

# `channels`

```elixir
@spec channels() :: [:email | :sms]
```

The delivery channels a request can use.

# `copy_days`

```elixir
@spec copy_days() :: pos_integer()
```

Days after signing that the signer may get a copy through the link.

# `copyable?`

```elixir
@spec copyable?(t(), DateTime.t()) :: boolean()
```

Whether a signed request's signer may still get a copy at `now`: within
30 days of `signed_at`.

# `live?`

```elixir
@spec live?(t(), DateTime.t()) :: boolean()
```

Whether the request is pending and not yet past `expires_at` at `now`.

# `statuses`

```elixir
@spec statuses() :: [status()]
```

Every status a request can hold.

---

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