Skip to content

Commit

Permalink
Respond to comments
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnyshields authored and anakinj committed Feb 9, 2021
1 parent b3f5d83 commit ebd3fc9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions lib/jwt/algos.rb
Expand Up @@ -32,9 +32,8 @@ def find(algorithm)

def indexed
@indexed ||= begin
algos = ALGOS.dup
fallback = [algos.pop, nil]
algos.each_with_object(Hash.new(fallback)) do |alg, hash|
fallback = [Algos::Unsupported, nil]
ALGOS.each_with_object(Hash.new(fallback)) do |alg, hash|
alg.const_get(:SUPPORTED).each do |code|
hash[code.downcase] = [alg, code]
end
Expand Down
4 changes: 2 additions & 2 deletions spec/jwt_spec.rb
Expand Up @@ -518,8 +518,8 @@
enc = JWT.encode(payload, '', 'hs256')
expect(JWT.decode(enc, '')).to eq([payload, { 'alg' => 'HS256'}])

enc = JWT.encode(payload, data[:rsa_private], 'ps384')
expect(JWT.decode(enc, data[:rsa_public], true, algorithm: 'PS384')).to eq([payload, { 'alg' => 'PS384'}])
enc = JWT.encode(payload, data[:rsa_private], 'rs512')
expect(JWT.decode(enc, data[:rsa_public], true, algorithm: 'RS512')).to eq([payload, { 'alg' => 'RS512'}])

enc = JWT.encode(payload, data[:rsa_private], 'RS512')
expect(JWT.decode(enc, data[:rsa_public], true, algorithm: 'rs512')).to eq([payload, { 'alg' => 'RS512'}])
Expand Down

0 comments on commit ebd3fc9

Please sign in to comment.