# `VintageNetWiFi.Cookbook`
[🔗](https://github.com/nerves-networking/vintage_net_wifi/blob/v0.12.9/lib/vintage_net_wifi/cookbook.ex#L5)

Recipes for common WiFi network configurations

For example, if you want the standard configuration for the most common type of WiFi
network (WPA2 Preshared Key networks), pass the SSID and password to `wpa_psk/2`

# `generic`

```elixir
@spec generic(String.t(), String.t()) ::
  {:ok, map()}
  | {:error,
     VintageNetWiFi.WPA2.invalid_ssid_error()
     | VintageNetWiFi.WPA2.invalid_passphrase_error()}
```

Return a generic configuration for connecting to preshared-key networks

The returned configuration should be able to connect to an access point
configured to use WPA3-only, WPA2/3 transitional or WPA2. The WiFi module
must also support WPA3 for this to work.

Pass an SSID and passphrase. If the SSID and passphrase are ok, you'll get an
`:ok` tuple with the configuration. If there's a problem, you'll get an error
tuple with a reason.

# `open_access_point`

```elixir
@spec open_access_point(String.t(), VintageNet.any_ip_address()) ::
  {:ok, map()} | {:error, term()}
```

Return a configuration for creating an open access point

Pass an SSID and an optional IPv4 class C network.

# `open_wifi`

```elixir
@spec open_wifi(String.t()) ::
  {:ok, map()} | {:error, VintageNetWiFi.WPA2.invalid_ssid_error()}
```

Return a configuration for connecting to open WiFi network

Pass an SSID and passphrase. If the SSID and passphrase are ok, you'll get an
`:ok` tuple with the configuration. If there's a problem, you'll get an error
tuple with a reason.

# `wpa3_sae`

```elixir
@spec wpa3_sae(String.t(), String.t()) ::
  {:ok, map()}
  | {:error,
     VintageNetWiFi.WPA2.invalid_ssid_error()
     | VintageNetWiFi.WPA2.invalid_passphrase_error()}
```

Return a configuration for connecting to a WPA3 network

Pass an SSID and passphrase. If the SSID and passphrase are ok, you'll get an
`:ok` tuple with the configuration. If there's a problem, you'll get an error
tuple with a reason.

# `wpa_eap_peap`

```elixir
@spec wpa_eap_peap(String.t(), String.t(), String.t()) ::
  {:ok, map()} | {:error, VintageNetWiFi.WPA2.invalid_ssid_error()}
```

Return a configuration for connecting to a WPA-EAP PEAP network

Pass an SSID and login credentials. If valid, you'll get an
`:ok` tuple with the configuration. If there's a problem, you'll get an error
tuple with a reason.

# `wpa_psk`

```elixir
@spec wpa_psk(String.t(), String.t()) ::
  {:ok, map()}
  | {:error,
     VintageNetWiFi.WPA2.invalid_ssid_error()
     | VintageNetWiFi.WPA2.invalid_passphrase_error()}
```

Return a configuration for connecting to a WPA-PSK network

Pass an SSID and passphrase. If the SSID and passphrase are ok, you'll get an
`:ok` tuple with the configuration. If there's a problem, you'll get an error
tuple with a reason.

---

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