D2lvalenceElixir.Auth.D2LSigner.get_hash

You're seeing just the function get_hash, go back to D2lvalenceElixir.Auth.D2LSigner module for more information.
Link to this function

get_hash(key_string, base_string)

View Source

Specs

get_hash(String.t(), String.t()) :: String.t()

Get a digest value suitable for direct inclusion into an URL's query parameter as a token.

Note that Valence API services expect signatures to be generated with the following constraints:

  • Encoding keys, and base strings, are UTF-8 encoded
  • HMAC digests are generated using a standard SHA-256 hash
  • Digests are then "URL-safe" base64 encoded (where - and _ substitute for + and /)
  • The resulting string is then stripped of all = characters, and all leading and trailing whitespace characters

key_string and base_string must be utf-8 encoded

Examples

iex> D2lvalenceElixir.Auth.D2LSigner.get_hash([104, 111, 108, 97, 195, 177], "hola")
qauJsGg4cG2iTriPq1N1cfElwYDs3vIATlNwIbFqUM0

iex> D2lvalenceElixir.Auth.D2LSigner.get_hash("hola", "hola")
hj6sobenlkIElwSJKch0LgaPYU-fP3vlScIoWz-pN6U