# `SSL.Protocol.ServerHello`
[🔗](https://github.com/gsmlg-dev/http_fetch/blob/v0.16.7/apps/ex_ssl/lib/ssl/protocol/server_hello.ex#L1)

Pure, bounded decoder for TLS 1.3 ServerHello and HelloRetryRequest messages.

The input starts at a handshake header. A successful decode retains the exact
consumed bytes and returns any concatenated handshake bytes as the remainder.

# `expectations`

```elixir
@type expectations() :: %{
  :legacy_session_id =&gt; binary(),
  optional(:offered_versions) =&gt; [0..65535],
  :offered_ciphers =&gt; [0..65535],
  :offered_groups =&gt; [0..65535],
  :offered_key_share_groups =&gt; [0..65535],
  :offered_extension_ids =&gt; [0..65535],
  :offered_psk_key_exchange_modes =&gt; [0 | 1],
  optional(:offered_psk_count) =&gt; non_neg_integer()
}
```

# `extension`

```elixir
@type extension() ::
  {:supported_versions, 772}
  | {:key_share, %{group: 0..65535, key_exchange: binary()}}
  | {:selected_group, 0..65535}
  | {:pre_shared_key, non_neg_integer()}
  | {:cookie, binary()}
```

# `kind`

```elixir
@type kind() :: :server_hello | :hello_retry_request
```

# `t`

```elixir
@type t() :: %SSL.Protocol.ServerHello{
  cipher_suite: 0..65535,
  compression_method: 0,
  encoded: binary(),
  extensions: [extension()],
  kind: kind(),
  legacy_session_id_echo: binary(),
  legacy_version: 771,
  random: binary()
}
```

# `decode`

```elixir
@spec decode(term(), term(), keyword()) ::
  {:ok, t(), binary()} | {:more, non_neg_integer()} | {:error, term()}
```

---

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