Enum Class MegolmSessionVersion
- All Implemented Interfaces:
SessionVersion, Serializable, Comparable<MegolmSessionVersion>, Constable
Represents the version of the Megolm session protocol to use.
The session version determines the cryptographic configuration used for encryption and MAC operations.
- Author:
- François HERBRETEAU
-
Nested Class Summary
Nested classes/interfaces inherited from class Enum
Enum.EnumDesc<E> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionstatic MegolmSessionVersionReturns the default Megolm session version.static MegolmSessionVersionfromVersion(int version) Returns the session version corresponding to the given numeric value.intvalue()Returns the numeric value of this session version.static MegolmSessionVersionReturns the enum constant of this class with the specified name.static MegolmSessionVersion[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
V1
Version 1 — uses truncated MAC, compatible with the original libolm. -
V2
Version 2 — uses full-length MAC for stronger integrity protection.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
value
public int value()Returns the numeric value of this session version.- Specified by:
valuein interfaceSessionVersion- Returns:
- the version number (1 for V1, 2 for V2)
-
defaultVersion
Returns the default Megolm session version.- Returns:
V1
-
fromVersion
Returns the session version corresponding to the given numeric value.- Parameters:
version- the version number (1 for V1, 2 for V2)- Returns:
- the associated session version
- Throws:
VodozemacException- if no version matches the given value
-