Module: RbNaCl::Sodium::Version

Extended by:
RbNaCl::Sodium
Defined in:
lib/rbnacl/sodium/version.rb

Overview

libsodium version API

Constant Summary collapse

MINIMUM_LIBSODIUM_VERSION =
[0, 4, 3].freeze
MINIMUM_LIBSODIUM_VERSION_FOR_ARGON2 =
[1, 0, 9].freeze
MINIMUM_LIBSODIUM_VERSION_FOR_ARGON2ID =
[1, 0, 13].freeze
STRING =
sodium_version_string
INSTALLED_VERSION =
[MAJOR, MINOR, PATCH].freeze
ARGON2_SUPPORTED =
(INSTALLED_VERSION <=> MINIMUM_LIBSODIUM_VERSION_FOR_ARGON2) != -1
ARGON2ID_SUPPORTED =
(INSTALLED_VERSION <=> MINIMUM_LIBSODIUM_VERSION_FOR_ARGON2ID) != -1

Class Method Summary collapse

Methods included from RbNaCl::Sodium

primitive, sodium_constant, sodium_function, sodium_function_with_return_code, sodium_primitive, sodium_type

Class Method Details

.supported_version?(version) ⇒ Boolean

Determine if a given feature is supported based on Sodium version

Returns:

  • (Boolean)


31
32
33
# File 'lib/rbnacl/sodium/version.rb', line 31

def self.supported_version?(version)
  Gem::Version.new(sodium_version_string) >= Gem::Version.new(version)
end