Library accepts push connection certificate as argument.
parent
ff5ad4b85d
commit
1ab4e7e9de
@ -1,5 +0,0 @@
|
||||
Thank you for helping us test this BETA vesion of TextSecure.
|
||||
|
||||
This is BETA software, please do not use it in situations where security is critical.
|
||||
|
||||
Please report any problems at https://github.com/WhisperSystems/TextSecure/issues
|
@ -0,0 +1,22 @@
|
||||
package org.thoughtcrime.securesms.push;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import org.thoughtcrime.securesms.Release;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.whispersystems.textsecure.push.PushServiceSocket;
|
||||
|
||||
public class PushServiceSocketFactory {
|
||||
|
||||
public static PushServiceSocket create(Context context, String number, String password) {
|
||||
return new PushServiceSocket(context, Release.PUSH_URL, new TextSecurePushTrustStore(context),
|
||||
number, password);
|
||||
}
|
||||
|
||||
public static PushServiceSocket create(Context context) {
|
||||
return create(context,
|
||||
TextSecurePreferences.getLocalNumber(context),
|
||||
TextSecurePreferences.getPushServerPassword(context));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package org.thoughtcrime.securesms.push;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.whispersystems.textsecure.push.PushServiceSocket;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
public class TextSecurePushTrustStore implements PushServiceSocket.TrustStore {
|
||||
|
||||
private final Context context;
|
||||
|
||||
public TextSecurePushTrustStore(Context context) {
|
||||
this.context = context.getApplicationContext();
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream getKeyStoreInputStream() {
|
||||
return context.getResources().openRawResource(R.raw.whisper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getKeyStorePassword() {
|
||||
return "whisper";
|
||||
}
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
package org.thoughtcrime.securesms.util;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import org.whispersystems.textsecure.push.PushServiceSocket;
|
||||
|
||||
public class TextSecurePushCredentials implements PushServiceSocket.PushCredentials {
|
||||
|
||||
private static final TextSecurePushCredentials instance = new TextSecurePushCredentials();
|
||||
|
||||
public static TextSecurePushCredentials getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLocalNumber(Context context) {
|
||||
return TextSecurePreferences.getLocalNumber(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPassword(Context context) {
|
||||
return TextSecurePreferences.getPushServerPassword(context);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue