ExAcme.Challenge (ExAcme v0.1.0)

View Source

Represents an ACME Challenge object.

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.

Summary

Types

t()

ACME Challenge Object

Functions

Fetches a challenge from the ACME server.

Finds a challenge of a specific type within an authorization.

Generates the key authorization string for a challenge.

Triggers the validation of a challenge.

Types

t()

@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

Functions

fetch(url, account_key, client)

@spec fetch(String.t(), ExAcme.AccountKey.t(), ExAcme.client()) ::
  {:ok, t()} | {:error, term()}

Fetches a challenge from the ACME server.

Parameters

  • url - The challenge URL.
  • account_key - The account key for authentication.
  • client - The ExAcme client agent.

Returns

  • {:ok, challenge} on success.
  • {:error, reason} on failure.

find_by_type(authorization, type)

@spec find_by_type(map(), String.t()) :: t() | nil

Finds a challenge of a specific type within an authorization.

Parameters

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

Returns

  • The challenge object if found, else nil.

key_authorization(token, account_key)

@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.

trigger_validation(url, account_key, client)

@spec trigger_validation(String.t(), ExAcme.AccountKey.t(), ExAcme.client()) ::
  {:ok, t()} | {:error, term()}

Triggers the validation of a challenge.

Parameters

  • url - The challenge URL.
  • account_key - The account key for authentication.
  • client - The ExAcme client agent.

Returns

  • {:ok, challenge} on success.
  • {:error, reason} on failure.