IndieWeb.Auth.Code (IndieWeb v0.0.49) View Source

Handles authentication codes for the IndieAuth flow.

Link to this section Summary

Functions

Provides the age, in seconds, of a code.

Destroys all codes associated with the provided parameters.

Generates a code for IndieAuth based on the client_id, redirect_uri and any other extra parameters.

Generates a PKCE-compatible challenge string for the provided parameters.

Link to this section Functions

Specs

age(keyword()) :: non_neg_integer()

Provides the age, in seconds, of a code.

Link to this function

destroy(client_id, redirect_uri, params \\ %{}, options \\ [])

View Source

Specs

destroy(binary(), binary(), map(), keyword()) :: :ok

Destroys all codes associated with the provided parameters.

Link to this function

generate(client_id, redirect_uri, params \\ %{}, options \\ [])

View Source

Specs

generate(binary(), binary(), map(), keyword()) :: binary()

Generates a code for IndieAuth based on the client_id, redirect_uri and any other extra parameters.

Link to this function

generate_challenge(client_id, redirect_uri, data \\ %{}, options \\ [])

View Source

Specs

generate_challenge(binary(), binary(), map(), keyword()) :: {binary(), binary()}

Generates a PKCE-compatible challenge string for the provided parameters.

Link to this function

persist(code, client_id, redirect_uri, params \\ %{}, options \\ [])

View Source

Specs

persist(binary(), binary(), binary(), map(), keyword()) :: :ok

Stores a code for later verification.

Provided a code, a client's ID client_id, the URL that this should redirect to redirect_uri as well as any arguments used to craft this authorization request in params, store said code and references to for later verification.

Link to this function

verify(code, client_id, redirect_uri, params \\ %{}, options \\ [])

View Source

Specs

verify(binary(), binary(), binary(), map(), keyword()) :: :ok | {:error, any()}

Verifies a code with the provided fields.

Confirms that a code code was created for the provided client's ID client_id, the URL that this should redirect to redirect_uri as well as any arguments used to craft this authorization request in params.

Link to this function

verify_challenge(code_challenge, client_id, redirect_uri, data \\ %{}, options \\ [])

View Source

Specs

verify_challenge(binary(), binary(), binary(), map(), keyword()) ::
  :ok | {:error, any()}