tuweni / org.apache.tuweni.crypto.sodium / Sodium

Sodium

class Sodium (source)

Access to the sodium native library.

This class provides static methods for checking or loading the sodium native library.

Functions

isAvailable

static fun isAvailable(): Boolean

Check if the sodium library is available.

If the sodium library has not already been loaded, this will attempt to load and initialize it before returning.

loadLibrary

static fun loadLibrary(path: Path): Unit

Load and initialize the native libsodium shared library.

If this method returns successfully (without throwing a LinkageError), then all future calls to methods provided by this class will use the loaded library.

minSupportedVersion

static fun minSupportedVersion(): SodiumVersion

The minimum version of the sodium native library that this binding supports.

searchLibrary

static fun searchLibrary(vararg paths: Path): Unit

Search for, then load and initialize the native libsodium shared library.

The library will be searched for in all the provided locations, using the library name "sodium". If this method returns successfully (without throwing a LinkageError), then all future calls to methods provided by this class will use the loaded library.

static fun searchLibrary(libraryName: String, vararg paths: Path): Unit

Search for, then load and initialize the native libsodium shared library.

The library will be searched for in all the provided locations, using the provided library name. If this method returns successfully (without throwing a LinkageError), then all future calls to methods provided by this class will use the loaded library.

supportsVersion

static fun supportsVersion(requiredVersion: SodiumVersion): Boolean

Check if the loaded sodium native library is the same or later than the specified version.

version

static fun version(): SodiumVersion

The version of the loaded sodium native library.