# `Tspex.Response`
[🔗](https://github.com/openspb/tspex/blob/v0.1.0/lib/tspex/response.ex#L1)

A time-stamp response, the `TimeStampResp` of RFC 3161 (2.4.2), as
`Tspex.decode_response/2` reads it. Reading only parses: a rejection is a
valid response, with `token: nil`, and it is `Tspex.verify/3` that turns
it into an error.

Fields:

  * `:status` - `:granted`, `:granted_with_mods`, `:rejection`,
    `:waiting`, `:revocation_warning` or `:revocation_notification`.
  * `:status_text` - the `statusString`, a list of strings; `[]` when
    absent.
  * `:fail_info` - the bits of `failInfo`, as `:bad_alg`, `:bad_request`,
    `:bad_data_format`, `:time_not_available`, `:unaccepted_policy`,
    `:unaccepted_extension`, `:add_info_not_available` or
    `:system_failure`; a bit RFC 3161 does not define is
    `{:unknown_bit, n}`. `[]` when absent.
  * `:token` - the `TimeStampToken` (a `ContentInfo`) as received, in
    the bytes of the response; `nil` when there is none.
  * `:deviations` - what was tolerated against the RFC.

# `fail_info`

```elixir
@type fail_info() ::
  :bad_alg
  | :bad_request
  | :bad_data_format
  | :time_not_available
  | :unaccepted_policy
  | :unaccepted_extension
  | :add_info_not_available
  | :system_failure
  | {:unknown_bit, non_neg_integer()}
```

A `PKIFailureInfo` bit; a bit this library does not know is `{:unknown_bit, n}`.

# `status`

```elixir
@type status() ::
  :granted
  | :granted_with_mods
  | :rejection
  | :waiting
  | :revocation_warning
  | :revocation_notification
```

The `PKIStatus` of a response.

# `t`

```elixir
@type t() :: %Tspex.Response{
  deviations: [atom()],
  fail_info: [fail_info()],
  status: status(),
  status_text: [String.t()],
  token: binary() | nil
}
```

A `TimeStampResp`: the status, its texts and failure bits, and the token if any.

---

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