Certbot v0.5.1 Certbot.Acme.Challenge View Source

Struct with utility functions for dealing with Acme Challenges

Link to this section Summary

Functions

Return authorization token given a challenge and the jwk used to generate it

Convert structs of the same shape, to a Certbot.Acme.Challenge struct.

Link to this section Types

Link to this type

t()

View Source
t() :: %Certbot.Acme.Challenge{
  status: String.t(),
  token: String.t(),
  type: String.t(),
  uri: String.t()
}

Link to this section Functions

Link to this function

authorization(token, jwk)

View Source
authorization(binary() | %{token: any()}, any()) :: String.t()

Return authorization token given a challenge and the jwk used to generate it

Example

iex> jwk = "test/fixtures/selfsigned_key.pem" |> File.read!() |> JOSE.JWK.from_pem() |> JOSE.JWK.to_map()
iex> Certbot.Acme.Challenge.authorization("some_token", jwk)
"some_token.v5Co8pJG2fo_hBcdhEzpj_DSEcev76KkbFQkJRiu-Cg"

Convert structs of the same shape, to a Certbot.Acme.Challenge struct.

Example

iex> Certbot.Acme.Challenge.from_struct(%Acme.Challenge{type: "http-01"})
%Certbot.Acme.Challenge{
            status: nil,
            token: nil,
            type: "http-01",
            uri: nil
          }