ex_crypto
ex_crypto copied to clipboard
Return errors from decode_payload
Making the return type compatible with the method's typespec, also stopping exceptions from raising when base64
decoding fails or in case the decoded payload is too small.
Preventing smaller input to pass too:
iex(5)> payload = Base.url_encode64("AAAAAAAAAAAAAAAA") |> ExCrypto.decode_payload
{:ok, {"AAAAAAAAAAAAAAAA", "AAAAAAAAAAAAAAAA", "AAAAAAAAAAAAAAAA"}}
Before this change we need to try-rescue
every time decode_payload
is called with arbitrary data as argument.
@KiKoS0 test? :)