Skip to content

Commit

Permalink
Deprecation warnings for Rbnacl backed functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
anakinj committed Dec 25, 2024
1 parent b006395 commit 7d0f617
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
- Improved documentation for public apis [#629](https://github.com/jwt/ruby-jwt/pull/629) ([@anakinj](https://github.com/anakinj))
- Use correct methods when raising error during signing/verification with EdDSA [#633](https://github.com/jwt/ruby-jwt/pull/633)
- Fix JWT::EncodedToken behavior with empty string as token [#640](https://github.com/jwt/ruby-jwt/pull/640) ([@ragalie](https://github.com/ragalie))
- Deprecation warnings for rbnacl backed functionality [#641](https://github.com/jwt/ruby-jwt/pull/641) ([@anakinj](https://github.com/anakinj))
- Your contribution here

## [v2.9.3](https://github.com/jwt/ruby-jwt/tree/v2.9.3) (2024-10-03)
Expand Down
4 changes: 4 additions & 0 deletions lib/jwt/jwa/eddsa.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,16 @@ def initialize(alg)
def sign(data:, signing_key:)
raise_sign_error!("Key given is a #{signing_key.class} but has to be an RbNaCl::Signatures::Ed25519::SigningKey") unless signing_key.is_a?(RbNaCl::Signatures::Ed25519::SigningKey)

Deprecations.warning('Using Ed25519 keys is deprecated and will be removed in a future version of ruby-jwt. Please use the ruby-eddsa gem instead.')

signing_key.sign(data)
end

def verify(data:, signature:, verification_key:)
raise_verify_error!("key given is a #{verification_key.class} but has to be a RbNaCl::Signatures::Ed25519::VerifyKey") unless verification_key.is_a?(RbNaCl::Signatures::Ed25519::VerifyKey)

Deprecations.warning('Using Ed25519 keys is deprecated and will be removed in a future version of ruby-jwt. Please use the ruby-eddsa gem instead.')

verification_key.verify(signature, data)
rescue RbNaCl::CryptoError
false
Expand Down
2 changes: 1 addition & 1 deletion lib/jwt/jwk/okp_rbnacl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class OKPRbNaCl < KeyBase

def initialize(key, params = nil, options = {})
params ||= {}

Deprecations.warning('Using the OKP JWK for Ed25519 keys is deprecated and will be removed in a future version of ruby-jwt. Please use the ruby-eddsa gem instead.')
# For backwards compatibility when kid was a String
params = { kid: params } if params.is_a?(String)

Expand Down

0 comments on commit 7d0f617

Please sign in to comment.