Enum Class OlmSessionVersion

java.lang.Object
java.lang.Enum<OlmSessionVersion>
io.github.fherbreteau.vodozemac.olm.OlmSessionVersion
All Implemented Interfaces:
SessionVersion, Serializable, Comparable<OlmSessionVersion>, Constable

public enum OlmSessionVersion extends Enum<OlmSessionVersion> implements SessionVersion
Represents the version of the Olm session protocol to use.

The session version determines the cryptographic configuration used for encryption and MAC operations.

Author:
François HERBRETEAU
  • Enum Constant Details

    • V1

      public static final OlmSessionVersion V1
      Version 1 — uses truncated MAC, compatible with the original libolm.
    • V2

      public static final OlmSessionVersion V2
      Version 2 — uses full-length MAC for stronger integrity protection.
  • Method Details

    • values

      public static OlmSessionVersion[] 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

      public static OlmSessionVersion valueOf(String name)
      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 name
      NullPointerException - if the argument is null
    • value

      public int value()
      Returns the numeric value of this session version.
      Specified by:
      value in interface SessionVersion
      Returns:
      the version number (1 for V1, 2 for V2)
    • defaultVersion

      public static OlmSessionVersion defaultVersion()
      Returns the default Olm session version.
      Returns:
      V1
    • fromVersion

      public static OlmSessionVersion fromVersion(int version)
      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:
      ConversionException - if no version matches the given value