# `ExAcme.Challenge`
[🔗](https://github.com/jtdowney/ex_acme/blob/main/lib/ex_acme/challenge.ex#L1)

Represents an [ACME Challenge object](https://datatracker.ietf.org/doc/html/rfc8555#section-7.1.5).

Provides functionalities to handle challenges required for validation.

### Attributes

  - `url` - The URL of the challenge.
  - `status` - The current status of the challenge.
  - `type` - The type of challenge (e.g., "dns-01").
  - `token` - The challenge token.
  - `validated` - Datetime when the challenge was validated.
  - `error` - Any error associated with the challenge.

# `t`

```elixir
@type t() :: %ExAcme.Challenge{
  error: map() | nil,
  status: String.t(),
  token: String.t() | nil,
  type: String.t(),
  url: String.t(),
  validated: DateTime.t() | nil
}
```

ACME Challenge Object

# `find_by_type`

```elixir
@spec find_by_type(ExAcme.Authorization.t(), String.t()) :: t() | nil
```

Finds a challenge of a specific type within an authorization.

## Parameters

  - `authorization` - The authorization object.
  - `type` - The type of challenge to find (e.g., "dns-01").

## Returns

  - The challenge object if found, else `nil`.

# `key_authorization`

```elixir
@spec key_authorization(String.t(), ExAcme.AccountKey.t()) :: String.t()
```

Generates the key authorization string for a challenge.

## Parameters

  - `token` - The challenge token.
  - `account_key` - The account key.

## Returns

  - The key authorization string.

---

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