mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-03 15:05:24 +00:00
Abstract out TrustStore interface.
// FREEBIE
This commit is contained in:
parent
cbebc040cc
commit
9215322846
@ -21,6 +21,7 @@ import org.whispersystems.libaxolotl.state.PreKeyRecord;
|
||||
import org.whispersystems.libaxolotl.state.SignedPreKeyRecord;
|
||||
import org.whispersystems.libaxolotl.util.guava.Optional;
|
||||
import org.whispersystems.textsecure.api.push.ContactTokenDetails;
|
||||
import org.whispersystems.textsecure.api.push.TrustStore;
|
||||
import org.whispersystems.textsecure.internal.push.PushServiceSocket;
|
||||
import org.whispersystems.textsecure.api.push.SignedPreKeyEntity;
|
||||
|
||||
@ -32,7 +33,7 @@ public class TextSecureAccountManager {
|
||||
|
||||
private final PushServiceSocket pushServiceSocket;
|
||||
|
||||
public TextSecureAccountManager(String url, PushServiceSocket.TrustStore trustStore,
|
||||
public TextSecureAccountManager(String url, TrustStore trustStore,
|
||||
String user, String password)
|
||||
{
|
||||
this.pushServiceSocket = new PushServiceSocket(url, trustStore, user, password);
|
||||
|
@ -19,6 +19,7 @@ package org.whispersystems.textsecure.api;
|
||||
import org.whispersystems.libaxolotl.InvalidMessageException;
|
||||
import org.whispersystems.textsecure.api.crypto.AttachmentCipherInputStream;
|
||||
import org.whispersystems.textsecure.api.messages.TextSecureAttachmentPointer;
|
||||
import org.whispersystems.textsecure.api.push.TrustStore;
|
||||
import org.whispersystems.textsecure.internal.push.PushServiceSocket;
|
||||
|
||||
import java.io.File;
|
||||
@ -29,7 +30,7 @@ public class TextSecureMessageReceiver {
|
||||
|
||||
private final PushServiceSocket socket;
|
||||
|
||||
public TextSecureMessageReceiver(String url, PushServiceSocket.TrustStore trustStore,
|
||||
public TextSecureMessageReceiver(String url, TrustStore trustStore,
|
||||
String user, String password)
|
||||
{
|
||||
this.socket = new PushServiceSocket(url, trustStore, user, password);
|
||||
|
@ -33,6 +33,7 @@ import org.whispersystems.textsecure.api.messages.TextSecureAttachmentStream;
|
||||
import org.whispersystems.textsecure.api.messages.TextSecureGroup;
|
||||
import org.whispersystems.textsecure.api.messages.TextSecureMessage;
|
||||
import org.whispersystems.textsecure.api.push.PushAddress;
|
||||
import org.whispersystems.textsecure.api.push.TrustStore;
|
||||
import org.whispersystems.textsecure.internal.push.MismatchedDevices;
|
||||
import org.whispersystems.textsecure.internal.push.OutgoingPushMessage;
|
||||
import org.whispersystems.textsecure.internal.push.OutgoingPushMessageList;
|
||||
@ -63,7 +64,7 @@ public class TextSecureMessageSender {
|
||||
private final AxolotlStore store;
|
||||
private final Optional<EventListener> eventListener;
|
||||
|
||||
public TextSecureMessageSender(String url, PushServiceSocket.TrustStore trustStore,
|
||||
public TextSecureMessageSender(String url, TrustStore trustStore,
|
||||
String user, String password, AxolotlStore store,
|
||||
Optional<EventListener> eventListener)
|
||||
{
|
||||
|
@ -0,0 +1,9 @@
|
||||
package org.whispersystems.textsecure.api.push;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
public interface TrustStore {
|
||||
public InputStream getKeyStoreInputStream();
|
||||
public String getKeyStorePassword();
|
||||
}
|
||||
|
@ -31,6 +31,7 @@ import org.whispersystems.textsecure.api.push.PushAddress;
|
||||
import org.whispersystems.textsecure.api.crypto.AttachmentCipherOutputStream;
|
||||
import org.whispersystems.textsecure.api.push.ContactTokenDetails;
|
||||
import org.whispersystems.textsecure.api.push.SignedPreKeyEntity;
|
||||
import org.whispersystems.textsecure.api.push.TrustStore;
|
||||
import org.whispersystems.textsecure.api.push.exceptions.UnregisteredUserException;
|
||||
import org.whispersystems.textsecure.internal.push.exceptions.MismatchedDevicesException;
|
||||
import org.whispersystems.textsecure.internal.push.exceptions.StaleDevicesException;
|
||||
@ -559,9 +560,4 @@ public class PushServiceSocket {
|
||||
return location;
|
||||
}
|
||||
}
|
||||
|
||||
public interface TrustStore {
|
||||
public InputStream getKeyStoreInputStream();
|
||||
public String getKeyStorePassword();
|
||||
}
|
||||
}
|
||||
|
@ -3,11 +3,12 @@ package org.thoughtcrime.securesms.push;
|
||||
import android.content.Context;
|
||||
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.whispersystems.textsecure.api.push.TrustStore;
|
||||
import org.whispersystems.textsecure.internal.push.PushServiceSocket;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
public class TextSecurePushTrustStore implements PushServiceSocket.TrustStore {
|
||||
public class TextSecurePushTrustStore implements TrustStore {
|
||||
|
||||
private final Context context;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user