Skip to content

Commit 982ecf3

Browse files
authored
feat: Support the ED25519 reference when pointing to the algorithm (#12)
* Backwards compatibility * try action on ubuntu-22.04 * What about ubuntu-20.04 * Back to ubuntu-latest
1 parent daaa740 commit 982ecf3

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

lib/jwt/eddsa/algo.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ module Algo
77
include JWT::JWA::SignatureAlgorithm
88

99
register_algorithm("EdDSA")
10+
register_algorithm("ED25519")
1011

1112
class << self
1213
def sign(_alg, msg, key)

spec/integration_spec.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@
1717
end
1818
end
1919

20+
context "when encoding with ED25519" do
21+
it "executes successfully" do
22+
token = JWT.encode(payload, private_key, "ED25519")
23+
expect(JWT.decode(token, public_key, true, algorithm: "EdDSA"))
24+
.to eq([payload, { "alg" => "EdDSA" }])
25+
end
26+
end
27+
2028
context "when decoding key is wrong" do
2129
let(:public_key) { Ed25519::SigningKey.new("a" * 32).verify_key }
2230
it "raises decoding error" do

0 commit comments

Comments
 (0)