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

A time-stamp request, the `TimeStampReq` of RFC 3161 (2.4.1).

`Tspex.request/2` builds one and `Tspex.decode_request/2` reads one (for a
test server or for inspection). Keep the struct of a request you send:
`Tspex.verify/3` needs it to check the nonce and the imprint of the
response.

Fields:

  * `:der` - the request in DER, the body of the POST.
  * `:version` - always 1.
  * `:hash` - the hash of the message imprint, such as `:sha256`; the OID
    as a tuple when a request that was read uses an algorithm this library
    does not know.
  * `:digest` - the digest, the `hashedMessage`.
  * `:policy` - the requested TSA policy as an OID tuple, or `nil`.
  * `:nonce` - the nonce, or `nil`.
  * `:cert_req` - whether the certificate of the TSA is asked for.
  * `:extensions` - `[%{oid: tuple, critical: boolean, value: binary}]`,
    with the value as the DER bytes of the extension.

# `t`

```elixir
@type t() :: %Tspex.Request{
  cert_req: boolean(),
  der: binary(),
  digest: binary(),
  extensions: [Tspex.extension()],
  hash: Tspex.hash() | :md5 | tuple(),
  nonce: pos_integer() | nil,
  policy: tuple() | nil,
  version: 1
}
```

A `TimeStampReq`: the fields, and `der`, the request as it goes to the TSA.

---

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