Skip to content

Commit

Permalink
Try to get the build green for ruby-2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
anakinj committed Dec 2, 2018
1 parent 7d664b6 commit f2b0d2f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion ruby-jwt.gemspec
Expand Up @@ -30,5 +30,5 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'codacy-coverage'
spec.add_development_dependency 'rbnacl'
# RSASSA-PSS support provided by OpenSSL +2.1
spec.add_development_dependency 'openssl', '~> 2.1'
# spec.add_development_dependency 'openssl', '~> 2.1'
end
24 changes: 13 additions & 11 deletions spec/integration/readme_examples_spec.rb
Expand Up @@ -57,17 +57,19 @@
]
end

it 'RSASSA-PSS' do
rsa_private = OpenSSL::PKey::RSA.generate 2048
rsa_public = rsa_private.public_key

token = JWT.encode payload, rsa_private, 'PS256'
decoded_token = JWT.decode token, rsa_public, true, algorithm: 'PS256'

expect(decoded_token).to eq [
{ 'data' => 'test' },
{ 'alg' => 'PS256' }
]
if RUBY_VERSION >= '2.3' # Older rubies don't support the openssl 2.1 gem
it 'RSASSA-PSS' do
rsa_private = OpenSSL::PKey::RSA.generate 2048
rsa_public = rsa_private.public_key

token = JWT.encode payload, rsa_private, 'PS256'
decoded_token = JWT.decode token, rsa_public, true, algorithm: 'PS256'

expect(decoded_token).to eq [
{ 'data' => 'test' },
{ 'alg' => 'PS256' }
]
end
end
end

Expand Down

0 comments on commit f2b0d2f

Please sign in to comment.