diff --git a/lib/jwt/eddsa/algo.rb b/lib/jwt/eddsa/algo.rb index ca64850..35a6393 100644 --- a/lib/jwt/eddsa/algo.rb +++ b/lib/jwt/eddsa/algo.rb @@ -7,6 +7,7 @@ module Algo include JWT::JWA::SignatureAlgorithm register_algorithm("EdDSA") + register_algorithm("ED25519") class << self def sign(_alg, msg, key) diff --git a/spec/integration_spec.rb b/spec/integration_spec.rb index 2906f97..8801534 100644 --- a/spec/integration_spec.rb +++ b/spec/integration_spec.rb @@ -17,6 +17,14 @@ end end + context "when encoding with ED25519" do + it "executes successfully" do + token = JWT.encode(payload, private_key, "ED25519") + expect(JWT.decode(token, public_key, true, algorithm: "EdDSA")) + .to eq([payload, { "alg" => "EdDSA" }]) + end + end + context "when decoding key is wrong" do let(:public_key) { Ed25519::SigningKey.new("a" * 32).verify_key } it "raises decoding error" do