diff --git a/lib/jwt/eddsa/algo.rb b/lib/jwt/eddsa/algo.rb index 0a857ac..ca64850 100644 --- a/lib/jwt/eddsa/algo.rb +++ b/lib/jwt/eddsa/algo.rb @@ -4,12 +4,12 @@ module JWT module EdDSA # EdDSA algorithm implementation module Algo - include JWT::JWA::Algorithm + include JWT::JWA::SignatureAlgorithm register_algorithm("EdDSA") class << self - def sign(_algorithm, msg, key) + def sign(_alg, msg, key) unless key.is_a?(Ed25519::SigningKey) raise_sign_error!("Key given is a #{key.class} but needs to be a Ed25519::SigningKey") end @@ -17,7 +17,7 @@ def sign(_algorithm, msg, key) key.sign(msg) end - def verify(_algorithm, public_key, signing_input, signature) + def verify(_alg, public_key, signing_input, signature) unless public_key.is_a?(Ed25519::VerifyKey) raise_verify_error!("Key given is a #{public_key.class} but needs to be a Ed25519::VerifyKey") end @@ -26,6 +26,10 @@ def verify(_algorithm, public_key, signing_input, signature) rescue Ed25519::VerifyError false end + + def header(*) + { "alg" => "EdDSA" } + end end end end