mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-27 14:32:06 +01:00
Remove unused code, rafactor
This commit is contained in:
parent
28cabf00ee
commit
1cbc112c88
10 changed files with 55 additions and 75 deletions
|
@ -46,10 +46,6 @@ public class SignalFileBasedOmemoStore
|
||||||
SignalProtocolAddress, ECPublicKey, PreKeyBundle, SessionCipher>
|
SignalProtocolAddress, ECPublicKey, PreKeyBundle, SessionCipher>
|
||||||
{
|
{
|
||||||
|
|
||||||
public SignalFileBasedOmemoStore() {
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
public SignalFileBasedOmemoStore(File base) {
|
public SignalFileBasedOmemoStore(File base) {
|
||||||
super(base);
|
super(base);
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,10 +52,6 @@ public abstract class FileBasedOmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigP
|
||||||
private final FileHierarchy hierarchy;
|
private final FileHierarchy hierarchy;
|
||||||
private static final Logger LOGGER = Logger.getLogger(FileBasedOmemoStore.class.getName());
|
private static final Logger LOGGER = Logger.getLogger(FileBasedOmemoStore.class.getName());
|
||||||
|
|
||||||
public FileBasedOmemoStore() {
|
|
||||||
this(OmemoConfiguration.getFileBasedOmemoStoreDefaultPath());
|
|
||||||
}
|
|
||||||
|
|
||||||
public FileBasedOmemoStore(File basePath) {
|
public FileBasedOmemoStore(File basePath) {
|
||||||
super();
|
super();
|
||||||
if (basePath == null) {
|
if (basePath == null) {
|
||||||
|
|
|
@ -16,8 +16,6 @@
|
||||||
*/
|
*/
|
||||||
package org.jivesoftware.smackx.omemo;
|
package org.jivesoftware.smackx.omemo;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains OMEMO related configuration options.
|
* Contains OMEMO related configuration options.
|
||||||
*
|
*
|
||||||
|
@ -33,31 +31,6 @@ public final class OmemoConfiguration {
|
||||||
private static boolean IGNORE_STALE_DEVICES = true;
|
private static boolean IGNORE_STALE_DEVICES = true;
|
||||||
private static int IGNORE_STALE_DEVICE_AFTER_HOURS = 24 * 7; //One week
|
private static int IGNORE_STALE_DEVICE_AFTER_HOURS = 24 * 7; //One week
|
||||||
|
|
||||||
/**
|
|
||||||
* Delete stale devices from the device list after a period of time.
|
|
||||||
*/
|
|
||||||
private static boolean DELETE_STALE_DEVICES = true;
|
|
||||||
private static int DELETE_STALE_DEVICE_AFTER_HOURS = 24 * 7 * 4; //4 weeks
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Upload a new signed prekey in intervals. This improves forward secrecy. Old keys are kept for some more time and
|
|
||||||
* then deleted.
|
|
||||||
*/
|
|
||||||
private static boolean RENEW_OLD_SIGNED_PREKEYS = false;
|
|
||||||
private static int RENEW_OLD_SIGNED_PREKEYS_AFTER_HOURS = 24 * 7; //One week
|
|
||||||
private static int MAX_NUMBER_OF_STORED_SIGNED_PREKEYS = 4;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add a plaintext body hint about omemo encryption to the message.
|
|
||||||
*/
|
|
||||||
private static boolean ADD_OMEMO_HINT_BODY = true;
|
|
||||||
|
|
||||||
private static boolean REPAIR_BROKEN_SESSIONS_WITH_PREKEY_MESSAGES = true;
|
|
||||||
|
|
||||||
private static boolean COMPLETE_SESSION_WITH_EMPTY_MESSAGE = true;
|
|
||||||
|
|
||||||
private static File FILE_BASED_OMEMO_STORE_DEFAULT_PATH = null;
|
|
||||||
|
|
||||||
public static void setIgnoreStaleDevices(boolean ignore) {
|
public static void setIgnoreStaleDevices(boolean ignore) {
|
||||||
IGNORE_STALE_DEVICES = ignore;
|
IGNORE_STALE_DEVICES = ignore;
|
||||||
}
|
}
|
||||||
|
@ -77,6 +50,12 @@ public final class OmemoConfiguration {
|
||||||
return IGNORE_STALE_DEVICE_AFTER_HOURS;
|
return IGNORE_STALE_DEVICE_AFTER_HOURS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete stale devices from the device list after a period of time.
|
||||||
|
*/
|
||||||
|
private static boolean DELETE_STALE_DEVICES = true;
|
||||||
|
private static int DELETE_STALE_DEVICE_AFTER_HOURS = 24 * 7 * 4; //4 weeks
|
||||||
|
|
||||||
public static void setDeleteStaleDevices(boolean delete) {
|
public static void setDeleteStaleDevices(boolean delete) {
|
||||||
DELETE_STALE_DEVICES = delete;
|
DELETE_STALE_DEVICES = delete;
|
||||||
}
|
}
|
||||||
|
@ -96,6 +75,14 @@ public final class OmemoConfiguration {
|
||||||
return DELETE_STALE_DEVICE_AFTER_HOURS;
|
return DELETE_STALE_DEVICE_AFTER_HOURS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Upload a new signed prekey in intervals. This improves forward secrecy. Old keys are kept for some more time and
|
||||||
|
* then deleted.
|
||||||
|
*/
|
||||||
|
private static boolean RENEW_OLD_SIGNED_PREKEYS = false;
|
||||||
|
private static int RENEW_OLD_SIGNED_PREKEYS_AFTER_HOURS = 24 * 7; //One week
|
||||||
|
private static int MAX_NUMBER_OF_STORED_SIGNED_PREKEYS = 4;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Decide, whether signed preKeys are automatically rotated or not.
|
* Decide, whether signed preKeys are automatically rotated or not.
|
||||||
* It is highly recommended to rotate signed preKeys to preserve forward secrecy.
|
* It is highly recommended to rotate signed preKeys to preserve forward secrecy.
|
||||||
|
@ -160,6 +147,11 @@ public final class OmemoConfiguration {
|
||||||
return MAX_NUMBER_OF_STORED_SIGNED_PREKEYS;
|
return MAX_NUMBER_OF_STORED_SIGNED_PREKEYS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a plaintext body hint about omemo encryption to the message.
|
||||||
|
*/
|
||||||
|
private static boolean ADD_OMEMO_HINT_BODY = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Decide, whether an OMEMO message should carry a plaintext hint about OMEMO encryption.
|
* Decide, whether an OMEMO message should carry a plaintext hint about OMEMO encryption.
|
||||||
* Eg. "I sent you an OMEMO encrypted message..."
|
* Eg. "I sent you an OMEMO encrypted message..."
|
||||||
|
@ -179,13 +171,7 @@ public final class OmemoConfiguration {
|
||||||
return ADD_OMEMO_HINT_BODY;
|
return ADD_OMEMO_HINT_BODY;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setFileBasedOmemoStoreDefaultPath(File path) {
|
private static boolean REPAIR_BROKEN_SESSIONS_WITH_PREKEY_MESSAGES = true;
|
||||||
FILE_BASED_OMEMO_STORE_DEFAULT_PATH = path;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static File getFileBasedOmemoStoreDefaultPath() {
|
|
||||||
return FILE_BASED_OMEMO_STORE_DEFAULT_PATH;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine, whether incoming messages, which have broken sessions should automatically be answered by an empty
|
* Determine, whether incoming messages, which have broken sessions should automatically be answered by an empty
|
||||||
|
@ -207,6 +193,8 @@ public final class OmemoConfiguration {
|
||||||
REPAIR_BROKEN_SESSIONS_WITH_PREKEY_MESSAGES = repair;
|
REPAIR_BROKEN_SESSIONS_WITH_PREKEY_MESSAGES = repair;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static boolean COMPLETE_SESSION_WITH_EMPTY_MESSAGE = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine, whether incoming preKeyMessages should automatically be answered by an empty message in order to
|
* Determine, whether incoming preKeyMessages should automatically be answered by an empty message in order to
|
||||||
* complete the session.
|
* complete the session.
|
||||||
|
|
|
@ -67,7 +67,7 @@ import org.jivesoftware.smackx.omemo.internal.OmemoDevice;
|
||||||
import org.jivesoftware.smackx.omemo.listener.OmemoMessageListener;
|
import org.jivesoftware.smackx.omemo.listener.OmemoMessageListener;
|
||||||
import org.jivesoftware.smackx.omemo.listener.OmemoMucMessageListener;
|
import org.jivesoftware.smackx.omemo.listener.OmemoMucMessageListener;
|
||||||
import org.jivesoftware.smackx.omemo.trust.OmemoFingerprint;
|
import org.jivesoftware.smackx.omemo.trust.OmemoFingerprint;
|
||||||
import org.jivesoftware.smackx.omemo.trust.TrustCallback;
|
import org.jivesoftware.smackx.omemo.trust.OmemoTrustCallback;
|
||||||
import org.jivesoftware.smackx.omemo.trust.TrustState;
|
import org.jivesoftware.smackx.omemo.trust.TrustState;
|
||||||
import org.jivesoftware.smackx.pep.PEPListener;
|
import org.jivesoftware.smackx.pep.PEPListener;
|
||||||
import org.jivesoftware.smackx.pep.PEPManager;
|
import org.jivesoftware.smackx.pep.PEPManager;
|
||||||
|
@ -101,7 +101,7 @@ public final class OmemoManager extends Manager {
|
||||||
private final HashSet<OmemoMessageListener> omemoMessageListeners = new HashSet<>();
|
private final HashSet<OmemoMessageListener> omemoMessageListeners = new HashSet<>();
|
||||||
private final HashSet<OmemoMucMessageListener> omemoMucMessageListeners = new HashSet<>();
|
private final HashSet<OmemoMucMessageListener> omemoMucMessageListeners = new HashSet<>();
|
||||||
|
|
||||||
private TrustCallback trustCallback;
|
private OmemoTrustCallback trustCallback;
|
||||||
|
|
||||||
private BareJid ownJid;
|
private BareJid ownJid;
|
||||||
private Integer deviceId;
|
private Integer deviceId;
|
||||||
|
@ -206,7 +206,7 @@ public final class OmemoManager extends Manager {
|
||||||
*
|
*
|
||||||
* @param callback trustCallback.
|
* @param callback trustCallback.
|
||||||
*/
|
*/
|
||||||
public void setTrustCallback(TrustCallback callback) {
|
public void setTrustCallback(OmemoTrustCallback callback) {
|
||||||
if (trustCallback != null) {
|
if (trustCallback != null) {
|
||||||
throw new IllegalStateException("TrustCallback can only be set once.");
|
throw new IllegalStateException("TrustCallback can only be set once.");
|
||||||
}
|
}
|
||||||
|
@ -217,7 +217,7 @@ public final class OmemoManager extends Manager {
|
||||||
* Return the TrustCallback of this manager.
|
* Return the TrustCallback of this manager.
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
TrustCallback getTrustCallback() {
|
OmemoTrustCallback getTrustCallback() {
|
||||||
return trustCallback;
|
return trustCallback;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -266,12 +266,19 @@ public final class OmemoManager extends Manager {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<OmemoDevice> getDevicesOf(BareJid recipient) {
|
/**
|
||||||
OmemoCachedDeviceList list = getOmemoService().getOmemoStoreBackend().loadCachedDeviceList(getOwnDevice(), recipient);
|
* Return a list of all OMEMO capable devices of a contact.
|
||||||
|
* Note, that this method does not explicitly refresh the device list of the contact, so it might be outdated.
|
||||||
|
* @see #requestDeviceListUpdateFor(BareJid)
|
||||||
|
* @param contact contact we want to get a list of device of.
|
||||||
|
* @return list of known devices of that contact.
|
||||||
|
*/
|
||||||
|
public List<OmemoDevice> getDevicesOf(BareJid contact) {
|
||||||
|
OmemoCachedDeviceList list = getOmemoService().getOmemoStoreBackend().loadCachedDeviceList(getOwnDevice(), contact);
|
||||||
ArrayList<OmemoDevice> devices = new ArrayList<>();
|
ArrayList<OmemoDevice> devices = new ArrayList<>();
|
||||||
|
|
||||||
for (int deviceId : list.getActiveDevices()) {
|
for (int deviceId : list.getActiveDevices()) {
|
||||||
devices.add(new OmemoDevice(recipient, deviceId));
|
devices.add(new OmemoDevice(contact, deviceId));
|
||||||
}
|
}
|
||||||
|
|
||||||
return devices;
|
return devices;
|
||||||
|
@ -353,7 +360,7 @@ public final class OmemoManager extends Manager {
|
||||||
SmackException.NotLoggedInException
|
SmackException.NotLoggedInException
|
||||||
{
|
{
|
||||||
synchronized (LOCK) {
|
synchronized (LOCK) {
|
||||||
if (!multiUserChatSupportsOmemo(muc.getRoom())) {
|
if (!multiUserChatSupportsOmemo(muc)) {
|
||||||
throw new NoOmemoSupportException();
|
throw new NoOmemoSupportException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -492,18 +499,19 @@ public final class OmemoManager extends Manager {
|
||||||
* Returns true, if the MUC with the EntityBareJid multiUserChat is non-anonymous and members only (prerequisite
|
* Returns true, if the MUC with the EntityBareJid multiUserChat is non-anonymous and members only (prerequisite
|
||||||
* for OMEMO encryption in MUC).
|
* for OMEMO encryption in MUC).
|
||||||
*
|
*
|
||||||
* @param multiUserChat EntityBareJid of the MUC
|
* @param multiUserChat MUC
|
||||||
* @return true if chat supports OMEMO
|
* @return true if chat supports OMEMO
|
||||||
* @throws XMPPException.XMPPErrorException if
|
* @throws XMPPException.XMPPErrorException if
|
||||||
* @throws SmackException.NotConnectedException something
|
* @throws SmackException.NotConnectedException something
|
||||||
* @throws InterruptedException goes
|
* @throws InterruptedException goes
|
||||||
* @throws SmackException.NoResponseException wrong
|
* @throws SmackException.NoResponseException wrong
|
||||||
*/
|
*/
|
||||||
public boolean multiUserChatSupportsOmemo(EntityBareJid multiUserChat)
|
public boolean multiUserChatSupportsOmemo(MultiUserChat multiUserChat)
|
||||||
throws XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException,
|
throws XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException,
|
||||||
SmackException.NoResponseException
|
SmackException.NoResponseException
|
||||||
{
|
{
|
||||||
RoomInfo roomInfo = MultiUserChatManager.getInstanceFor(connection()).getRoomInfo(multiUserChat);
|
EntityBareJid jid = multiUserChat.getRoom();
|
||||||
|
RoomInfo roomInfo = MultiUserChatManager.getInstanceFor(connection()).getRoomInfo(jid);
|
||||||
return roomInfo.isNonanonymous() && roomInfo.isMembersOnly();
|
return roomInfo.isNonanonymous() && roomInfo.isMembersOnly();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ import org.jivesoftware.smackx.omemo.internal.OmemoDevice;
|
||||||
import org.jivesoftware.smackx.omemo.internal.listener.OmemoCarbonCopyStanzaReceivedListener;
|
import org.jivesoftware.smackx.omemo.internal.listener.OmemoCarbonCopyStanzaReceivedListener;
|
||||||
import org.jivesoftware.smackx.omemo.internal.listener.OmemoMessageStanzaReceivedListener;
|
import org.jivesoftware.smackx.omemo.internal.listener.OmemoMessageStanzaReceivedListener;
|
||||||
import org.jivesoftware.smackx.omemo.trust.OmemoFingerprint;
|
import org.jivesoftware.smackx.omemo.trust.OmemoFingerprint;
|
||||||
import org.jivesoftware.smackx.omemo.trust.TrustCallback;
|
import org.jivesoftware.smackx.omemo.trust.OmemoTrustCallback;
|
||||||
import org.jivesoftware.smackx.omemo.trust.TrustState;
|
import org.jivesoftware.smackx.omemo.trust.TrustState;
|
||||||
import org.jivesoftware.smackx.omemo.util.OmemoConstants;
|
import org.jivesoftware.smackx.omemo.util.OmemoConstants;
|
||||||
import org.jivesoftware.smackx.omemo.util.OmemoMessageBuilder;
|
import org.jivesoftware.smackx.omemo.util.OmemoMessageBuilder;
|
||||||
|
@ -857,7 +857,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
||||||
return devicesWithSessions;
|
return devicesWithSessions;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ArrayList<OmemoDevice> getUndecidedDevices(OmemoDevice userDevice, TrustCallback callback, List<OmemoDevice> devices) {
|
private ArrayList<OmemoDevice> getUndecidedDevices(OmemoDevice userDevice, OmemoTrustCallback callback, List<OmemoDevice> devices) {
|
||||||
ArrayList<OmemoDevice> undecidedDevices = new ArrayList<>();
|
ArrayList<OmemoDevice> undecidedDevices = new ArrayList<>();
|
||||||
|
|
||||||
for (OmemoDevice device : devices) {
|
for (OmemoDevice device : devices) {
|
||||||
|
@ -880,7 +880,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
||||||
return undecidedDevices;
|
return undecidedDevices;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ArrayList<OmemoDevice> getUntrustedDeviced(OmemoDevice userDevice, TrustCallback trustCallback, List<OmemoDevice> devices) {
|
private ArrayList<OmemoDevice> getUntrustedDeviced(OmemoDevice userDevice, OmemoTrustCallback trustCallback, List<OmemoDevice> devices) {
|
||||||
ArrayList<OmemoDevice> untrustedDevices = new ArrayList<>();
|
ArrayList<OmemoDevice> untrustedDevices = new ArrayList<>();
|
||||||
|
|
||||||
for (OmemoDevice device : devices) {
|
for (OmemoDevice device : devices) {
|
||||||
|
@ -1060,7 +1060,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
||||||
* This is only used for insensitive OMEMO messages like RatchetUpdateMessages.
|
* This is only used for insensitive OMEMO messages like RatchetUpdateMessages.
|
||||||
* DO NOT USE THIS FOR ANYTHING ELSE!
|
* DO NOT USE THIS FOR ANYTHING ELSE!
|
||||||
*/
|
*/
|
||||||
private static final TrustCallback gullibleTrustCallback = new TrustCallback() {
|
private static final OmemoTrustCallback gullibleTrustCallback = new OmemoTrustCallback() {
|
||||||
@Override
|
@Override
|
||||||
public TrustState getTrust(OmemoDevice device, OmemoFingerprint fingerprint) {
|
public TrustState getTrust(OmemoDevice device, OmemoFingerprint fingerprint) {
|
||||||
return TrustState.trusted;
|
return TrustState.trusted;
|
||||||
|
|
|
@ -18,7 +18,7 @@ package org.jivesoftware.smackx.omemo.trust;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.omemo.internal.OmemoDevice;
|
import org.jivesoftware.smackx.omemo.internal.OmemoDevice;
|
||||||
|
|
||||||
public interface TrustCallback {
|
public interface OmemoTrustCallback {
|
||||||
|
|
||||||
TrustState getTrust(OmemoDevice device, OmemoFingerprint fingerprint);
|
TrustState getTrust(OmemoDevice device, OmemoFingerprint fingerprint);
|
||||||
|
|
|
@ -17,5 +17,7 @@
|
||||||
package org.jivesoftware.smackx.omemo.trust;
|
package org.jivesoftware.smackx.omemo.trust;
|
||||||
|
|
||||||
public enum TrustState {
|
public enum TrustState {
|
||||||
undecided, untrusted, trusted
|
undecided, // User has yet to decide, whether the identity is trusted or not.
|
||||||
|
untrusted, // User decided NOT to trust this device.
|
||||||
|
trusted // User decided to trust this device.
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ import org.jivesoftware.smackx.omemo.exceptions.UntrustedOmemoIdentityException;
|
||||||
import org.jivesoftware.smackx.omemo.internal.CiphertextTuple;
|
import org.jivesoftware.smackx.omemo.internal.CiphertextTuple;
|
||||||
import org.jivesoftware.smackx.omemo.internal.OmemoDevice;
|
import org.jivesoftware.smackx.omemo.internal.OmemoDevice;
|
||||||
import org.jivesoftware.smackx.omemo.trust.OmemoFingerprint;
|
import org.jivesoftware.smackx.omemo.trust.OmemoFingerprint;
|
||||||
import org.jivesoftware.smackx.omemo.trust.TrustCallback;
|
import org.jivesoftware.smackx.omemo.trust.OmemoTrustCallback;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -72,7 +72,7 @@ public class OmemoMessageBuilder<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_
|
||||||
|
|
||||||
private final OmemoDevice userDevice;
|
private final OmemoDevice userDevice;
|
||||||
private final OmemoRatchet<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_Sess, T_Addr, T_ECPub, T_Bundle, T_Ciph> ratchet;
|
private final OmemoRatchet<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_Sess, T_Addr, T_ECPub, T_Bundle, T_Ciph> ratchet;
|
||||||
private final TrustCallback trustCallback;
|
private final OmemoTrustCallback trustCallback;
|
||||||
|
|
||||||
private byte[] messageKey;
|
private byte[] messageKey;
|
||||||
private final byte[] initializationVector;
|
private final byte[] initializationVector;
|
||||||
|
@ -100,7 +100,7 @@ public class OmemoMessageBuilder<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_
|
||||||
* @throws InvalidAlgorithmParameterException
|
* @throws InvalidAlgorithmParameterException
|
||||||
*/
|
*/
|
||||||
public OmemoMessageBuilder(OmemoDevice userDevice,
|
public OmemoMessageBuilder(OmemoDevice userDevice,
|
||||||
TrustCallback callback,
|
OmemoTrustCallback callback,
|
||||||
OmemoRatchet<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_Sess, T_Addr, T_ECPub, T_Bundle, T_Ciph> ratchet,
|
OmemoRatchet<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_Sess, T_Addr, T_ECPub, T_Bundle, T_Ciph> ratchet,
|
||||||
byte[] aesKey,
|
byte[] aesKey,
|
||||||
byte[] iv,
|
byte[] iv,
|
||||||
|
@ -134,7 +134,7 @@ public class OmemoMessageBuilder<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_
|
||||||
* @throws InvalidAlgorithmParameterException
|
* @throws InvalidAlgorithmParameterException
|
||||||
*/
|
*/
|
||||||
public OmemoMessageBuilder(OmemoDevice userDevice,
|
public OmemoMessageBuilder(OmemoDevice userDevice,
|
||||||
TrustCallback callback,
|
OmemoTrustCallback callback,
|
||||||
OmemoRatchet<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_Sess, T_Addr, T_ECPub, T_Bundle, T_Ciph> ratchet,
|
OmemoRatchet<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_Sess, T_Addr, T_ECPub, T_Bundle, T_Ciph> ratchet,
|
||||||
String message)
|
String message)
|
||||||
throws NoSuchPaddingException, BadPaddingException, InvalidKeyException, NoSuchAlgorithmException, IllegalBlockSizeException,
|
throws NoSuchPaddingException, BadPaddingException, InvalidKeyException, NoSuchAlgorithmException, IllegalBlockSizeException,
|
||||||
|
|
|
@ -18,11 +18,8 @@ package org.jivesoftware.smackx.omemo;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertFalse;
|
import static org.junit.Assert.assertFalse;
|
||||||
import static org.junit.Assert.assertNull;
|
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
@ -34,13 +31,6 @@ public class OmemoConfigurationTest {
|
||||||
@Test
|
@Test
|
||||||
public void omemoConfigurationTest() {
|
public void omemoConfigurationTest() {
|
||||||
@SuppressWarnings("unused") OmemoConfiguration configuration = new OmemoConfiguration();
|
@SuppressWarnings("unused") OmemoConfiguration configuration = new OmemoConfiguration();
|
||||||
// Default Store Path
|
|
||||||
File storePath = new File("test");
|
|
||||||
assertNull("getFileBasedOmemoStoreDefaultPath MUST return null at this point.",
|
|
||||||
OmemoConfiguration.getFileBasedOmemoStoreDefaultPath());
|
|
||||||
OmemoConfiguration.setFileBasedOmemoStoreDefaultPath(storePath);
|
|
||||||
assertEquals("FileBasedOmemoStoreDefaultPath must equal the one we set.", storePath.getAbsolutePath(),
|
|
||||||
OmemoConfiguration.getFileBasedOmemoStoreDefaultPath().getAbsolutePath());
|
|
||||||
|
|
||||||
// Body hint
|
// Body hint
|
||||||
OmemoConfiguration.setAddOmemoHintBody(false);
|
OmemoConfiguration.setAddOmemoHintBody(false);
|
||||||
|
|
|
@ -20,13 +20,13 @@ import java.util.HashMap;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.omemo.internal.OmemoDevice;
|
import org.jivesoftware.smackx.omemo.internal.OmemoDevice;
|
||||||
import org.jivesoftware.smackx.omemo.trust.OmemoFingerprint;
|
import org.jivesoftware.smackx.omemo.trust.OmemoFingerprint;
|
||||||
import org.jivesoftware.smackx.omemo.trust.TrustCallback;
|
import org.jivesoftware.smackx.omemo.trust.OmemoTrustCallback;
|
||||||
import org.jivesoftware.smackx.omemo.trust.TrustState;
|
import org.jivesoftware.smackx.omemo.trust.TrustState;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ephemera Trust Callback used to make trust decisions in tests.
|
* Ephemera Trust Callback used to make trust decisions in tests.
|
||||||
*/
|
*/
|
||||||
public class EphemeralTrustCallback implements TrustCallback {
|
public class EphemeralTrustCallback implements OmemoTrustCallback {
|
||||||
|
|
||||||
private final HashMap<OmemoDevice, HashMap<OmemoFingerprint, TrustState>> trustStates = new HashMap<>();
|
private final HashMap<OmemoDevice, HashMap<OmemoFingerprint, TrustState>> trustStates = new HashMap<>();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue