Auth0.Common.Util (Auth0Api v1.4.0) View Source
Documentation for Util.
Link to this section Summary
Functions
append query to endpoint.
Convert to form body from map. Nil value is removed.
Convert to query from map. Nil value is removed.
Decode json using atom key.
Generate SHA256 hash value.
Encode to Base 16 value with lower case.
Generate HMAC-SHA256 hash value.
Remove nil value from map recursively.
Convert struct to map recursively.
Convert map to struct and string keys are considered.
Generate UUID4 value.
Link to this section Functions
Specs
append query to endpoint.
Examples
iex> Auth0.Common.Util.append_query("a=1&c=3&d=erin%20the%20black", "/hoge/fuga")
"/hoge/fuga?a=1&c=3&d=erin%20the%20black"
Specs
Convert to form body from map. Nil value is removed.
Examples
iex> Auth0.Common.Util.encode_form_body(%{a: 1, b: nil, c: 3, d: "erin the black"})
{:form, [a: 1, b: nil, c: 3, d: "erin the black"]}
Specs
Convert to query from map. Nil value is removed.
Examples
iex> Auth0.Common.Util.encode_query(%{a: 1, b: nil, c: 3, d: "erin the black"})
"a=1&c=3&d=erin%20the%20black"
Specs
Decode json using atom key.
Specs
Generate SHA256 hash value.
Examples
iex> Auth0.Common.Util.hash("erin")
<<124, 188, 203, 12, 76, 170, 223, 159, 205, 181, 30, 228, 87, 168, 40, 204,
114, 164, 88, 121, 131, 27, 91, 151, 138, 226, 226, 206, 252, 68, 151, 5>>
Specs
Encode to Base 16 value with lower case.
Examples
iex> Auth0.Common.Util.hex_encode("erin")
"6572696e"
Specs
Generate HMAC-SHA256 hash value.
Examples
iex> Auth0.Common.Util.hmac("secret", "erin")
<<66, 116, 70, 47, 123, 250, 150, 31, 51, 11, 16, 118, 149, 254, 106, 254, 89,
65, 153, 52, 185, 191, 44, 50, 250, 254, 55, 172, 101, 31, 249, 250>>
Specs
Remove nil value from map recursively.
Examples
iex> Auth0.Common.Util.remove_nil(%{a: 1, b: nil, c: 3})
%{a: 1, c: 3}
iex> Auth0.Common.Util.remove_nil(%{:a => 1, :b => nil, :c => 3, "d" => nil, "f" => 5})
%{:a => 1, :c => 3, "f" => 5}
Specs
Convert struct to map recursively.
Specs
Convert map to struct and string keys are considered.
Specs
uuid() :: String.t()
Generate UUID4 value.