Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/jwt/eddsa/algo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ module Algo
include JWT::JWA::SignatureAlgorithm

register_algorithm("EdDSA")
register_algorithm("ED25519")

class << self
def sign(_alg, msg, key)
Expand Down
8 changes: 8 additions & 0 deletions spec/integration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down