Package org.jivesoftware.smackx.omemo
Class OmemoConfiguration
- java.lang.Object
-
- org.jivesoftware.smackx.omemo.OmemoConfiguration
-
public final class OmemoConfiguration extends java.lang.Object
Contains OMEMO related configuration options.
-
-
Constructor Summary
Constructors Constructor Description OmemoConfiguration()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleangetAddOmemoHintBody()Determine, whether an OMEMO message should carry a plaintext hint about OMEMO encryption.static booleangetCompleteSessionWithEmptyMessage()Determine, whether incoming preKeyMessages should automatically be answered by an empty message in order to complete the session.static booleangetDeleteStaleDevices()static intgetDeleteStaleDevicesAfterHours()static booleangetIgnoreReadOnlyDevices()Return true, if the client should stop encrypting messages to a read-only device.static intgetMaxNumberOfStoredSignedPreKeys()Return the maximum number of signed preKeys that are cached until the oldest one gets deleted.static intgetMaxReadOnlyMessageCount()Get the maximum amount of messages that the client is allowed to send to a read-only device without getting a response.static booleangetRenewOldSignedPreKeys()Determine, whether signed preKeys are automatically rotated or not.static intgetRenewOldSignedPreKeysAfterHours()Get the interval in hours, after which the published signed preKey should be renewed.static booleangetRepairBrokenSessionsWithPreKeyMessages()Determine, whether incoming messages, which have broken sessions should automatically be answered by an empty preKeyMessage in order to establish a new session.static voidsetAddOmemoHintBody(boolean addHint)Decide, whether an OMEMO message should carry a plaintext hint about OMEMO encryption.static voidsetCompleteSessionWithEmptyMessage(boolean complete)Decide, whether incoming preKeyMessages should automatically be answered by an empty message in order to complete the session.static voidsetDeleteStaleDevices(boolean delete)static voidsetDeleteStaleDevicesAfterHours(int hours)static voidsetIgnoreReadOnlyDevices(boolean ignore)Set to true, in order to ignore read-only devices.static voidsetMaxNumberOfStoredSignedPreKeys(int number)Set the maximum number of signed preKeys that are cached until the oldest one gets deleted.static voidsetMaxReadOnlyMessageCount(int maxReadOnlyMessageCount)Set the maximum amount of messages that the client is allowed to send to a read-only device without getting a response.static voidsetRenewOldSignedPreKeys(boolean renew)Decide, whether signed preKeys are automatically rotated or not.static voidsetRenewOldSignedPreKeysAfterHours(int hours)Set the interval in hours, after which the published signed preKey should be renewed.static voidsetRepairBrokenSessionsWithPrekeyMessages(boolean repair)Decide, whether incoming messages, which have broken sessions should automatically be answered by an empty preKeyMessage in order to establish a new session.
-
-
-
Constructor Detail
-
OmemoConfiguration
public OmemoConfiguration()
-
-
Method Detail
-
setIgnoreReadOnlyDevices
public static void setIgnoreReadOnlyDevices(boolean ignore)
Set to true, in order to ignore read-only devices.- Parameters:
ignore- ignore read-only devices- See Also:
- Blog Post explaining the danger of read-only devices.
-
getIgnoreReadOnlyDevices
public static boolean getIgnoreReadOnlyDevices()
Return true, if the client should stop encrypting messages to a read-only device.- Returns:
- true if read-only devices should get ignored after a certain amount of unanswered messages.
- See Also:
- Blog Post explaining the danger of read-only devices.
-
setMaxReadOnlyMessageCount
public static void setMaxReadOnlyMessageCount(int maxReadOnlyMessageCount)
Set the maximum amount of messages that the client is allowed to send to a read-only device without getting a response. Once the message counter of a device reaches that value, the client will stop encrypting messages for the device (given thatgetIgnoreReadOnlyDevices()is true). This threshold is used to prevent read-only devices from weakening forward secrecy.- Parameters:
maxReadOnlyMessageCount- maximum number of allowed messages to a read-only device.- See Also:
- Blog Post explaining the danger of read-only devices.
-
getMaxReadOnlyMessageCount
public static int getMaxReadOnlyMessageCount()
Get the maximum amount of messages that the client is allowed to send to a read-only device without getting a response. Once the message counter of a device reaches that value, the client will stop encrypting messages for the device (given thatgetIgnoreReadOnlyDevices()is true). This threshold is used to prevent read-only devices from weakening forward secrecy.- Returns:
- maximum number of allowed messages to a read-only device.
- See Also:
- Blog Post explaining the danger of read-only devices.
-
setDeleteStaleDevices
public static void setDeleteStaleDevices(boolean delete)
-
getDeleteStaleDevices
public static boolean getDeleteStaleDevices()
-
setDeleteStaleDevicesAfterHours
public static void setDeleteStaleDevicesAfterHours(int hours)
-
getDeleteStaleDevicesAfterHours
public static int getDeleteStaleDevicesAfterHours()
-
setRenewOldSignedPreKeys
public static void setRenewOldSignedPreKeys(boolean renew)
Decide, whether signed preKeys are automatically rotated or not. It is highly recommended to rotate signed preKeys to preserve forward secrecy.- Parameters:
renew- automatically rotate signed preKeys?
-
getRenewOldSignedPreKeys
public static boolean getRenewOldSignedPreKeys()
Determine, whether signed preKeys are automatically rotated or not.- Returns:
- auto-rotate signed preKeys?
-
setRenewOldSignedPreKeysAfterHours
public static void setRenewOldSignedPreKeysAfterHours(int hours)
Set the interval in hours, after which the published signed preKey should be renewed. This value should be between one or two weeks.- Parameters:
hours- hours after which signed preKeys should be rotated.
-
getRenewOldSignedPreKeysAfterHours
public static int getRenewOldSignedPreKeysAfterHours()
Get the interval in hours, after which the published signed preKey should be renewed. This value should be between one or two weeks.- Returns:
- hours after which signed preKeys should be rotated.
-
setMaxNumberOfStoredSignedPreKeys
public static void setMaxNumberOfStoredSignedPreKeys(int number)
Set the maximum number of signed preKeys that are cached until the oldest one gets deleted. This number should not be too small in order to prevent message loss, but also not too big to preserve forward secrecy.- Parameters:
number- number of cached signed preKeys.
-
getMaxNumberOfStoredSignedPreKeys
public static int getMaxNumberOfStoredSignedPreKeys()
Return the maximum number of signed preKeys that are cached until the oldest one gets deleted.- Returns:
- max number of cached signed preKeys.
-
setAddOmemoHintBody
public static void setAddOmemoHintBody(boolean addHint)
Decide, whether an OMEMO message should carry a plaintext hint about OMEMO encryption. Eg. "I sent you an OMEMO encrypted message..."- Parameters:
addHint- shall we add a hint?
-
getAddOmemoHintBody
public static boolean getAddOmemoHintBody()
Determine, whether an OMEMO message should carry a plaintext hint about OMEMO encryption.- Returns:
- true, if a hint is added to the message.
-
getRepairBrokenSessionsWithPreKeyMessages
public static boolean getRepairBrokenSessionsWithPreKeyMessages()
Determine, whether incoming messages, which have broken sessions should automatically be answered by an empty preKeyMessage in order to establish a new session.- Returns:
- true if session should be repaired automatically.
-
setRepairBrokenSessionsWithPrekeyMessages
public static void setRepairBrokenSessionsWithPrekeyMessages(boolean repair)
Decide, whether incoming messages, which have broken sessions should automatically be answered by an empty preKeyMessage in order to establish a new session.- Parameters:
repair- repair sessions?
-
getCompleteSessionWithEmptyMessage
public static boolean getCompleteSessionWithEmptyMessage()
Determine, whether incoming preKeyMessages should automatically be answered by an empty message in order to complete the session.- Returns:
- true if sessions should be completed.
-
setCompleteSessionWithEmptyMessage
public static void setCompleteSessionWithEmptyMessage(boolean complete)
Decide, whether incoming preKeyMessages should automatically be answered by an empty message in order to complete the session.- Parameters:
complete- complete the session or not
-
-