Skip to content

Commit 529ae5e

Browse files
committed
Remove every trace of rbnacl
1 parent 9621d8c commit 529ae5e

15 files changed

+4
-445
lines changed

.github/workflows/test.yml

+1-8
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ jobs:
4141
- "3.4"
4242
gemfile:
4343
- gemfiles/standalone.gemfile
44-
- gemfiles/rbnacl.gemfile
45-
- gemfiles/rbnacl_pre_6.gemfile
4644
experimental: [false]
4745
include:
4846
- os: ubuntu-20.04
@@ -64,11 +62,6 @@ jobs:
6462
steps:
6563
- uses: actions/checkout@v4
6664

67-
- name: Install libsodium
68-
run: |
69-
sudo apt-get update -q
70-
sudo apt-get install libsodium-dev -y
71-
7265
- name: Set up Ruby
7366
uses: ruby/setup-ruby@v1
7467
with:
@@ -96,7 +89,7 @@ jobs:
9689
- uses: actions/checkout@v3
9790

9891
- name: Download coverage reports from the test job
99-
uses: actions/download-artifact@v3
92+
uses: actions/download-artifact@v4
10093
with:
10194
name: coverage-reports
10295

Appraisals

-10
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,3 @@ appraise 'openssl' do
88
gem 'openssl', '~> 2.1'
99
remove_gem 'rubocop'
1010
end
11-
12-
appraise 'rbnacl' do
13-
gem 'rbnacl', '>= 6'
14-
remove_gem 'rubocop'
15-
end
16-
17-
appraise 'rbnacl_pre_6' do
18-
gem 'rbnacl', '< 6'
19-
remove_gem 'rubocop'
20-
end

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
**Breaking changes:**
88
- Require token signature to be verified before accessing payload [#648](https://github.com/jwt/ruby-jwt/pull/648) ([@anakinj](https://github.com/anakinj))
99
- Drop support for the HS512256 algorithm [#650](https://github.com/jwt/ruby-jwt/pull/650) ([@anakinj](https://github.com/anakinj))
10+
- Remove dependency to rbnacl [#655](https://github.com/jwt/ruby-jwt/pull/655) ([@anakinj](https://github.com/anakinj))
1011

1112
Take a look at the [upgrade guide](UPGRADING.md) for more details.
1213

gemfiles/rbnacl.gemfile

-7
This file was deleted.

gemfiles/rbnacl_pre_6.gemfile

-7
This file was deleted.

lib/jwt/jwa.rb

-8
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,6 @@
22

33
require 'openssl'
44

5-
begin
6-
require 'rbnacl'
7-
rescue LoadError
8-
raise if defined?(RbNaCl)
9-
end
10-
115
require_relative 'jwa/compat'
126
require_relative 'jwa/signing_algorithm'
137
require_relative 'jwa/ecdsa'
@@ -18,8 +12,6 @@
1812
require_relative 'jwa/unsupported'
1913
require_relative 'jwa/wrapper'
2014

21-
require_relative 'jwa/eddsa' if JWT.rbnacl?
22-
2315
module JWT
2416
# The JWA module contains all supported algorithms.
2517
module JWA

lib/jwt/jwa/eddsa.rb

-35
This file was deleted.

lib/jwt/jwk.rb

-1
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,3 @@ def generate_mappings
5353
require_relative 'jwk/ec'
5454
require_relative 'jwk/rsa'
5555
require_relative 'jwk/hmac'
56-
require_relative 'jwk/okp_rbnacl' if JWT.rbnacl?

lib/jwt/jwk/okp_rbnacl.rb

-109
This file was deleted.

lib/jwt/version.rb

-16
Original file line numberDiff line numberDiff line change
@@ -32,22 +32,6 @@ def self.openssl_3?
3232
true if 3 * 0x10000000 <= OpenSSL::OPENSSL_VERSION_NUMBER
3333
end
3434

35-
# Checks if the RbNaCl library is defined.
36-
#
37-
# @return [Boolean] true if RbNaCl is defined, false otherwise.
38-
# @api private
39-
def self.rbnacl?
40-
defined?(::RbNaCl)
41-
end
42-
43-
# Checks if the RbNaCl library version is 6.0.0 or greater.
44-
#
45-
# @return [Boolean] true if RbNaCl version is 6.0.0 or greater, false otherwise.
46-
# @api private
47-
def self.rbnacl_6_or_greater?
48-
rbnacl? && ::Gem::Version.new(::RbNaCl::VERSION) >= ::Gem::Version.new('6.0.0')
49-
end
50-
5135
# Checks if there is an OpenSSL 3 HMAC empty key regression.
5236
#
5337
# @return [Boolean] true if there is an OpenSSL 3 HMAC empty key regression, false otherwise.

spec/integration/readme_examples_spec.rb

-15
Original file line numberDiff line numberDiff line change
@@ -65,21 +65,6 @@
6565
]
6666
end
6767

68-
if defined?(RbNaCl)
69-
it 'EDDSA' do
70-
eddsa_key = RbNaCl::Signatures::Ed25519::SigningKey.generate
71-
eddsa_public = eddsa_key.verify_key
72-
73-
token = JWT.encode payload, eddsa_key, 'ED25519'
74-
decoded_token = JWT.decode token, eddsa_public, true, algorithm: 'ED25519'
75-
76-
expect(decoded_token).to eq [
77-
{ 'data' => 'test' },
78-
{ 'alg' => 'ED25519' }
79-
]
80-
end
81-
end
82-
8368
if Gem::Version.new(OpenSSL::VERSION) >= Gem::Version.new('2.1')
8469
it 'RSASSA-PSS' do
8570
rsa_private = OpenSSL::PKey::RSA.generate 2048

spec/jwt/jwa/eddsa_spec.rb

-32
This file was deleted.

spec/jwt/jwk/decode_with_jwk_spec.rb

-17
Original file line numberDiff line numberDiff line change
@@ -162,23 +162,6 @@
162162
)
163163
end
164164
end
165-
166-
if defined?(RbNaCl)
167-
context 'when OKP keys are used' do
168-
before do
169-
skip('Requires the rbnacl gem') unless JWT.rbnacl?
170-
end
171-
172-
let(:keypair) { RbNaCl::Signatures::Ed25519::SigningKey.new(SecureRandom.hex) }
173-
let(:algorithm) { 'ED25519' }
174-
175-
it 'decodes the token' do
176-
key_loader = ->(_options) { JSON.parse(JSON.generate(public_jwks)) }
177-
payload, _header = described_class.decode(signed_token, nil, true, { algorithms: [algorithm], jwks: key_loader })
178-
expect(payload).to eq(token_payload)
179-
end
180-
end
181-
end
182165
end
183166
end
184167
end

0 commit comments

Comments
 (0)