:jwerl not working with OTP 24
If I compile jwerl on Erlang/OTP 24 it gives me:
==> jwerl
Compiling 4 files (.erl)
src/jwerl_hs.erl:7:3: Warning: crypto:hmac/3 is removed; use crypto:mac/4 instead
% 7| crypto:hmac(algo(ShaBits), Key, Data).
% | ^
If I run your example, I get:
iex(1)> jwt = :jwerl.sign([{:name, "bob"}])
** (UndefinedFunctionError) function :crypto.hmac/3 is undefined or private, use crypto:mac/4 instead
(crypto 5.0.1) :crypto.hmac(:sha256, "", "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiYm9iIn0")
(jwerl 1.1.0) src/jwerl.erl:244: :jwerl.signature/3
(jwerl 1.1.0) src/jwerl.erl:182: :jwerl.encode/3
To work with OTP 24 lines 6/7 in jwerl_hs must be changed to
sign(ShaBits, Key, Data) ->
crypto:mac(hmac, algo(ShaBits), Key, Data).
But this may break compatibility with older OTP versions. Since I'm not an experienced Erlang programmer, I cannot do a PR and file it as an issue. Please fix.
Edited by Paul Bayer