JsonWebToken.Util
Utility functions
Summary↑
constant_time_compare?(a, b) | Predicate that compares two strings for equality in constant-time to avoid timing attacks |
validate_present(param) | Return the string passed in, unless it is nil or an empty string |
Functions
Predicate that compares two strings for equality in constant-time to avoid timing attacks
Example
iex> JsonWebToken.Util.constant_time_compare?("a", "A")
false
see: https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40#section-3.2
Return the string passed in, unless it is nil or an empty string
Example
iex> JsonWebToken.Util.validate_present("a")
"a"