Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return errors from decode_payload #45

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

KiKoS0
Copy link

@KiKoS0 KiKoS0 commented May 24, 2022

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.

Making the return type compatible with the method's typespec, also stopping raising exceptions when base64 decoding fails or in case the decoded payload is too small.
@darwin67
Copy link

@KiKoS0 test? :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants