I stumbled upon following condition when malformed token was provided (extra "e" at the beginning).
Output is for 1.11.2 however outcome is the same for 1.11.6.
iex(1)> jwt_token = "eeyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
iex(2)> JOSE.JWT.peek_protected(jwt_string)
** (CaseClauseError) no case clause matching: "9"
(jose 1.11.2) src/base/jose_base64url.erl:222: :jose_base64url.decode!/2
(jose 1.11.2) src/jwt/jose_jwt.erl:162: :jose_jwt.peek_protected/1
(jose 1.11.2) lib/jose/jwt.ex:191: JOSE.JWT.peek_protected/1
iex:2: (file)
Not sure if there's any validation that could be done before trying to peek, though.
My expectations for such scenarios would be an :error return or more descriptive throw (e.g. UndecodableTokenError).
Seems to be similar to #22
I stumbled upon following condition when malformed token was provided (extra "e" at the beginning).
Output is for
1.11.2however outcome is the same for1.11.6.Not sure if there's any validation that could be done before trying to peek, though.
My expectations for such scenarios would be an
:errorreturn or more descriptive throw (e.g.UndecodableTokenError).Seems to be similar to #22