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

Ignore casing of algorithm #405

Merged
merged 13 commits into from
Feb 9, 2021
Prev Previous commit
Revert casing of ED25519
  • Loading branch information
johnnyshields committed Feb 8, 2021
commit 53101a8da17b4b939a31ec3326a03c26ab369365
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].freeze

def sign(to_sign)
algorithm, msg, key = to_sign.values
Expand Down
6 changes: 3 additions & 3 deletions spec/jwt_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +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,
)
end
data
Expand Down Expand Up @@ -190,7 +190,7 @@
end

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