Resuelve AuthPlug v1.4.3 ResuelveAuth.Utils.Secret View Source

Contains encoding, decoding, encryption, and decryption logic.

Link to this section Summary

Functions

Identify if the tuple of the signed string is valid according to the sent token.

Sign the information with a seed (secret) by first going through a coding process.

Link to this section Functions

Link to this function

cypher(data, sign, secret)

View Source

Specs

decode(tuple() | %{}) :: {:ok, any()} | {:error, any()}
decode(%{}) :: {:ok, any()} | {:error, any()}

Specs

decode64(%{}) :: tuple()

Specs

encode(%{}) :: tuple()

Specs

encode64(tuple() | %{}) :: {:ok, any()} | {:error, any()}
Link to this function

equivalent?(params, sign)

View Source

Specs

equivalent?({:error, String.t()}, String.t() | nil) :: {:error, String.t()}
equivalent?(%{}, String.t()) :: boolean()

Identify if the tuple of the signed string is valid according to the sent token.

Example


iex> alias ResuelveAuth.Utils.Secret
iex> data = %{valid: "datos"}
iex> Secret.equivalent?(data, "datos")
true

iex> alias ResuelveAuth.Utils.Secret
iex> data = {:error, "error message"}
iex> Secret.equivalent?(data, "data")
{:error, "error message"}

Specs

sign(%{}, list()) :: String.t()

Sign the information with a seed (secret) by first going through a coding process.