Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support alternate casing "Ed25519" (lowercase "d") #406

Closed
wants to merge 2 commits into from
Closed
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
2 changes: 1 addition & 1 deletion lib/jwt/algos/eddsa.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module Algos
module Eddsa
module_function

SUPPORTED = %w[ED25519].freeze
SUPPORTED = %w[Ed25519 ED25519].freeze

def sign(to_sign)
algorithm, msg, key = to_sign.values
Expand Down
4 changes: 3 additions & 1 deletion spec/jwt_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@

if defined?(RbNaCl)
data.merge!(
'Ed25519_private' => RbNaCl::Signatures::Ed25519::SigningKey.new('abcdefghijklmnopqrstuvwxyzABCDEF'),
'Ed25519_public' => RbNaCl::Signatures::Ed25519::SigningKey.new('abcdefghijklmnopqrstuvwxyzABCDEF').verify_key,
'ED25519_private' => RbNaCl::Signatures::Ed25519::SigningKey.new('abcdefghijklmnopqrstuvwxyzABCDEF'),
'ED25519_public' => RbNaCl::Signatures::Ed25519::SigningKey.new('abcdefghijklmnopqrstuvwxyzABCDEF').verify_key,
)
Expand Down Expand Up @@ -190,7 +192,7 @@
end

if defined?(RbNaCl)
%w[ED25519].each do |alg|
%w[Ed25519 ED25519].each do |alg|
context "alg: #{alg}" do
before(:each) do
data[alg] = JWT.encode payload, data["#{alg}_private"], alg
Expand Down