Skip to content

Commit

Permalink
Abstract out TrustStore interface.
Browse files Browse the repository at this point in the history
// FREEBIE
  • Loading branch information
moxie0 committed Nov 13, 2014
1 parent cbebc04 commit 9215322
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
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;

Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
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;
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
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;
Expand Down Expand Up @@ -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)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package org.whispersystems.textsecure.api.push;

import java.io.InputStream;

public interface TrustStore {
public InputStream getKeyStoreInputStream();
public String getKeyStorePassword();
}

Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
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;
Expand Down Expand Up @@ -559,9 +560,4 @@ public String getLocation() {
return location;
}
}

public interface TrustStore {
public InputStream getKeyStoreInputStream();
public String getKeyStorePassword();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
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;

Expand Down

0 comments on commit 9215322

Please sign in to comment.