ex_crypto icon indicating copy to clipboard operation
ex_crypto copied to clipboard

Return errors from decode_payload

Open KiKoS0 opened this issue 2 years ago • 1 comments

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 avatar May 24 '22 18:05 KiKoS0

@KiKoS0 test? :)

darwin67 avatar Jun 14 '22 01:06 darwin67