forked from jwt/ruby-jwt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathversion.rb
50 lines (43 loc) · 1.27 KB
/
version.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# frozen_string_literal: true
# JSON Web Token implementation
#
# Should be up to date with the latest spec:
# https://tools.ietf.org/html/rfc7519
module JWT
# Returns the gem version of the JWT library.
#
# @return [Gem::Version] the gem version.
def self.gem_version
Gem::Version.new(VERSION::STRING)
end
# Version constants
module VERSION
MAJOR = 3
MINOR = 0
TINY = 0
PRE = 'beta1'
STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
end
# Checks if the OpenSSL version is 3 or greater.
#
# @return [Boolean] true if OpenSSL version is 3 or greater, false otherwise.
# @api private
def self.openssl_3?
return false if OpenSSL::OPENSSL_VERSION.include?('LibreSSL')
true if 3 * 0x10000000 <= OpenSSL::OPENSSL_VERSION_NUMBER
end
# Checks if there is an OpenSSL 3 HMAC empty key regression.
#
# @return [Boolean] true if there is an OpenSSL 3 HMAC empty key regression, false otherwise.
# @api private
def self.openssl_3_hmac_empty_key_regression?
openssl_3? && openssl_version <= ::Gem::Version.new('3.0.0')
end
# Returns the OpenSSL version.
#
# @return [Gem::Version] the OpenSSL version.
# @api private
def self.openssl_version
@openssl_version ||= ::Gem::Version.new(OpenSSL::VERSION)
end
end