mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-27 12:05:22 +00:00
TextSecure is now SignalService
// FREEBIE
This commit is contained in:
parent
3b8ec792ee
commit
7b589c4300
14
build.gradle
14
build.gradle
@ -72,7 +72,7 @@ dependencies {
|
||||
compile 'org.whispersystems:jobmanager:1.0.2'
|
||||
compile 'org.whispersystems:libpastelog:1.0.7'
|
||||
compile 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
|
||||
compile 'org.whispersystems:textsecure-android:1.8.7'
|
||||
compile 'org.whispersystems:signal-service-android:2.1.1'
|
||||
compile 'com.h6ah4i.android.compat:mulsellistprefcompat:1.0.0'
|
||||
compile 'com.google.zxing:core:3.2.1'
|
||||
|
||||
@ -126,7 +126,7 @@ dependencyVerification {
|
||||
'org.whispersystems:jobmanager:506f679fc2fcf7bb6d10f00f41d6f6ea0abf75c70dc95b913398661ad538a181',
|
||||
'org.whispersystems:libpastelog:bb331d9a98240fc139101128ba836c1edec3c40e000597cdbb29ebf4cbf34d88',
|
||||
'com.amulyakhare:com.amulyakhare.textdrawable:54c92b5fba38cfd316a07e5a30528068f45ce8515a6890f1297df4c401af5dcb',
|
||||
'org.whispersystems:textsecure-android:5aa9fe94799570da35c8ff2faf517924ca602284971c60a5a7208818d6d00df4',
|
||||
'org.whispersystems:signal-service-android:1c89623336505f6511e6f68ea126c85eae7f28f6c72beb6b362e5743bc5e5126',
|
||||
'com.h6ah4i.android.compat:mulsellistprefcompat:47167c5cb796de1a854788e9ff318358e36c8fb88123baaa6e38fb78511dfabe',
|
||||
'com.google.zxing:core:b4d82452e7a6bf6ec2698904b332431717ed8f9a850224f295aec89de80f2259',
|
||||
'com.google.android.gms:play-services-base:ef36e50fa5c0415ed41f74dd399a889efd2fa327c449036e140c7c3786aa0e1f',
|
||||
@ -134,19 +134,19 @@ dependencyVerification {
|
||||
'com.nineoldandroids:library:68025a14e3e7673d6ad2f95e4b46d78d7d068343aa99256b686fe59de1b3163a',
|
||||
'javax.inject:javax.inject:91c77044a50c481636c32d916fd89c9118a72195390452c81065080f957de7ff',
|
||||
'com.madgag.spongycastle:core:8d6240b974b0aca4d3da9c7dd44d42339d8a374358aca5fc98e50a995764511f',
|
||||
'org.whispersystems:textsecure-java:d9e366c2ff9ed208d0fd2dd76e9097604425b2824739e59057b6afef0fd34e3d',
|
||||
'org.whispersystems:axolotl-android:40d3db5004a84749a73f68d2f0d01b2ae35a73c54df96d8c6c6723b96efb6fc0',
|
||||
'org.whispersystems:signal-service-java:48db52056aa3510deb8c4ccd2dfb35033ae115bc4176048820c6dff73290ba6e',
|
||||
'org.whispersystems:signal-protocol-android:d83cb3d15b667fc2543fa18ce80791c72c053e8ac54fc2941f0429a5944ca691',
|
||||
'com.google.android.gms:play-services-basement:e1d29b21e02fd2a63e5a31807415cbb17a59568e27e3254181c01ffae10659bf',
|
||||
'com.googlecode.libphonenumber:libphonenumber:9625de9d2270e9a280ff4e6d9ef3106573fb4828773fd32c9b7614f4e17d2811',
|
||||
'com.google.protobuf:protobuf-java:e0c1c64575c005601725e7c6a02cebf9e1285e888f756b2a1d73ffa8d725cc74',
|
||||
'com.squareup.okhttp:okhttp:89b7f63e2e5b6c410266abc14f50fe52ea8d2d8a57260829e499b1cd9f0e61af',
|
||||
'com.fasterxml.jackson.core:jackson-databind:835097bcdd11f5bc8a08378c70d4c8054dfa4b911691cc2752063c75534d198d',
|
||||
'org.whispersystems:axolotl-java:6daee739b89d8d7101de6d98f77132fee48495c6ea647d880e77def842f999ea',
|
||||
'org.whispersystems:curve25519-android:3c29a4131a69b0d16baaa3d707678deb39602c3a3ffd75805ce7f9db252e5d0d',
|
||||
'org.whispersystems:curve25519-android:d6a3ef3a70622af4c728b7fe5f8fdfc9e6cd39b1d39b2c77e7a2add9d876bc23',
|
||||
'org.whispersystems:signal-protocol-java:d518d52eeb3c44210e0b6c687360848a87afbaee0bdf42e2a8dd9974d54fdb3a',
|
||||
'com.squareup.okio:okio:5e1098bd3fdee4c3347f5ab815b40ba851e4ab1b348c5e49a5b0362f0ce6e978',
|
||||
'com.fasterxml.jackson.core:jackson-annotations:0ca408c24202a7626ec8b861e99d85eca5e38b73311dd6dd12e3e9deecc3fe94',
|
||||
'com.fasterxml.jackson.core:jackson-core:cbf4604784b4de226262845447a1ad3bb38a6728cebe86562e2c5afada8be2c0',
|
||||
'org.whispersystems:curve25519-java:9ccef8f5aba05d9942336f023c589d6278b4f9135bdc34a7bade1f4e7ad65fa3',
|
||||
'org.whispersystems:curve25519-java:08cc3be52723e0fc4148e5e7002d51d6d7e495b2130022237f2d47b90af6ae0b',
|
||||
'com.android.support:support-v4:c62f0d025dafa86f423f48df9185b0d89496adbc5f6a9be5a7c394d84cf91423',
|
||||
]
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ import android.os.Build;
|
||||
import android.os.PowerManager;
|
||||
import android.util.Log;
|
||||
|
||||
import org.whispersystems.libaxolotl.util.guava.Optional;
|
||||
import org.whispersystems.libsignal.util.guava.Optional;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
|
@ -8,8 +8,8 @@ import com.squareup.okhttp.Response;
|
||||
|
||||
import org.thoughtcrime.securesms.util.Base64;
|
||||
import org.thoughtcrime.securesms.util.JsonUtils;
|
||||
import org.whispersystems.libaxolotl.util.guava.Optional;
|
||||
import org.whispersystems.textsecure.api.push.TrustStore;
|
||||
import org.whispersystems.libsignal.util.guava.Optional;
|
||||
import org.whispersystems.signalservice.api.push.TrustStore;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
@ -3,7 +3,7 @@ package org.thoughtcrime.redphone.signaling;
|
||||
import android.content.Context;
|
||||
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.whispersystems.textsecure.api.push.TrustStore;
|
||||
import org.whispersystems.signalservice.api.push.TrustStore;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
|
@ -31,7 +31,7 @@ import org.thoughtcrime.redphone.signaling.signals.ServerSignal;
|
||||
import org.thoughtcrime.redphone.signaling.signals.Signal;
|
||||
import org.thoughtcrime.redphone.util.LineReader;
|
||||
import org.thoughtcrime.securesms.util.JsonUtils;
|
||||
import org.whispersystems.textsecure.api.push.TrustStore;
|
||||
import org.whispersystems.signalservice.api.push.TrustStore;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
@ -19,8 +19,8 @@ package org.thoughtcrime.redphone.signaling.signals;
|
||||
|
||||
//import org.thoughtcrime.redphone.util.PhoneNumberFormatter;
|
||||
|
||||
import org.whispersystems.textsecure.api.util.InvalidNumberException;
|
||||
import org.whispersystems.textsecure.api.util.PhoneNumberFormatter;
|
||||
import org.whispersystems.signalservice.api.util.InvalidNumberException;
|
||||
import org.whispersystems.signalservice.api.util.PhoneNumberFormatter;
|
||||
|
||||
/**
|
||||
* A signal which initiates a call with the specified remote number.
|
||||
|
@ -37,8 +37,8 @@ import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.whispersystems.jobqueue.JobManager;
|
||||
import org.whispersystems.jobqueue.dependencies.DependencyInjector;
|
||||
import org.whispersystems.jobqueue.requirements.NetworkRequirementProvider;
|
||||
import org.whispersystems.libaxolotl.logging.AxolotlLoggerProvider;
|
||||
import org.whispersystems.libaxolotl.util.AndroidAxolotlLogger;
|
||||
import org.whispersystems.libsignal.logging.SignalProtocolLoggerProvider;
|
||||
import org.whispersystems.libsignal.util.AndroidSignalProtocolLogger;
|
||||
|
||||
import dagger.ObjectGraph;
|
||||
|
||||
@ -99,7 +99,7 @@ public class ApplicationContext extends Application implements DependencyInjecto
|
||||
}
|
||||
|
||||
private void initializeLogging() {
|
||||
AxolotlLoggerProvider.setProvider(new AndroidAxolotlLogger());
|
||||
SignalProtocolLoggerProvider.setProvider(new AndroidSignalProtocolLogger());
|
||||
}
|
||||
|
||||
private void initializeJobManager() {
|
||||
|
@ -30,8 +30,8 @@ import org.thoughtcrime.securesms.recipients.RecipientFactory;
|
||||
import org.thoughtcrime.securesms.recipients.Recipients;
|
||||
import org.thoughtcrime.securesms.sms.MessageSender;
|
||||
import org.thoughtcrime.securesms.util.Base64;
|
||||
import org.whispersystems.textsecure.api.messages.TextSecureEnvelope;
|
||||
import org.whispersystems.textsecure.internal.push.TextSecureProtos;
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceEnvelope;
|
||||
import org.whispersystems.signalservice.internal.push.SignalServiceProtos;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@ -161,12 +161,12 @@ public class ConfirmIdentityDialog extends AlertDialog {
|
||||
mismatch.getRecipientId(),
|
||||
mismatch.getIdentityKey());
|
||||
|
||||
TextSecureEnvelope envelope = new TextSecureEnvelope(TextSecureProtos.Envelope.Type.PREKEY_BUNDLE_VALUE,
|
||||
messageRecord.getIndividualRecipient().getNumber(),
|
||||
messageRecord.getRecipientDeviceId(), "",
|
||||
messageRecord.getDateSent(),
|
||||
Base64.decode(messageRecord.getBody().getBody()),
|
||||
null);
|
||||
SignalServiceEnvelope envelope = new SignalServiceEnvelope(SignalServiceProtos.Envelope.Type.PREKEY_BUNDLE_VALUE,
|
||||
messageRecord.getIndividualRecipient().getNumber(),
|
||||
messageRecord.getRecipientDeviceId(), "",
|
||||
messageRecord.getDateSent(),
|
||||
Base64.decode(messageRecord.getBody().getBody()),
|
||||
null);
|
||||
|
||||
long pushId = pushDatabase.insert(envelope);
|
||||
|
||||
|
@ -134,9 +134,9 @@ import org.thoughtcrime.securesms.util.ViewUtil;
|
||||
import org.thoughtcrime.securesms.util.concurrent.AssertedSuccessListener;
|
||||
import org.thoughtcrime.securesms.util.concurrent.ListenableFuture;
|
||||
import org.thoughtcrime.securesms.util.concurrent.SettableFuture;
|
||||
import org.whispersystems.libaxolotl.InvalidMessageException;
|
||||
import org.whispersystems.libaxolotl.util.guava.Optional;
|
||||
import org.whispersystems.textsecure.api.util.InvalidNumberException;
|
||||
import org.whispersystems.libsignal.InvalidMessageException;
|
||||
import org.whispersystems.libsignal.util.guava.Optional;
|
||||
import org.whispersystems.signalservice.api.util.InvalidNumberException;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
@ -148,7 +148,7 @@ import ws.com.google.android.mms.ContentType;
|
||||
|
||||
import static org.thoughtcrime.securesms.TransportOption.Type;
|
||||
import static org.thoughtcrime.securesms.database.GroupDatabase.GroupRecord;
|
||||
import static org.whispersystems.textsecure.internal.push.TextSecureProtos.GroupContext;
|
||||
import static org.whispersystems.signalservice.internal.push.SignalServiceProtos.GroupContext;
|
||||
|
||||
/**
|
||||
* Activity for displaying a message thread, as well as
|
||||
|
@ -67,7 +67,7 @@ import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
import org.thoughtcrime.securesms.util.dualsim.SubscriptionInfoCompat;
|
||||
import org.thoughtcrime.securesms.util.dualsim.SubscriptionManagerCompat;
|
||||
import org.whispersystems.libaxolotl.util.guava.Optional;
|
||||
import org.whispersystems.libsignal.util.guava.Optional;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
@ -72,7 +72,7 @@ import org.thoughtcrime.securesms.recipients.Recipients;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
import org.thoughtcrime.securesms.util.ViewUtil;
|
||||
import org.thoughtcrime.securesms.util.task.SnackbarAsyncTask;
|
||||
import org.whispersystems.libaxolotl.util.guava.Optional;
|
||||
import org.whispersystems.libsignal.util.guava.Optional;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
@ -23,13 +23,13 @@ import org.thoughtcrime.securesms.util.DynamicTheme;
|
||||
import org.thoughtcrime.securesms.util.task.ProgressDialogAsyncTask;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
import org.whispersystems.libaxolotl.IdentityKeyPair;
|
||||
import org.whispersystems.libaxolotl.InvalidKeyException;
|
||||
import org.whispersystems.libaxolotl.ecc.Curve;
|
||||
import org.whispersystems.libaxolotl.ecc.ECPublicKey;
|
||||
import org.whispersystems.textsecure.api.TextSecureAccountManager;
|
||||
import org.whispersystems.textsecure.api.push.exceptions.NotFoundException;
|
||||
import org.whispersystems.textsecure.internal.push.DeviceLimitExceededException;
|
||||
import org.whispersystems.libsignal.IdentityKeyPair;
|
||||
import org.whispersystems.libsignal.InvalidKeyException;
|
||||
import org.whispersystems.libsignal.ecc.Curve;
|
||||
import org.whispersystems.libsignal.ecc.ECPublicKey;
|
||||
import org.whispersystems.signalservice.api.SignalServiceAccountManager;
|
||||
import org.whispersystems.signalservice.api.push.exceptions.NotFoundException;
|
||||
import org.whispersystems.signalservice.internal.push.DeviceLimitExceededException;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@ -143,11 +143,11 @@ public class DeviceActivity extends PassphraseRequiredActionBarActivity
|
||||
@Override
|
||||
protected Integer doInBackground(Void... params) {
|
||||
try {
|
||||
Context context = DeviceActivity.this;
|
||||
TextSecureAccountManager accountManager = TextSecureCommunicationFactory.createManager(context);
|
||||
String verificationCode = accountManager.getNewDeviceVerificationCode();
|
||||
String ephemeralId = uri.getQueryParameter("uuid");
|
||||
String publicKeyEncoded = uri.getQueryParameter("pub_key");
|
||||
Context context = DeviceActivity.this;
|
||||
SignalServiceAccountManager accountManager = TextSecureCommunicationFactory.createManager(context);
|
||||
String verificationCode = accountManager.getNewDeviceVerificationCode();
|
||||
String ephemeralId = uri.getQueryParameter("uuid");
|
||||
String publicKeyEncoded = uri.getQueryParameter("pub_key");
|
||||
|
||||
if (TextUtils.isEmpty(ephemeralId) || TextUtils.isEmpty(publicKeyEncoded)) {
|
||||
Log.w(TAG, "UUID or Key is empty!");
|
||||
|
@ -25,8 +25,8 @@ import org.thoughtcrime.securesms.dependencies.InjectableType;
|
||||
import org.thoughtcrime.securesms.util.task.ProgressDialogAsyncTask;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.thoughtcrime.securesms.util.ViewUtil;
|
||||
import org.whispersystems.textsecure.api.TextSecureAccountManager;
|
||||
import org.whispersystems.textsecure.api.messages.multidevice.DeviceInfo;
|
||||
import org.whispersystems.signalservice.api.SignalServiceAccountManager;
|
||||
import org.whispersystems.signalservice.api.messages.multidevice.DeviceInfo;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
@ -42,7 +42,7 @@ public class DeviceListFragment extends ListFragment
|
||||
private static final String TAG = DeviceListFragment.class.getSimpleName();
|
||||
|
||||
@Inject
|
||||
TextSecureAccountManager accountManager;
|
||||
SignalServiceAccountManager accountManager;
|
||||
|
||||
private Locale locale;
|
||||
private View empty;
|
||||
|
@ -7,7 +7,7 @@ import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.thoughtcrime.securesms.util.DateUtils;
|
||||
import org.whispersystems.textsecure.api.messages.multidevice.DeviceInfo;
|
||||
import org.whispersystems.signalservice.api.messages.multidevice.DeviceInfo;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
|
@ -26,7 +26,7 @@ import org.thoughtcrime.securesms.util.ServiceUtil;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
import org.thoughtcrime.securesms.util.ViewUtil;
|
||||
import org.whispersystems.libaxolotl.util.guava.Optional;
|
||||
import org.whispersystems.libsignal.util.guava.Optional;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
@ -71,8 +71,8 @@ import org.thoughtcrime.securesms.util.SelectedRecipientsAdapter.OnRecipientDele
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
import org.thoughtcrime.securesms.util.ViewUtil;
|
||||
import org.whispersystems.libaxolotl.util.guava.Optional;
|
||||
import org.whispersystems.textsecure.api.util.InvalidNumberException;
|
||||
import org.whispersystems.libsignal.util.guava.Optional;
|
||||
import org.whispersystems.signalservice.api.util.InvalidNumberException;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
@ -16,7 +16,7 @@ import org.thoughtcrime.securesms.recipients.Recipients;
|
||||
import org.thoughtcrime.securesms.util.GroupUtil;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
import org.whispersystems.textsecure.api.util.InvalidNumberException;
|
||||
import org.whispersystems.signalservice.api.util.InvalidNumberException;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.LinkedList;
|
||||
|
@ -36,7 +36,7 @@ import org.thoughtcrime.securesms.sms.OutgoingTextMessage;
|
||||
import org.thoughtcrime.securesms.util.ViewUtil;
|
||||
import org.thoughtcrime.securesms.util.concurrent.ListenableFuture.Listener;
|
||||
import org.thoughtcrime.securesms.util.task.ProgressDialogAsyncTask;
|
||||
import org.whispersystems.libaxolotl.util.guava.Optional;
|
||||
import org.whispersystems.libsignal.util.guava.Optional;
|
||||
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
|
@ -31,7 +31,7 @@ import org.thoughtcrime.securesms.util.Base64;
|
||||
import org.thoughtcrime.securesms.util.Dialogs;
|
||||
import org.thoughtcrime.securesms.util.DynamicLanguage;
|
||||
import org.thoughtcrime.securesms.util.DynamicTheme;
|
||||
import org.whispersystems.libaxolotl.IdentityKey;
|
||||
import org.whispersystems.libsignal.IdentityKey;
|
||||
|
||||
/**
|
||||
* Activity for initiating/receiving key QR code scans.
|
||||
|
@ -28,7 +28,7 @@ import org.thoughtcrime.securesms.crypto.MasterSecret;
|
||||
import org.thoughtcrime.securesms.util.Dialogs;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
import org.whispersystems.textsecure.api.util.PhoneNumberFormatter;
|
||||
import org.whispersystems.signalservice.api.util.PhoneNumberFormatter;
|
||||
|
||||
/**
|
||||
* The register account activity. Prompts ths user for their registration information
|
||||
|
@ -36,10 +36,10 @@ import org.thoughtcrime.securesms.service.RegistrationService;
|
||||
import org.thoughtcrime.securesms.util.Dialogs;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
import org.whispersystems.textsecure.api.TextSecureAccountManager;
|
||||
import org.whispersystems.textsecure.api.push.exceptions.ExpectationFailedException;
|
||||
import org.whispersystems.textsecure.api.push.exceptions.RateLimitException;
|
||||
import org.whispersystems.textsecure.api.util.PhoneNumberFormatter;
|
||||
import org.whispersystems.signalservice.api.SignalServiceAccountManager;
|
||||
import org.whispersystems.signalservice.api.push.exceptions.ExpectationFailedException;
|
||||
import org.whispersystems.signalservice.api.push.exceptions.RateLimitException;
|
||||
import org.whispersystems.signalservice.api.util.PhoneNumberFormatter;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@ -518,8 +518,8 @@ public class RegistrationProgressActivity extends BaseActionBarActivity {
|
||||
@Override
|
||||
protected Integer doInBackground(Void... params) {
|
||||
try {
|
||||
TextSecureAccountManager accountManager = TextSecureCommunicationFactory.createManager(context, e164number, password);
|
||||
int registrationId = TextSecurePreferences.getLocalRegistrationId(context);
|
||||
SignalServiceAccountManager accountManager = TextSecureCommunicationFactory.createManager(context, e164number, password);
|
||||
int registrationId = TextSecurePreferences.getLocalRegistrationId(context);
|
||||
|
||||
accountManager.verifyAccountWithCode(code, signalingKey, registrationId, true);
|
||||
|
||||
@ -611,7 +611,7 @@ public class RegistrationProgressActivity extends BaseActionBarActivity {
|
||||
@Override
|
||||
protected Integer doInBackground(Void... params) {
|
||||
try {
|
||||
TextSecureAccountManager accountManager = TextSecureCommunicationFactory.createManager(context, e164number, password);
|
||||
SignalServiceAccountManager accountManager = TextSecureCommunicationFactory.createManager(context, e164number, password);
|
||||
accountManager.requestVoiceVerificationCode();
|
||||
|
||||
return SUCCESS;
|
||||
|
@ -5,7 +5,7 @@ import android.support.annotation.NonNull;
|
||||
|
||||
import org.thoughtcrime.securesms.util.CharacterCalculator;
|
||||
import org.thoughtcrime.securesms.util.CharacterCalculator.CharacterState;
|
||||
import org.whispersystems.libaxolotl.util.guava.Optional;
|
||||
import org.whispersystems.libsignal.util.guava.Optional;
|
||||
|
||||
public class TransportOption {
|
||||
|
||||
|
@ -10,7 +10,7 @@ import org.thoughtcrime.securesms.util.PushCharacterCalculator;
|
||||
import org.thoughtcrime.securesms.util.SmsCharacterCalculator;
|
||||
import org.thoughtcrime.securesms.util.dualsim.SubscriptionInfoCompat;
|
||||
import org.thoughtcrime.securesms.util.dualsim.SubscriptionManagerCompat;
|
||||
import org.whispersystems.libaxolotl.util.guava.Optional;
|
||||
import org.whispersystems.libsignal.util.guava.Optional;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
@ -29,11 +29,11 @@ import org.thoughtcrime.securesms.crypto.MasterSecret;
|
||||
import org.thoughtcrime.securesms.crypto.storage.TextSecureSessionStore;
|
||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
import org.thoughtcrime.securesms.recipients.RecipientFactory;
|
||||
import org.whispersystems.libaxolotl.AxolotlAddress;
|
||||
import org.whispersystems.libaxolotl.IdentityKey;
|
||||
import org.whispersystems.libaxolotl.state.SessionRecord;
|
||||
import org.whispersystems.libaxolotl.state.SessionStore;
|
||||
import org.whispersystems.textsecure.api.push.TextSecureAddress;
|
||||
import org.whispersystems.libsignal.SignalProtocolAddress;
|
||||
import org.whispersystems.libsignal.IdentityKey;
|
||||
import org.whispersystems.libsignal.state.SessionRecord;
|
||||
import org.whispersystems.libsignal.state.SessionStore;
|
||||
import org.whispersystems.signalservice.api.push.SignalServiceAddress;
|
||||
|
||||
/**
|
||||
* Activity for verifying identity keys.
|
||||
@ -157,9 +157,9 @@ public class VerifyIdentityActivity extends KeyScanningActivity {
|
||||
return identityKeyParcelable.get();
|
||||
}
|
||||
|
||||
SessionStore sessionStore = new TextSecureSessionStore(this, masterSecret);
|
||||
AxolotlAddress axolotlAddress = new AxolotlAddress(recipient.getNumber(), TextSecureAddress.DEFAULT_DEVICE_ID);
|
||||
SessionRecord record = sessionStore.loadSession(axolotlAddress);
|
||||
SessionStore sessionStore = new TextSecureSessionStore(this, masterSecret);
|
||||
SignalProtocolAddress axolotlAddress = new SignalProtocolAddress(recipient.getNumber(), SignalServiceAddress.DEFAULT_DEVICE_ID);
|
||||
SessionRecord record = sessionStore.loadSession(axolotlAddress);
|
||||
|
||||
if (record == null) {
|
||||
return null;
|
||||
|
@ -21,7 +21,7 @@ import android.support.annotation.NonNull;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.thoughtcrime.securesms.crypto.MasterSecret;
|
||||
import org.whispersystems.libaxolotl.IdentityKey;
|
||||
import org.whispersystems.libsignal.IdentityKey;
|
||||
import org.thoughtcrime.securesms.crypto.IdentityKeyParcelable;
|
||||
|
||||
/**
|
||||
|
@ -7,8 +7,8 @@ import android.support.annotation.Nullable;
|
||||
import org.thoughtcrime.securesms.crypto.MasterSecretUnion;
|
||||
import org.thoughtcrime.securesms.crypto.MediaKey;
|
||||
import org.thoughtcrime.securesms.database.AttachmentDatabase;
|
||||
import org.whispersystems.libaxolotl.util.guava.Optional;
|
||||
import org.whispersystems.textsecure.api.messages.TextSecureAttachment;
|
||||
import org.whispersystems.libsignal.util.guava.Optional;
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceAttachment;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
@ -34,11 +34,11 @@ public class PointerAttachment extends Attachment {
|
||||
}
|
||||
|
||||
|
||||
public static List<Attachment> forPointers(@NonNull MasterSecretUnion masterSecret, Optional<List<TextSecureAttachment>> pointers) {
|
||||
public static List<Attachment> forPointers(@NonNull MasterSecretUnion masterSecret, Optional<List<SignalServiceAttachment>> pointers) {
|
||||
List<Attachment> results = new LinkedList<>();
|
||||
|
||||
if (pointers.isPresent()) {
|
||||
for (TextSecureAttachment pointer : pointers.get()) {
|
||||
for (SignalServiceAttachment pointer : pointers.get()) {
|
||||
if (pointer.isPointer()) {
|
||||
String encryptedKey = MediaKey.getEncrypted(masterSecret, pointer.asPointer().getKey());
|
||||
results.add(new PointerAttachment(pointer.getContentType(),
|
||||
|
@ -6,7 +6,7 @@ import android.support.annotation.NonNull;
|
||||
|
||||
import org.thoughtcrime.securesms.crypto.MasterSecret;
|
||||
import org.thoughtcrime.securesms.util.MediaUtil;
|
||||
import org.whispersystems.libaxolotl.util.guava.Optional;
|
||||
import org.whispersystems.libsignal.util.guava.Optional;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
@ -15,7 +15,7 @@ import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.crypto.MasterSecret;
|
||||
import org.thoughtcrime.securesms.mms.AudioSlide;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
import org.whispersystems.libaxolotl.util.guava.Optional;
|
||||
import org.whispersystems.libsignal.util.guava.Optional;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.ref.WeakReference;
|
||||
|
@ -10,7 +10,7 @@ import org.thoughtcrime.securesms.TransportOptions;
|
||||
import org.thoughtcrime.securesms.TransportOptions.OnTransportChangedListener;
|
||||
import org.thoughtcrime.securesms.TransportOptionsPopup;
|
||||
import org.thoughtcrime.securesms.util.ViewUtil;
|
||||
import org.whispersystems.libaxolotl.util.guava.Optional;
|
||||
import org.whispersystems.libsignal.util.guava.Optional;
|
||||
|
||||
public class SendButton extends ImageButton
|
||||
implements TransportOptions.OnTransportChangedListener,
|
||||
|
@ -28,7 +28,7 @@ import org.thoughtcrime.securesms.mms.Slide;
|
||||
import org.thoughtcrime.securesms.mms.SlideClickListener;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
import org.thoughtcrime.securesms.util.ViewUtil;
|
||||
import org.whispersystems.libaxolotl.util.guava.Optional;
|
||||
import org.whispersystems.libsignal.util.guava.Optional;
|
||||
|
||||
public class ThumbnailView extends FrameLayout {
|
||||
|
||||
|
@ -48,7 +48,7 @@ import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
import org.whispersystems.jobqueue.Job;
|
||||
import org.whispersystems.jobqueue.JobParameters;
|
||||
import org.whispersystems.libaxolotl.util.guava.Optional;
|
||||
import org.whispersystems.libsignal.util.guava.Optional;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class CameraView extends ViewGroup {
|
||||
|
@ -35,10 +35,10 @@ import android.util.Log;
|
||||
import android.util.Pair;
|
||||
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.whispersystems.libaxolotl.util.guava.Optional;
|
||||
import org.whispersystems.textsecure.api.push.ContactTokenDetails;
|
||||
import org.whispersystems.textsecure.api.util.InvalidNumberException;
|
||||
import org.whispersystems.textsecure.api.util.PhoneNumberFormatter;
|
||||
import org.whispersystems.libsignal.util.guava.Optional;
|
||||
import org.whispersystems.signalservice.api.push.ContactTokenDetails;
|
||||
import org.whispersystems.signalservice.api.util.InvalidNumberException;
|
||||
import org.whispersystems.signalservice.api.util.PhoneNumberFormatter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
@ -19,12 +19,12 @@ package org.thoughtcrime.securesms.crypto;
|
||||
|
||||
import org.thoughtcrime.securesms.util.Base64;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
import org.whispersystems.libaxolotl.InvalidKeyException;
|
||||
import org.whispersystems.libaxolotl.InvalidMessageException;
|
||||
import org.whispersystems.libaxolotl.ecc.Curve;
|
||||
import org.whispersystems.libaxolotl.ecc.ECKeyPair;
|
||||
import org.whispersystems.libaxolotl.ecc.ECPrivateKey;
|
||||
import org.whispersystems.libaxolotl.ecc.ECPublicKey;
|
||||
import org.whispersystems.libsignal.InvalidKeyException;
|
||||
import org.whispersystems.libsignal.InvalidMessageException;
|
||||
import org.whispersystems.libsignal.ecc.Curve;
|
||||
import org.whispersystems.libsignal.ecc.ECKeyPair;
|
||||
import org.whispersystems.libsignal.ecc.ECPrivateKey;
|
||||
import org.whispersystems.libsignal.ecc.ECPublicKey;
|
||||
import org.thoughtcrime.securesms.util.Conversions;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -17,8 +17,8 @@
|
||||
*/
|
||||
package org.thoughtcrime.securesms.crypto;
|
||||
|
||||
import org.whispersystems.libaxolotl.ecc.ECPrivateKey;
|
||||
import org.whispersystems.libaxolotl.ecc.ECPublicKey;
|
||||
import org.whispersystems.libsignal.ecc.ECPrivateKey;
|
||||
import org.whispersystems.libsignal.ecc.ECPublicKey;
|
||||
|
||||
/**
|
||||
* When a user first initializes TextSecure, a few secrets
|
||||
|
@ -19,8 +19,8 @@ package org.thoughtcrime.securesms.crypto;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import org.whispersystems.libaxolotl.IdentityKey;
|
||||
import org.whispersystems.libaxolotl.InvalidKeyException;
|
||||
import org.whispersystems.libsignal.IdentityKey;
|
||||
import org.whispersystems.libsignal.InvalidKeyException;
|
||||
|
||||
public class IdentityKeyParcelable implements Parcelable {
|
||||
|
||||
|
@ -23,12 +23,12 @@ import android.content.SharedPreferences.Editor;
|
||||
import android.support.annotation.NonNull;
|
||||
|
||||
import org.thoughtcrime.securesms.util.Base64;
|
||||
import org.whispersystems.libaxolotl.IdentityKey;
|
||||
import org.whispersystems.libaxolotl.IdentityKeyPair;
|
||||
import org.whispersystems.libaxolotl.InvalidKeyException;
|
||||
import org.whispersystems.libaxolotl.ecc.Curve;
|
||||
import org.whispersystems.libaxolotl.ecc.ECKeyPair;
|
||||
import org.whispersystems.libaxolotl.ecc.ECPrivateKey;
|
||||
import org.whispersystems.libsignal.IdentityKey;
|
||||
import org.whispersystems.libsignal.IdentityKeyPair;
|
||||
import org.whispersystems.libsignal.InvalidKeyException;
|
||||
import org.whispersystems.libsignal.ecc.Curve;
|
||||
import org.whispersystems.libsignal.ecc.ECKeyPair;
|
||||
import org.whispersystems.libsignal.ecc.ECPrivateKey;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
@ -22,9 +22,9 @@ import android.util.Log;
|
||||
|
||||
import org.thoughtcrime.securesms.util.Base64;
|
||||
import org.thoughtcrime.securesms.util.Hex;
|
||||
import org.whispersystems.libaxolotl.InvalidMessageException;
|
||||
import org.whispersystems.libaxolotl.ecc.Curve;
|
||||
import org.whispersystems.libaxolotl.ecc.ECPrivateKey;
|
||||
import org.whispersystems.libsignal.InvalidMessageException;
|
||||
import org.whispersystems.libsignal.ecc.Curve;
|
||||
import org.whispersystems.libsignal.ecc.ECPrivateKey;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.security.GeneralSecurityException;
|
||||
@ -84,12 +84,12 @@ public class MasterCipher {
|
||||
}
|
||||
|
||||
public ECPrivateKey decryptKey(byte[] key)
|
||||
throws org.whispersystems.libaxolotl.InvalidKeyException
|
||||
throws org.whispersystems.libsignal.InvalidKeyException
|
||||
{
|
||||
try {
|
||||
return Curve.decodePrivatePoint(decryptBytes(key));
|
||||
} catch (InvalidMessageException ime) {
|
||||
throw new org.whispersystems.libaxolotl.InvalidKeyException(ime);
|
||||
throw new org.whispersystems.libsignal.InvalidKeyException(ime);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@ package org.thoughtcrime.securesms.crypto;
|
||||
|
||||
import android.support.annotation.NonNull;
|
||||
|
||||
import org.whispersystems.libaxolotl.util.guava.Optional;
|
||||
import org.whispersystems.libsignal.util.guava.Optional;
|
||||
|
||||
public class MasterSecretUnion {
|
||||
|
||||
|
@ -26,11 +26,11 @@ import android.util.Log;
|
||||
|
||||
import org.thoughtcrime.securesms.util.Base64;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
import org.whispersystems.libaxolotl.InvalidKeyException;
|
||||
import org.whispersystems.libaxolotl.ecc.Curve;
|
||||
import org.whispersystems.libaxolotl.ecc.ECKeyPair;
|
||||
import org.whispersystems.libaxolotl.ecc.ECPrivateKey;
|
||||
import org.whispersystems.libaxolotl.ecc.ECPublicKey;
|
||||
import org.whispersystems.libsignal.InvalidKeyException;
|
||||
import org.whispersystems.libsignal.ecc.Curve;
|
||||
import org.whispersystems.libsignal.ecc.ECKeyPair;
|
||||
import org.whispersystems.libsignal.ecc.ECPrivateKey;
|
||||
import org.whispersystems.libsignal.ecc.ECPublicKey;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.security.GeneralSecurityException;
|
||||
|
@ -3,7 +3,7 @@ package org.thoughtcrime.securesms.crypto;
|
||||
import android.support.annotation.NonNull;
|
||||
|
||||
import org.thoughtcrime.securesms.util.Base64;
|
||||
import org.whispersystems.libaxolotl.InvalidMessageException;
|
||||
import org.whispersystems.libsignal.InvalidMessageException;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
@ -25,16 +25,16 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import org.thoughtcrime.securesms.crypto.storage.TextSecurePreKeyStore;
|
||||
import org.thoughtcrime.securesms.util.JsonUtils;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
import org.whispersystems.libaxolotl.IdentityKeyPair;
|
||||
import org.whispersystems.libaxolotl.InvalidKeyException;
|
||||
import org.whispersystems.libaxolotl.InvalidKeyIdException;
|
||||
import org.whispersystems.libaxolotl.ecc.Curve;
|
||||
import org.whispersystems.libaxolotl.ecc.ECKeyPair;
|
||||
import org.whispersystems.libaxolotl.state.PreKeyRecord;
|
||||
import org.whispersystems.libaxolotl.state.PreKeyStore;
|
||||
import org.whispersystems.libaxolotl.state.SignedPreKeyRecord;
|
||||
import org.whispersystems.libaxolotl.state.SignedPreKeyStore;
|
||||
import org.whispersystems.libaxolotl.util.Medium;
|
||||
import org.whispersystems.libsignal.IdentityKeyPair;
|
||||
import org.whispersystems.libsignal.InvalidKeyException;
|
||||
import org.whispersystems.libsignal.InvalidKeyIdException;
|
||||
import org.whispersystems.libsignal.ecc.Curve;
|
||||
import org.whispersystems.libsignal.ecc.ECKeyPair;
|
||||
import org.whispersystems.libsignal.state.PreKeyRecord;
|
||||
import org.whispersystems.libsignal.state.PreKeyStore;
|
||||
import org.whispersystems.libsignal.state.SignedPreKeyRecord;
|
||||
import org.whispersystems.libsignal.state.SignedPreKeyStore;
|
||||
import org.whispersystems.libsignal.util.Medium;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
|
@ -21,9 +21,9 @@ import android.util.Log;
|
||||
|
||||
import org.thoughtcrime.securesms.util.Hex;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
import org.whispersystems.libaxolotl.InvalidKeyException;
|
||||
import org.whispersystems.libaxolotl.ecc.Curve;
|
||||
import org.whispersystems.libaxolotl.ecc.ECPublicKey;
|
||||
import org.whispersystems.libsignal.InvalidKeyException;
|
||||
import org.whispersystems.libsignal.ecc.Curve;
|
||||
import org.whispersystems.libsignal.ecc.ECPublicKey;
|
||||
import org.thoughtcrime.securesms.util.Conversions;
|
||||
|
||||
import java.security.MessageDigest;
|
||||
|
@ -5,9 +5,9 @@ import android.support.annotation.NonNull;
|
||||
|
||||
import org.thoughtcrime.securesms.crypto.storage.TextSecureSessionStore;
|
||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
import org.whispersystems.libaxolotl.AxolotlAddress;
|
||||
import org.whispersystems.libaxolotl.state.SessionStore;
|
||||
import org.whispersystems.textsecure.api.push.TextSecureAddress;
|
||||
import org.whispersystems.libsignal.SignalProtocolAddress;
|
||||
import org.whispersystems.libsignal.state.SessionStore;
|
||||
import org.whispersystems.signalservice.api.push.SignalServiceAddress;
|
||||
|
||||
public class SessionUtil {
|
||||
|
||||
@ -16,8 +16,8 @@ public class SessionUtil {
|
||||
}
|
||||
|
||||
public static boolean hasSession(Context context, MasterSecret masterSecret, @NonNull String number) {
|
||||
SessionStore sessionStore = new TextSecureSessionStore(context, masterSecret);
|
||||
AxolotlAddress axolotlAddress = new AxolotlAddress(number, TextSecureAddress.DEFAULT_DEVICE_ID);
|
||||
SessionStore sessionStore = new TextSecureSessionStore(context, masterSecret);
|
||||
SignalProtocolAddress axolotlAddress = new SignalProtocolAddress(number, SignalServiceAddress.DEFAULT_DEVICE_ID);
|
||||
|
||||
return sessionStore.containsSession(axolotlAddress);
|
||||
}
|
||||
|
@ -2,29 +2,29 @@ package org.thoughtcrime.securesms.crypto.storage;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import org.whispersystems.libaxolotl.AxolotlAddress;
|
||||
import org.whispersystems.libaxolotl.IdentityKey;
|
||||
import org.whispersystems.libaxolotl.IdentityKeyPair;
|
||||
import org.whispersystems.libaxolotl.InvalidKeyIdException;
|
||||
import org.whispersystems.libaxolotl.state.AxolotlStore;
|
||||
import org.whispersystems.libaxolotl.state.IdentityKeyStore;
|
||||
import org.whispersystems.libaxolotl.state.PreKeyRecord;
|
||||
import org.whispersystems.libaxolotl.state.PreKeyStore;
|
||||
import org.whispersystems.libaxolotl.state.SessionRecord;
|
||||
import org.whispersystems.libaxolotl.state.SessionStore;
|
||||
import org.whispersystems.libaxolotl.state.SignedPreKeyRecord;
|
||||
import org.whispersystems.libaxolotl.state.SignedPreKeyStore;
|
||||
import org.whispersystems.libsignal.SignalProtocolAddress;
|
||||
import org.whispersystems.libsignal.IdentityKey;
|
||||
import org.whispersystems.libsignal.IdentityKeyPair;
|
||||
import org.whispersystems.libsignal.InvalidKeyIdException;
|
||||
import org.whispersystems.libsignal.state.SignalProtocolStore;
|
||||
import org.whispersystems.libsignal.state.IdentityKeyStore;
|
||||
import org.whispersystems.libsignal.state.PreKeyRecord;
|
||||
import org.whispersystems.libsignal.state.PreKeyStore;
|
||||
import org.whispersystems.libsignal.state.SessionRecord;
|
||||
import org.whispersystems.libsignal.state.SessionStore;
|
||||
import org.whispersystems.libsignal.state.SignedPreKeyRecord;
|
||||
import org.whispersystems.libsignal.state.SignedPreKeyStore;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class TextSecureAxolotlStore implements AxolotlStore {
|
||||
public class SignalProtocolStoreImpl implements SignalProtocolStore {
|
||||
|
||||
private final PreKeyStore preKeyStore;
|
||||
private final SignedPreKeyStore signedPreKeyStore;
|
||||
private final IdentityKeyStore identityKeyStore;
|
||||
private final SessionStore sessionStore;
|
||||
|
||||
public TextSecureAxolotlStore(Context context) {
|
||||
public SignalProtocolStoreImpl(Context context) {
|
||||
this.preKeyStore = new TextSecurePreKeyStore(context);
|
||||
this.signedPreKeyStore = new TextSecurePreKeyStore(context);
|
||||
this.identityKeyStore = new TextSecureIdentityKeyStore(context);
|
||||
@ -72,7 +72,7 @@ public class TextSecureAxolotlStore implements AxolotlStore {
|
||||
}
|
||||
|
||||
@Override
|
||||
public SessionRecord loadSession(AxolotlAddress axolotlAddress) {
|
||||
public SessionRecord loadSession(SignalProtocolAddress axolotlAddress) {
|
||||
return sessionStore.loadSession(axolotlAddress);
|
||||
}
|
||||
|
||||
@ -82,17 +82,17 @@ public class TextSecureAxolotlStore implements AxolotlStore {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void storeSession(AxolotlAddress axolotlAddress, SessionRecord record) {
|
||||
public void storeSession(SignalProtocolAddress axolotlAddress, SessionRecord record) {
|
||||
sessionStore.storeSession(axolotlAddress, record);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsSession(AxolotlAddress axolotlAddress) {
|
||||
public boolean containsSession(SignalProtocolAddress axolotlAddress) {
|
||||
return sessionStore.containsSession(axolotlAddress);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteSession(AxolotlAddress axolotlAddress) {
|
||||
public void deleteSession(SignalProtocolAddress axolotlAddress) {
|
||||
sessionStore.deleteSession(axolotlAddress);
|
||||
}
|
||||
|
@ -6,9 +6,9 @@ import org.thoughtcrime.securesms.crypto.IdentityKeyUtil;
|
||||
import org.thoughtcrime.securesms.database.DatabaseFactory;
|
||||
import org.thoughtcrime.securesms.recipients.RecipientFactory;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.whispersystems.libaxolotl.IdentityKey;
|
||||
import org.whispersystems.libaxolotl.IdentityKeyPair;
|
||||
import org.whispersystems.libaxolotl.state.IdentityKeyStore;
|
||||
import org.whispersystems.libsignal.IdentityKey;
|
||||
import org.whispersystems.libsignal.IdentityKeyPair;
|
||||
import org.whispersystems.libsignal.state.IdentityKeyStore;
|
||||
|
||||
public class TextSecureIdentityKeyStore implements IdentityKeyStore {
|
||||
|
||||
|
@ -7,12 +7,12 @@ import android.util.Log;
|
||||
|
||||
import org.thoughtcrime.securesms.crypto.MasterCipher;
|
||||
import org.thoughtcrime.securesms.crypto.MasterSecret;
|
||||
import org.whispersystems.libaxolotl.InvalidKeyIdException;
|
||||
import org.whispersystems.libaxolotl.InvalidMessageException;
|
||||
import org.whispersystems.libaxolotl.state.SignedPreKeyRecord;
|
||||
import org.whispersystems.libaxolotl.state.SignedPreKeyStore;
|
||||
import org.whispersystems.libaxolotl.state.PreKeyRecord;
|
||||
import org.whispersystems.libaxolotl.state.PreKeyStore;
|
||||
import org.whispersystems.libsignal.InvalidKeyIdException;
|
||||
import org.whispersystems.libsignal.InvalidMessageException;
|
||||
import org.whispersystems.libsignal.state.SignedPreKeyRecord;
|
||||
import org.whispersystems.libsignal.state.SignedPreKeyStore;
|
||||
import org.whispersystems.libsignal.state.PreKeyRecord;
|
||||
import org.whispersystems.libsignal.state.PreKeyStore;
|
||||
import org.thoughtcrime.securesms.util.Conversions;
|
||||
|
||||
import java.io.File;
|
||||
|
@ -10,12 +10,12 @@ import org.thoughtcrime.securesms.crypto.MasterSecret;
|
||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
import org.thoughtcrime.securesms.recipients.RecipientFactory;
|
||||
import org.thoughtcrime.securesms.util.Conversions;
|
||||
import org.whispersystems.libaxolotl.AxolotlAddress;
|
||||
import org.whispersystems.libaxolotl.InvalidMessageException;
|
||||
import org.whispersystems.libaxolotl.state.SessionRecord;
|
||||
import org.whispersystems.libaxolotl.state.SessionState;
|
||||
import org.whispersystems.libaxolotl.state.SessionStore;
|
||||
import org.whispersystems.textsecure.api.push.TextSecureAddress;
|
||||
import org.whispersystems.libsignal.SignalProtocolAddress;
|
||||
import org.whispersystems.libsignal.InvalidMessageException;
|
||||
import org.whispersystems.libsignal.state.SessionRecord;
|
||||
import org.whispersystems.libsignal.state.SessionState;
|
||||
import org.whispersystems.libsignal.state.SessionStore;
|
||||
import org.whispersystems.signalservice.api.push.SignalServiceAddress;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
@ -26,7 +26,7 @@ import java.nio.channels.FileChannel;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import static org.whispersystems.libaxolotl.state.StorageProtos.SessionStructure;
|
||||
import static org.whispersystems.libsignal.state.StorageProtos.SessionStructure;
|
||||
|
||||
public class TextSecureSessionStore implements SessionStore {
|
||||
|
||||
@ -52,7 +52,7 @@ public class TextSecureSessionStore implements SessionStore {
|
||||
}
|
||||
|
||||
@Override
|
||||
public SessionRecord loadSession(@NonNull AxolotlAddress address) {
|
||||
public SessionRecord loadSession(@NonNull SignalProtocolAddress address) {
|
||||
synchronized (FILE_LOCK) {
|
||||
try {
|
||||
FileInputStream in = new FileInputStream(getSessionFile(address));
|
||||
@ -88,7 +88,7 @@ public class TextSecureSessionStore implements SessionStore {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void storeSession(@NonNull AxolotlAddress address, @NonNull SessionRecord record) {
|
||||
public void storeSession(@NonNull SignalProtocolAddress address, @NonNull SessionRecord record) {
|
||||
synchronized (FILE_LOCK) {
|
||||
try {
|
||||
RandomAccessFile sessionFile = new RandomAccessFile(getSessionFile(address), "rw");
|
||||
@ -107,13 +107,13 @@ public class TextSecureSessionStore implements SessionStore {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsSession(AxolotlAddress address) {
|
||||
public boolean containsSession(SignalProtocolAddress address) {
|
||||
return getSessionFile(address).exists() &&
|
||||
loadSession(address).getSessionState().hasSenderChain();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteSession(AxolotlAddress address) {
|
||||
public void deleteSession(SignalProtocolAddress address) {
|
||||
getSessionFile(address).delete();
|
||||
}
|
||||
|
||||
@ -121,10 +121,10 @@ public class TextSecureSessionStore implements SessionStore {
|
||||
public void deleteAllSessions(String name) {
|
||||
List<Integer> devices = getSubDeviceSessions(name);
|
||||
|
||||
deleteSession(new AxolotlAddress(name, TextSecureAddress.DEFAULT_DEVICE_ID));
|
||||
deleteSession(new SignalProtocolAddress(name, SignalServiceAddress.DEFAULT_DEVICE_ID));
|
||||
|
||||
for (int device : devices) {
|
||||
deleteSession(new AxolotlAddress(name, device));
|
||||
deleteSession(new SignalProtocolAddress(name, device));
|
||||
}
|
||||
}
|
||||
|
||||
@ -159,7 +159,7 @@ public class TextSecureSessionStore implements SessionStore {
|
||||
|
||||
for (File session : directory.listFiles()) {
|
||||
if (session.isFile()) {
|
||||
AxolotlAddress address = getAddressName(session);
|
||||
SignalProtocolAddress address = getAddressName(session);
|
||||
|
||||
if (address != null) {
|
||||
SessionRecord sessionRecord = loadSession(address);
|
||||
@ -170,7 +170,7 @@ public class TextSecureSessionStore implements SessionStore {
|
||||
}
|
||||
}
|
||||
|
||||
private File getSessionFile(AxolotlAddress address) {
|
||||
private File getSessionFile(SignalProtocolAddress address) {
|
||||
return new File(getSessionDirectory(), getSessionName(address));
|
||||
}
|
||||
|
||||
@ -186,16 +186,16 @@ public class TextSecureSessionStore implements SessionStore {
|
||||
return directory;
|
||||
}
|
||||
|
||||
private String getSessionName(AxolotlAddress axolotlAddress) {
|
||||
private String getSessionName(SignalProtocolAddress axolotlAddress) {
|
||||
Recipient recipient = RecipientFactory.getRecipientsFromString(context, axolotlAddress.getName(), true)
|
||||
.getPrimaryRecipient();
|
||||
long recipientId = recipient.getRecipientId();
|
||||
int deviceId = axolotlAddress.getDeviceId();
|
||||
|
||||
return recipientId + (deviceId == TextSecureAddress.DEFAULT_DEVICE_ID ? "" : "." + deviceId);
|
||||
return recipientId + (deviceId == SignalServiceAddress.DEFAULT_DEVICE_ID ? "" : "." + deviceId);
|
||||
}
|
||||
|
||||
private @Nullable AxolotlAddress getAddressName(File sessionFile) {
|
||||
private @Nullable SignalProtocolAddress getAddressName(File sessionFile) {
|
||||
try {
|
||||
String[] parts = sessionFile.getName().split("[.]");
|
||||
Recipient recipient = RecipientFactory.getRecipientForId(context, Integer.valueOf(parts[0]), true);
|
||||
@ -203,9 +203,9 @@ public class TextSecureSessionStore implements SessionStore {
|
||||
int deviceId;
|
||||
|
||||
if (parts.length > 1) deviceId = Integer.parseInt(parts[1]);
|
||||
else deviceId = TextSecureAddress.DEFAULT_DEVICE_ID;
|
||||
else deviceId = SignalServiceAddress.DEFAULT_DEVICE_ID;
|
||||
|
||||
return new AxolotlAddress(recipient.getNumber(), deviceId);
|
||||
return new SignalProtocolAddress(recipient.getNumber(), deviceId);
|
||||
} catch (NumberFormatException e) {
|
||||
Log.w(TAG, e);
|
||||
return null;
|
||||
|
@ -27,7 +27,7 @@ import android.util.Log;
|
||||
import org.thoughtcrime.securesms.mms.LegacyMmsConnection.Apn;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
import org.whispersystems.libaxolotl.util.guava.Optional;
|
||||
import org.whispersystems.libsignal.util.guava.Optional;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
|
@ -36,8 +36,8 @@ import org.thoughtcrime.securesms.util.GroupUtil;
|
||||
import org.thoughtcrime.securesms.util.ShortCodeUtil;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.thoughtcrime.securesms.util.VisibleForTesting;
|
||||
import org.whispersystems.textsecure.api.util.InvalidNumberException;
|
||||
import org.whispersystems.textsecure.api.util.PhoneNumberFormatter;
|
||||
import org.whispersystems.signalservice.api.util.InvalidNumberException;
|
||||
import org.whispersystems.signalservice.api.util.PhoneNumberFormatter;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
@ -34,8 +34,8 @@ import org.thoughtcrime.securesms.crypto.MasterSecretUtil;
|
||||
import org.thoughtcrime.securesms.notifications.MessageNotifier;
|
||||
import org.thoughtcrime.securesms.util.Base64;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
import org.whispersystems.libaxolotl.IdentityKey;
|
||||
import org.whispersystems.libaxolotl.InvalidMessageException;
|
||||
import org.whispersystems.libsignal.IdentityKey;
|
||||
import org.whispersystems.libsignal.InvalidMessageException;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
|
@ -10,7 +10,7 @@ import android.support.annotation.Nullable;
|
||||
import android.util.Log;
|
||||
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.whispersystems.libaxolotl.InvalidMessageException;
|
||||
import org.whispersystems.libsignal.InvalidMessageException;
|
||||
import org.thoughtcrime.securesms.crypto.MasterCipher;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
@ -34,7 +34,7 @@ import org.thoughtcrime.securesms.database.model.SmsMessageRecord;
|
||||
import org.thoughtcrime.securesms.sms.IncomingTextMessage;
|
||||
import org.thoughtcrime.securesms.sms.OutgoingTextMessage;
|
||||
import org.thoughtcrime.securesms.util.LRUCache;
|
||||
import org.whispersystems.libaxolotl.InvalidMessageException;
|
||||
import org.whispersystems.libsignal.InvalidMessageException;
|
||||
|
||||
import java.lang.ref.SoftReference;
|
||||
import java.util.Collections;
|
||||
|
@ -21,7 +21,7 @@ import org.thoughtcrime.securesms.util.BitmapUtil;
|
||||
import org.thoughtcrime.securesms.util.GroupUtil;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
import org.whispersystems.textsecure.api.messages.TextSecureAttachmentPointer;
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceAttachmentPointer;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
@ -113,7 +113,7 @@ public class GroupDatabase extends Database {
|
||||
}
|
||||
|
||||
public void create(byte[] groupId, String title, List<String> members,
|
||||
TextSecureAttachmentPointer avatar, String relay)
|
||||
SignalServiceAttachmentPointer avatar, String relay)
|
||||
{
|
||||
ContentValues contentValues = new ContentValues();
|
||||
contentValues.put(GROUP_ID, GroupUtil.getEncodedId(groupId));
|
||||
@ -133,7 +133,7 @@ public class GroupDatabase extends Database {
|
||||
databaseHelper.getWritableDatabase().insert(TABLE_NAME, null, contentValues);
|
||||
}
|
||||
|
||||
public void update(byte[] groupId, String title, TextSecureAttachmentPointer avatar) {
|
||||
public void update(byte[] groupId, String title, SignalServiceAttachmentPointer avatar) {
|
||||
ContentValues contentValues = new ContentValues();
|
||||
if (title != null) contentValues.put(TITLE, title);
|
||||
|
||||
|
@ -27,8 +27,8 @@ import android.util.Log;
|
||||
import org.thoughtcrime.securesms.recipients.RecipientFactory;
|
||||
import org.thoughtcrime.securesms.recipients.Recipients;
|
||||
import org.thoughtcrime.securesms.util.Base64;
|
||||
import org.whispersystems.libaxolotl.IdentityKey;
|
||||
import org.whispersystems.libaxolotl.InvalidKeyException;
|
||||
import org.whispersystems.libsignal.IdentityKey;
|
||||
import org.whispersystems.libsignal.InvalidKeyException;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
@ -12,7 +12,7 @@ import org.thoughtcrime.securesms.database.documents.Document;
|
||||
import org.thoughtcrime.securesms.database.documents.IdentityKeyMismatch;
|
||||
import org.thoughtcrime.securesms.database.documents.IdentityKeyMismatchList;
|
||||
import org.thoughtcrime.securesms.util.JsonUtils;
|
||||
import org.whispersystems.libaxolotl.IdentityKey;
|
||||
import org.whispersystems.libsignal.IdentityKey;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
@ -62,9 +62,9 @@ import org.thoughtcrime.securesms.util.ServiceUtil;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
import org.whispersystems.jobqueue.JobManager;
|
||||
import org.whispersystems.libaxolotl.InvalidMessageException;
|
||||
import org.whispersystems.libaxolotl.util.guava.Optional;
|
||||
import org.whispersystems.textsecure.api.util.InvalidNumberException;
|
||||
import org.whispersystems.libsignal.InvalidMessageException;
|
||||
import org.whispersystems.libsignal.util.guava.Optional;
|
||||
import org.whispersystems.signalservice.api.util.InvalidNumberException;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashSet;
|
||||
|
@ -28,7 +28,7 @@ import android.util.Log;
|
||||
import org.thoughtcrime.securesms.crypto.MasterSecret;
|
||||
import org.thoughtcrime.securesms.database.MessagingDatabase.SyncMessageId;
|
||||
import org.thoughtcrime.securesms.database.model.MessageRecord;
|
||||
import org.whispersystems.libaxolotl.util.guava.Optional;
|
||||
import org.whispersystems.libsignal.util.guava.Optional;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
@ -9,9 +9,9 @@ import android.support.annotation.NonNull;
|
||||
import android.util.Log;
|
||||
|
||||
import org.thoughtcrime.securesms.util.Base64;
|
||||
import org.whispersystems.libaxolotl.util.guava.Optional;
|
||||
import org.whispersystems.textsecure.api.messages.TextSecureEnvelope;
|
||||
import org.whispersystems.textsecure.internal.util.Util;
|
||||
import org.whispersystems.libsignal.util.guava.Optional;
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceEnvelope;
|
||||
import org.whispersystems.signalservice.internal.util.Util;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@ -35,7 +35,7 @@ public class PushDatabase extends Database {
|
||||
super(context, databaseHelper);
|
||||
}
|
||||
|
||||
public long insert(@NonNull TextSecureEnvelope envelope) {
|
||||
public long insert(@NonNull SignalServiceEnvelope envelope) {
|
||||
Optional<Long> messageId = find(envelope);
|
||||
|
||||
if (messageId.isPresent()) {
|
||||
@ -53,7 +53,7 @@ public class PushDatabase extends Database {
|
||||
}
|
||||
}
|
||||
|
||||
public TextSecureEnvelope get(long id) throws NoSuchMessageException {
|
||||
public SignalServiceEnvelope get(long id) throws NoSuchMessageException {
|
||||
Cursor cursor = null;
|
||||
|
||||
try {
|
||||
@ -65,13 +65,13 @@ public class PushDatabase extends Database {
|
||||
String legacyMessage = cursor.getString(cursor.getColumnIndexOrThrow(LEGACY_MSG));
|
||||
String content = cursor.getString(cursor.getColumnIndexOrThrow(CONTENT));
|
||||
|
||||
return new TextSecureEnvelope(cursor.getInt(cursor.getColumnIndexOrThrow(TYPE)),
|
||||
cursor.getString(cursor.getColumnIndexOrThrow(SOURCE)),
|
||||
cursor.getInt(cursor.getColumnIndexOrThrow(DEVICE_ID)),
|
||||
"",
|
||||
cursor.getLong(cursor.getColumnIndexOrThrow(TIMESTAMP)),
|
||||
Util.isEmpty(legacyMessage) ? null : Base64.decode(legacyMessage),
|
||||
Util.isEmpty(content) ? null : Base64.decode(content));
|
||||
return new SignalServiceEnvelope(cursor.getInt(cursor.getColumnIndexOrThrow(TYPE)),
|
||||
cursor.getString(cursor.getColumnIndexOrThrow(SOURCE)),
|
||||
cursor.getInt(cursor.getColumnIndexOrThrow(DEVICE_ID)),
|
||||
"",
|
||||
cursor.getLong(cursor.getColumnIndexOrThrow(TIMESTAMP)),
|
||||
Util.isEmpty(legacyMessage) ? null : Base64.decode(legacyMessage),
|
||||
Util.isEmpty(content) ? null : Base64.decode(content));
|
||||
}
|
||||
} catch (IOException e) {
|
||||
Log.w(TAG, e);
|
||||
@ -96,7 +96,7 @@ public class PushDatabase extends Database {
|
||||
return new Reader(cursor);
|
||||
}
|
||||
|
||||
private Optional<Long> find(TextSecureEnvelope envelope) {
|
||||
private Optional<Long> find(SignalServiceEnvelope envelope) {
|
||||
SQLiteDatabase database = databaseHelper.getReadableDatabase();
|
||||
Cursor cursor = null;
|
||||
|
||||
@ -129,7 +129,7 @@ public class PushDatabase extends Database {
|
||||
this.cursor = cursor;
|
||||
}
|
||||
|
||||
public TextSecureEnvelope getNext() {
|
||||
public SignalServiceEnvelope getNext() {
|
||||
try {
|
||||
if (cursor == null || !cursor.moveToNext())
|
||||
return null;
|
||||
@ -141,9 +141,9 @@ public class PushDatabase extends Database {
|
||||
String content = cursor.getString(cursor.getColumnIndexOrThrow(CONTENT));
|
||||
long timestamp = cursor.getLong(cursor.getColumnIndexOrThrow(TIMESTAMP));
|
||||
|
||||
return new TextSecureEnvelope(type, source, deviceId, "", timestamp,
|
||||
legacyMessage != null ? Base64.decode(legacyMessage) : null,
|
||||
content != null ? Base64.decode(content) : null);
|
||||
return new SignalServiceEnvelope(type, source, deviceId, "", timestamp,
|
||||
legacyMessage != null ? Base64.decode(legacyMessage) : null,
|
||||
content != null ? Base64.decode(content) : null);
|
||||
} catch (IOException e) {
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ import android.util.Log;
|
||||
import org.thoughtcrime.securesms.color.MaterialColor;
|
||||
import org.thoughtcrime.securesms.recipients.Recipients;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
import org.whispersystems.libaxolotl.util.guava.Optional;
|
||||
import org.whispersystems.libsignal.util.guava.Optional;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
|
@ -42,7 +42,7 @@ import org.thoughtcrime.securesms.sms.IncomingTextMessage;
|
||||
import org.thoughtcrime.securesms.sms.OutgoingTextMessage;
|
||||
import org.thoughtcrime.securesms.util.JsonUtils;
|
||||
import org.whispersystems.jobqueue.JobManager;
|
||||
import org.whispersystems.textsecure.api.util.InvalidNumberException;
|
||||
import org.whispersystems.signalservice.api.util.InvalidNumberException;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.LinkedList;
|
||||
|
@ -10,9 +10,9 @@ import android.provider.ContactsContract.CommonDataKinds.Phone;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import org.whispersystems.textsecure.api.push.ContactTokenDetails;
|
||||
import org.whispersystems.textsecure.api.util.InvalidNumberException;
|
||||
import org.whispersystems.textsecure.api.util.PhoneNumberFormatter;
|
||||
import org.whispersystems.signalservice.api.push.ContactTokenDetails;
|
||||
import org.whispersystems.signalservice.api.util.InvalidNumberException;
|
||||
import org.whispersystems.signalservice.api.util.PhoneNumberFormatter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
@ -40,7 +40,7 @@ import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
import org.thoughtcrime.securesms.recipients.RecipientFactory;
|
||||
import org.thoughtcrime.securesms.recipients.Recipients;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
import org.whispersystems.libaxolotl.InvalidMessageException;
|
||||
import org.whispersystems.libsignal.InvalidMessageException;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
|
@ -13,8 +13,8 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
|
||||
import org.thoughtcrime.securesms.util.Base64;
|
||||
import org.whispersystems.libaxolotl.IdentityKey;
|
||||
import org.whispersystems.libaxolotl.InvalidKeyException;
|
||||
import org.whispersystems.libsignal.IdentityKey;
|
||||
import org.whispersystems.libsignal.InvalidKeyException;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
@ -13,7 +13,7 @@ import android.support.v4.content.AsyncTaskLoader;
|
||||
|
||||
|
||||
import com.google.i18n.phonenumbers.PhoneNumberUtil;
|
||||
import org.whispersystems.textsecure.api.util.PhoneNumberFormatter;
|
||||
import org.whispersystems.signalservice.api.util.PhoneNumberFormatter;
|
||||
|
||||
public class CountryListLoader extends AsyncTaskLoader<ArrayList<Map<String, String>>> {
|
||||
|
||||
|
@ -4,9 +4,9 @@ import android.content.Context;
|
||||
import android.support.v4.content.AsyncTaskLoader;
|
||||
import android.util.Log;
|
||||
|
||||
import org.whispersystems.textsecure.api.TextSecureAccountManager;
|
||||
import org.whispersystems.textsecure.api.messages.multidevice.DeviceInfo;
|
||||
import org.whispersystems.textsecure.api.push.TextSecureAddress;
|
||||
import org.whispersystems.signalservice.api.SignalServiceAccountManager;
|
||||
import org.whispersystems.signalservice.api.messages.multidevice.DeviceInfo;
|
||||
import org.whispersystems.signalservice.api.push.SignalServiceAddress;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
@ -18,9 +18,9 @@ public class DeviceListLoader extends AsyncTaskLoader<List<DeviceInfo>> {
|
||||
|
||||
private static final String TAG = DeviceListLoader.class.getSimpleName();
|
||||
|
||||
private final TextSecureAccountManager accountManager;
|
||||
private final SignalServiceAccountManager accountManager;
|
||||
|
||||
public DeviceListLoader(Context context, TextSecureAccountManager accountManager) {
|
||||
public DeviceListLoader(Context context, SignalServiceAccountManager accountManager) {
|
||||
super(context);
|
||||
this.accountManager = accountManager;
|
||||
}
|
||||
@ -32,7 +32,7 @@ public class DeviceListLoader extends AsyncTaskLoader<List<DeviceInfo>> {
|
||||
Iterator<DeviceInfo> iterator = devices.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
if ((iterator.next().getId() == TextSecureAddress.DEFAULT_DEVICE_ID)) {
|
||||
if ((iterator.next().getId() == SignalServiceAddress.DEFAULT_DEVICE_ID)) {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
|
@ -2,10 +2,9 @@ package org.thoughtcrime.securesms.dependencies;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import org.thoughtcrime.securesms.crypto.MasterSecret;
|
||||
import org.thoughtcrime.securesms.crypto.storage.TextSecureAxolotlStore;
|
||||
import org.thoughtcrime.securesms.crypto.storage.SignalProtocolStoreImpl;
|
||||
import org.thoughtcrime.securesms.jobs.CleanPreKeysJob;
|
||||
import org.whispersystems.libaxolotl.state.SignedPreKeyStore;
|
||||
import org.whispersystems.libsignal.state.SignedPreKeyStore;
|
||||
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
@ -23,7 +22,7 @@ public class AxolotlStorageModule {
|
||||
return new SignedPreKeyStoreFactory() {
|
||||
@Override
|
||||
public SignedPreKeyStore create() {
|
||||
return new TextSecureAxolotlStore(context);
|
||||
return new SignalProtocolStoreImpl(context);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ import android.content.Context;
|
||||
|
||||
import org.thoughtcrime.securesms.BuildConfig;
|
||||
import org.thoughtcrime.securesms.DeviceListFragment;
|
||||
import org.thoughtcrime.securesms.crypto.storage.TextSecureAxolotlStore;
|
||||
import org.thoughtcrime.securesms.crypto.storage.SignalProtocolStoreImpl;
|
||||
import org.thoughtcrime.securesms.jobs.AttachmentDownloadJob;
|
||||
import org.thoughtcrime.securesms.jobs.CleanPreKeysJob;
|
||||
import org.thoughtcrime.securesms.jobs.CreateSignedPreKeyJob;
|
||||
@ -23,11 +23,11 @@ import org.thoughtcrime.securesms.push.SecurityEventListener;
|
||||
import org.thoughtcrime.securesms.push.TextSecurePushTrustStore;
|
||||
import org.thoughtcrime.securesms.service.MessageRetrievalService;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.whispersystems.libaxolotl.util.guava.Optional;
|
||||
import org.whispersystems.textsecure.api.TextSecureAccountManager;
|
||||
import org.whispersystems.textsecure.api.TextSecureMessageReceiver;
|
||||
import org.whispersystems.textsecure.api.TextSecureMessageSender;
|
||||
import org.whispersystems.textsecure.api.util.CredentialsProvider;
|
||||
import org.whispersystems.libsignal.util.guava.Optional;
|
||||
import org.whispersystems.signalservice.api.SignalServiceAccountManager;
|
||||
import org.whispersystems.signalservice.api.SignalServiceMessageReceiver;
|
||||
import org.whispersystems.signalservice.api.SignalServiceMessageSender;
|
||||
import org.whispersystems.signalservice.api.util.CredentialsProvider;
|
||||
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
@ -56,38 +56,38 @@ public class TextSecureCommunicationModule {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
@Provides TextSecureAccountManager provideTextSecureAccountManager() {
|
||||
return new TextSecureAccountManager(BuildConfig.TEXTSECURE_URL,
|
||||
new TextSecurePushTrustStore(context),
|
||||
TextSecurePreferences.getLocalNumber(context),
|
||||
TextSecurePreferences.getPushServerPassword(context),
|
||||
BuildConfig.USER_AGENT);
|
||||
@Provides SignalServiceAccountManager provideTextSecureAccountManager() {
|
||||
return new SignalServiceAccountManager(BuildConfig.TEXTSECURE_URL,
|
||||
new TextSecurePushTrustStore(context),
|
||||
TextSecurePreferences.getLocalNumber(context),
|
||||
TextSecurePreferences.getPushServerPassword(context),
|
||||
BuildConfig.USER_AGENT);
|
||||
}
|
||||
|
||||
@Provides TextSecureMessageSenderFactory provideTextSecureMessageSenderFactory() {
|
||||
return new TextSecureMessageSenderFactory() {
|
||||
@Override
|
||||
public TextSecureMessageSender create() {
|
||||
return new TextSecureMessageSender(BuildConfig.TEXTSECURE_URL,
|
||||
new TextSecurePushTrustStore(context),
|
||||
TextSecurePreferences.getLocalNumber(context),
|
||||
TextSecurePreferences.getPushServerPassword(context),
|
||||
new TextSecureAxolotlStore(context),
|
||||
BuildConfig.USER_AGENT,
|
||||
Optional.<TextSecureMessageSender.EventListener>of(new SecurityEventListener(context)));
|
||||
public SignalServiceMessageSender create() {
|
||||
return new SignalServiceMessageSender(BuildConfig.TEXTSECURE_URL,
|
||||
new TextSecurePushTrustStore(context),
|
||||
TextSecurePreferences.getLocalNumber(context),
|
||||
TextSecurePreferences.getPushServerPassword(context),
|
||||
new SignalProtocolStoreImpl(context),
|
||||
BuildConfig.USER_AGENT,
|
||||
Optional.<SignalServiceMessageSender.EventListener>of(new SecurityEventListener(context)));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Provides TextSecureMessageReceiver provideTextSecureMessageReceiver() {
|
||||
return new TextSecureMessageReceiver(BuildConfig.TEXTSECURE_URL,
|
||||
@Provides SignalServiceMessageReceiver provideTextSecureMessageReceiver() {
|
||||
return new SignalServiceMessageReceiver(BuildConfig.TEXTSECURE_URL,
|
||||
new TextSecurePushTrustStore(context),
|
||||
new DynamicCredentialsProvider(context),
|
||||
BuildConfig.USER_AGENT);
|
||||
}
|
||||
|
||||
public static interface TextSecureMessageSenderFactory {
|
||||
public TextSecureMessageSender create();
|
||||
public SignalServiceMessageSender create();
|
||||
}
|
||||
|
||||
private static class DynamicCredentialsProvider implements CredentialsProvider {
|
||||
|
@ -24,8 +24,8 @@ import org.thoughtcrime.securesms.util.BitmapUtil;
|
||||
import org.thoughtcrime.securesms.util.GroupUtil;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
import org.whispersystems.textsecure.api.util.InvalidNumberException;
|
||||
import org.whispersystems.textsecure.internal.push.TextSecureProtos.GroupContext;
|
||||
import org.whispersystems.signalservice.api.util.InvalidNumberException;
|
||||
import org.whispersystems.signalservice.internal.push.SignalServiceProtos.GroupContext;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
|
@ -24,11 +24,11 @@ import org.thoughtcrime.securesms.sms.IncomingGroupMessage;
|
||||
import org.thoughtcrime.securesms.sms.IncomingTextMessage;
|
||||
import org.thoughtcrime.securesms.util.Base64;
|
||||
import org.thoughtcrime.securesms.util.GroupUtil;
|
||||
import org.whispersystems.libaxolotl.util.guava.Optional;
|
||||
import org.whispersystems.textsecure.api.messages.TextSecureAttachment;
|
||||
import org.whispersystems.textsecure.api.messages.TextSecureDataMessage;
|
||||
import org.whispersystems.textsecure.api.messages.TextSecureEnvelope;
|
||||
import org.whispersystems.textsecure.api.messages.TextSecureGroup;
|
||||
import org.whispersystems.libsignal.util.guava.Optional;
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceAttachment;
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceDataMessage;
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceEnvelope;
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceGroup;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
@ -38,8 +38,8 @@ import java.util.Set;
|
||||
import ws.com.google.android.mms.MmsException;
|
||||
|
||||
import static org.thoughtcrime.securesms.database.GroupDatabase.GroupRecord;
|
||||
import static org.whispersystems.textsecure.internal.push.TextSecureProtos.AttachmentPointer;
|
||||
import static org.whispersystems.textsecure.internal.push.TextSecureProtos.GroupContext;
|
||||
import static org.whispersystems.signalservice.internal.push.SignalServiceProtos.AttachmentPointer;
|
||||
import static org.whispersystems.signalservice.internal.push.SignalServiceProtos.GroupContext;
|
||||
|
||||
public class GroupMessageProcessor {
|
||||
|
||||
@ -47,8 +47,8 @@ public class GroupMessageProcessor {
|
||||
|
||||
public static @Nullable Long process(@NonNull Context context,
|
||||
@NonNull MasterSecretUnion masterSecret,
|
||||
@NonNull TextSecureEnvelope envelope,
|
||||
@NonNull TextSecureDataMessage message,
|
||||
@NonNull SignalServiceEnvelope envelope,
|
||||
@NonNull SignalServiceDataMessage message,
|
||||
boolean outgoing)
|
||||
{
|
||||
if (!message.getGroupInfo().isPresent() || message.getGroupInfo().get().getGroupId() == null) {
|
||||
@ -56,16 +56,16 @@ public class GroupMessageProcessor {
|
||||
return null;
|
||||
}
|
||||
|
||||
GroupDatabase database = DatabaseFactory.getGroupDatabase(context);
|
||||
TextSecureGroup group = message.getGroupInfo().get();
|
||||
byte[] id = group.getGroupId();
|
||||
GroupRecord record = database.getGroup(id);
|
||||
GroupDatabase database = DatabaseFactory.getGroupDatabase(context);
|
||||
SignalServiceGroup group = message.getGroupInfo().get();
|
||||
byte[] id = group.getGroupId();
|
||||
GroupRecord record = database.getGroup(id);
|
||||
|
||||
if (record != null && group.getType() == TextSecureGroup.Type.UPDATE) {
|
||||
if (record != null && group.getType() == SignalServiceGroup.Type.UPDATE) {
|
||||
return handleGroupUpdate(context, masterSecret, envelope, group, record, outgoing);
|
||||
} else if (record == null && group.getType() == TextSecureGroup.Type.UPDATE) {
|
||||
} else if (record == null && group.getType() == SignalServiceGroup.Type.UPDATE) {
|
||||
return handleGroupCreate(context, masterSecret, envelope, group, outgoing);
|
||||
} else if (record != null && group.getType() == TextSecureGroup.Type.QUIT) {
|
||||
} else if (record != null && group.getType() == SignalServiceGroup.Type.QUIT) {
|
||||
return handleGroupLeave(context, masterSecret, envelope, group, record, outgoing);
|
||||
} else {
|
||||
Log.w(TAG, "Received unknown type, ignoring...");
|
||||
@ -75,8 +75,8 @@ public class GroupMessageProcessor {
|
||||
|
||||
private static @Nullable Long handleGroupCreate(@NonNull Context context,
|
||||
@NonNull MasterSecretUnion masterSecret,
|
||||
@NonNull TextSecureEnvelope envelope,
|
||||
@NonNull TextSecureGroup group,
|
||||
@NonNull SignalServiceEnvelope envelope,
|
||||
@NonNull SignalServiceGroup group,
|
||||
boolean outgoing)
|
||||
{
|
||||
GroupDatabase database = DatabaseFactory.getGroupDatabase(context);
|
||||
@ -84,7 +84,7 @@ public class GroupMessageProcessor {
|
||||
GroupContext.Builder builder = createGroupContext(group);
|
||||
builder.setType(GroupContext.Type.UPDATE);
|
||||
|
||||
TextSecureAttachment avatar = group.getAvatar().orNull();
|
||||
SignalServiceAttachment avatar = group.getAvatar().orNull();
|
||||
|
||||
database.create(id, group.getName().orNull(), group.getMembers().orNull(),
|
||||
avatar != null && avatar.isPointer() ? avatar.asPointer() : null,
|
||||
@ -95,8 +95,8 @@ public class GroupMessageProcessor {
|
||||
|
||||
private static @Nullable Long handleGroupUpdate(@NonNull Context context,
|
||||
@NonNull MasterSecretUnion masterSecret,
|
||||
@NonNull TextSecureEnvelope envelope,
|
||||
@NonNull TextSecureGroup group,
|
||||
@NonNull SignalServiceEnvelope envelope,
|
||||
@NonNull SignalServiceGroup group,
|
||||
@NonNull GroupRecord groupRecord,
|
||||
boolean outgoing)
|
||||
{
|
||||
@ -131,7 +131,7 @@ public class GroupMessageProcessor {
|
||||
}
|
||||
|
||||
if (group.getName().isPresent() || group.getAvatar().isPresent()) {
|
||||
TextSecureAttachment avatar = group.getAvatar().orNull();
|
||||
SignalServiceAttachment avatar = group.getAvatar().orNull();
|
||||
database.update(id, group.getName().orNull(), avatar != null ? avatar.asPointer() : null);
|
||||
}
|
||||
|
||||
@ -144,11 +144,11 @@ public class GroupMessageProcessor {
|
||||
return storeMessage(context, masterSecret, envelope, group, builder.build(), outgoing);
|
||||
}
|
||||
|
||||
private static Long handleGroupLeave(@NonNull Context context,
|
||||
@NonNull MasterSecretUnion masterSecret,
|
||||
@NonNull TextSecureEnvelope envelope,
|
||||
@NonNull TextSecureGroup group,
|
||||
@NonNull GroupRecord record,
|
||||
private static Long handleGroupLeave(@NonNull Context context,
|
||||
@NonNull MasterSecretUnion masterSecret,
|
||||
@NonNull SignalServiceEnvelope envelope,
|
||||
@NonNull SignalServiceGroup group,
|
||||
@NonNull GroupRecord record,
|
||||
boolean outgoing)
|
||||
{
|
||||
GroupDatabase database = DatabaseFactory.getGroupDatabase(context);
|
||||
@ -171,8 +171,8 @@ public class GroupMessageProcessor {
|
||||
|
||||
private static @Nullable Long storeMessage(@NonNull Context context,
|
||||
@NonNull MasterSecretUnion masterSecret,
|
||||
@NonNull TextSecureEnvelope envelope,
|
||||
@NonNull TextSecureGroup group,
|
||||
@NonNull SignalServiceEnvelope envelope,
|
||||
@NonNull SignalServiceGroup group,
|
||||
@NonNull GroupContext storage,
|
||||
boolean outgoing)
|
||||
{
|
||||
@ -210,7 +210,7 @@ public class GroupMessageProcessor {
|
||||
return null;
|
||||
}
|
||||
|
||||
private static GroupContext.Builder createGroupContext(TextSecureGroup group) {
|
||||
private static GroupContext.Builder createGroupContext(SignalServiceGroup group) {
|
||||
GroupContext.Builder builder = GroupContext.newBuilder();
|
||||
builder.setId(ByteString.copyFrom(group.getGroupId()));
|
||||
|
||||
|
@ -20,12 +20,12 @@ import org.thoughtcrime.securesms.notifications.MessageNotifier;
|
||||
import org.thoughtcrime.securesms.util.VisibleForTesting;
|
||||
import org.whispersystems.jobqueue.JobParameters;
|
||||
import org.whispersystems.jobqueue.requirements.NetworkRequirement;
|
||||
import org.whispersystems.libaxolotl.InvalidMessageException;
|
||||
import org.whispersystems.textsecure.api.TextSecureMessageReceiver;
|
||||
import org.whispersystems.textsecure.api.messages.TextSecureAttachment.ProgressListener;
|
||||
import org.whispersystems.textsecure.api.messages.TextSecureAttachmentPointer;
|
||||
import org.whispersystems.textsecure.api.push.exceptions.NonSuccessfulResponseCodeException;
|
||||
import org.whispersystems.textsecure.api.push.exceptions.PushNetworkException;
|
||||
import org.whispersystems.libsignal.InvalidMessageException;
|
||||
import org.whispersystems.signalservice.api.SignalServiceMessageReceiver;
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceAttachment.ProgressListener;
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceAttachmentPointer;
|
||||
import org.whispersystems.signalservice.api.push.exceptions.NonSuccessfulResponseCodeException;
|
||||
import org.whispersystems.signalservice.api.push.exceptions.PushNetworkException;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@ -40,7 +40,7 @@ public class AttachmentDownloadJob extends MasterSecretJob implements Injectable
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final String TAG = AttachmentDownloadJob.class.getSimpleName();
|
||||
|
||||
@Inject transient TextSecureMessageReceiver messageReceiver;
|
||||
@Inject transient SignalServiceMessageReceiver messageReceiver;
|
||||
|
||||
private final long messageId;
|
||||
private final long partRowId;
|
||||
@ -109,8 +109,8 @@ public class AttachmentDownloadJob extends MasterSecretJob implements Injectable
|
||||
try {
|
||||
attachmentFile = createTempFile();
|
||||
|
||||
TextSecureAttachmentPointer pointer = createAttachmentPointer(masterSecret, attachment);
|
||||
InputStream stream = messageReceiver.retrieveAttachment(pointer, attachmentFile, new ProgressListener() {
|
||||
SignalServiceAttachmentPointer pointer = createAttachmentPointer(masterSecret, attachment);
|
||||
InputStream stream = messageReceiver.retrieveAttachment(pointer, attachmentFile, new ProgressListener() {
|
||||
@Override
|
||||
public void onAttachmentProgress(long total, long progress) {
|
||||
EventBus.getDefault().postSticky(new PartProgressEvent(attachment, total, progress));
|
||||
@ -128,7 +128,7 @@ public class AttachmentDownloadJob extends MasterSecretJob implements Injectable
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
TextSecureAttachmentPointer createAttachmentPointer(MasterSecret masterSecret, Attachment attachment)
|
||||
SignalServiceAttachmentPointer createAttachmentPointer(MasterSecret masterSecret, Attachment attachment)
|
||||
throws InvalidPartException
|
||||
{
|
||||
if (TextUtils.isEmpty(attachment.getLocation())) {
|
||||
@ -149,7 +149,7 @@ public class AttachmentDownloadJob extends MasterSecretJob implements Injectable
|
||||
relay = attachment.getRelay();
|
||||
}
|
||||
|
||||
return new TextSecureAttachmentPointer(id, null, key, relay);
|
||||
return new SignalServiceAttachmentPointer(id, null, key, relay);
|
||||
} catch (InvalidMessageException | IOException e) {
|
||||
Log.w(TAG, e);
|
||||
throw new InvalidPartException(e);
|
||||
|
@ -16,9 +16,9 @@ import org.thoughtcrime.securesms.util.BitmapUtil;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.whispersystems.jobqueue.JobParameters;
|
||||
import org.whispersystems.jobqueue.requirements.NetworkRequirement;
|
||||
import org.whispersystems.textsecure.api.push.exceptions.NonSuccessfulResponseCodeException;
|
||||
import org.whispersystems.textsecure.internal.push.PushServiceSocket;
|
||||
import org.whispersystems.textsecure.internal.util.StaticCredentialsProvider;
|
||||
import org.whispersystems.signalservice.api.push.exceptions.NonSuccessfulResponseCodeException;
|
||||
import org.whispersystems.signalservice.internal.push.PushServiceSocket;
|
||||
import org.whispersystems.signalservice.internal.util.StaticCredentialsProvider;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
@ -7,13 +7,13 @@ import org.thoughtcrime.securesms.crypto.MasterSecret;
|
||||
import org.thoughtcrime.securesms.dependencies.InjectableType;
|
||||
import org.thoughtcrime.securesms.jobs.requirements.MasterSecretRequirement;
|
||||
import org.whispersystems.jobqueue.JobParameters;
|
||||
import org.whispersystems.libaxolotl.InvalidKeyIdException;
|
||||
import org.whispersystems.libaxolotl.state.SignedPreKeyRecord;
|
||||
import org.whispersystems.libaxolotl.state.SignedPreKeyStore;
|
||||
import org.whispersystems.textsecure.api.TextSecureAccountManager;
|
||||
import org.whispersystems.textsecure.api.push.SignedPreKeyEntity;
|
||||
import org.whispersystems.textsecure.api.push.exceptions.NonSuccessfulResponseCodeException;
|
||||
import org.whispersystems.textsecure.api.push.exceptions.PushNetworkException;
|
||||
import org.whispersystems.libsignal.InvalidKeyIdException;
|
||||
import org.whispersystems.libsignal.state.SignedPreKeyRecord;
|
||||
import org.whispersystems.libsignal.state.SignedPreKeyStore;
|
||||
import org.whispersystems.signalservice.api.SignalServiceAccountManager;
|
||||
import org.whispersystems.signalservice.api.push.SignedPreKeyEntity;
|
||||
import org.whispersystems.signalservice.api.push.exceptions.NonSuccessfulResponseCodeException;
|
||||
import org.whispersystems.signalservice.api.push.exceptions.PushNetworkException;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
@ -32,7 +32,7 @@ public class CleanPreKeysJob extends MasterSecretJob implements InjectableType {
|
||||
|
||||
private static final int ARCHIVE_AGE_DAYS = 15;
|
||||
|
||||
@Inject transient TextSecureAccountManager accountManager;
|
||||
@Inject transient SignalServiceAccountManager accountManager;
|
||||
@Inject transient SignedPreKeyStoreFactory signedPreKeyStoreFactory;
|
||||
|
||||
public CleanPreKeysJob(Context context) {
|
||||
|
@ -11,10 +11,10 @@ import org.thoughtcrime.securesms.jobs.requirements.MasterSecretRequirement;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.whispersystems.jobqueue.JobParameters;
|
||||
import org.whispersystems.jobqueue.requirements.NetworkRequirement;
|
||||
import org.whispersystems.libaxolotl.IdentityKeyPair;
|
||||
import org.whispersystems.libaxolotl.state.SignedPreKeyRecord;
|
||||
import org.whispersystems.textsecure.api.TextSecureAccountManager;
|
||||
import org.whispersystems.textsecure.api.push.exceptions.PushNetworkException;
|
||||
import org.whispersystems.libsignal.IdentityKeyPair;
|
||||
import org.whispersystems.libsignal.state.SignedPreKeyRecord;
|
||||
import org.whispersystems.signalservice.api.SignalServiceAccountManager;
|
||||
import org.whispersystems.signalservice.api.push.exceptions.PushNetworkException;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@ -26,7 +26,7 @@ public class CreateSignedPreKeyJob extends MasterSecretJob implements Injectable
|
||||
|
||||
private static final String TAG = CreateSignedPreKeyJob.class.getSimpleName();
|
||||
|
||||
@Inject transient TextSecureAccountManager accountManager;
|
||||
@Inject transient SignalServiceAccountManager accountManager;
|
||||
|
||||
public CreateSignedPreKeyJob(Context context) {
|
||||
super(context, JobParameters.newBuilder()
|
||||
|
@ -7,11 +7,11 @@ import android.util.Log;
|
||||
import org.thoughtcrime.securesms.dependencies.InjectableType;
|
||||
import org.whispersystems.jobqueue.JobParameters;
|
||||
import org.whispersystems.jobqueue.requirements.NetworkRequirement;
|
||||
import org.whispersystems.libaxolotl.util.guava.Optional;
|
||||
import org.whispersystems.textsecure.api.TextSecureMessageSender;
|
||||
import org.whispersystems.textsecure.api.push.TextSecureAddress;
|
||||
import org.whispersystems.textsecure.api.push.exceptions.NonSuccessfulResponseCodeException;
|
||||
import org.whispersystems.textsecure.api.push.exceptions.PushNetworkException;
|
||||
import org.whispersystems.libsignal.util.guava.Optional;
|
||||
import org.whispersystems.signalservice.api.SignalServiceMessageSender;
|
||||
import org.whispersystems.signalservice.api.push.SignalServiceAddress;
|
||||
import org.whispersystems.signalservice.api.push.exceptions.NonSuccessfulResponseCodeException;
|
||||
import org.whispersystems.signalservice.api.push.exceptions.PushNetworkException;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@ -47,8 +47,8 @@ public class DeliveryReceiptJob extends ContextJob implements InjectableType {
|
||||
@Override
|
||||
public void onRun() throws IOException {
|
||||
Log.w("DeliveryReceiptJob", "Sending delivery receipt...");
|
||||
TextSecureMessageSender messageSender = messageSenderFactory.create();
|
||||
TextSecureAddress textSecureAddress = new TextSecureAddress(destination, Optional.fromNullable(relay));
|
||||
SignalServiceMessageSender messageSender = messageSenderFactory.create();
|
||||
SignalServiceAddress textSecureAddress = new SignalServiceAddress(destination, Optional.fromNullable(relay));
|
||||
|
||||
messageSender.sendDeliveryReceipt(textSecureAddress, timestamp);
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ import org.thoughtcrime.securesms.util.DirectoryHelper;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.whispersystems.jobqueue.JobParameters;
|
||||
import org.whispersystems.jobqueue.requirements.NetworkRequirement;
|
||||
import org.whispersystems.textsecure.api.push.exceptions.PushNetworkException;
|
||||
import org.whispersystems.signalservice.api.push.exceptions.PushNetworkException;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
@ -36,9 +36,9 @@ import org.thoughtcrime.securesms.dependencies.InjectableType;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.whispersystems.jobqueue.JobParameters;
|
||||
import org.whispersystems.jobqueue.requirements.NetworkRequirement;
|
||||
import org.whispersystems.libaxolotl.util.guava.Optional;
|
||||
import org.whispersystems.textsecure.api.TextSecureAccountManager;
|
||||
import org.whispersystems.textsecure.api.push.exceptions.NonSuccessfulResponseCodeException;
|
||||
import org.whispersystems.libsignal.util.guava.Optional;
|
||||
import org.whispersystems.signalservice.api.SignalServiceAccountManager;
|
||||
import org.whispersystems.signalservice.api.push.exceptions.NonSuccessfulResponseCodeException;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
@ -48,8 +48,8 @@ public class GcmRefreshJob extends ContextJob implements InjectableType {
|
||||
|
||||
public static final String REGISTRATION_ID = "312334754206";
|
||||
|
||||
@Inject transient TextSecureAccountManager textSecureAccountManager;
|
||||
@Inject transient RedPhoneAccountManager redPhoneAccountManager;
|
||||
@Inject transient SignalServiceAccountManager textSecureAccountManager;
|
||||
@Inject transient RedPhoneAccountManager redPhoneAccountManager;
|
||||
|
||||
public GcmRefreshJob(Context context) {
|
||||
super(context, JobParameters.newBuilder().withRequirement(new NetworkRequirement(context)).create());
|
||||
|
@ -18,7 +18,7 @@ import org.thoughtcrime.securesms.database.model.SmsMessageRecord;
|
||||
import org.thoughtcrime.securesms.jobs.requirements.MasterSecretRequirement;
|
||||
import org.thoughtcrime.securesms.notifications.MessageNotifier;
|
||||
import org.whispersystems.jobqueue.JobParameters;
|
||||
import org.whispersystems.libaxolotl.InvalidMessageException;
|
||||
import org.whispersystems.libsignal.InvalidMessageException;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
@ -24,11 +24,11 @@ import org.thoughtcrime.securesms.service.KeyCachingService;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
import org.whispersystems.jobqueue.JobParameters;
|
||||
import org.whispersystems.jobqueue.requirements.NetworkRequirement;
|
||||
import org.whispersystems.libaxolotl.DuplicateMessageException;
|
||||
import org.whispersystems.libaxolotl.InvalidMessageException;
|
||||
import org.whispersystems.libaxolotl.LegacyMessageException;
|
||||
import org.whispersystems.libaxolotl.NoSessionException;
|
||||
import org.whispersystems.libaxolotl.util.guava.Optional;
|
||||
import org.whispersystems.libsignal.DuplicateMessageException;
|
||||
import org.whispersystems.libsignal.InvalidMessageException;
|
||||
import org.whispersystems.libsignal.LegacyMessageException;
|
||||
import org.whispersystems.libsignal.NoSessionException;
|
||||
import org.whispersystems.libsignal.util.guava.Optional;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.LinkedList;
|
||||
|
@ -14,26 +14,23 @@ import org.thoughtcrime.securesms.crypto.MasterSecret;
|
||||
import org.thoughtcrime.securesms.dependencies.InjectableType;
|
||||
import org.thoughtcrime.securesms.dependencies.TextSecureCommunicationModule.TextSecureMessageSenderFactory;
|
||||
import org.thoughtcrime.securesms.jobs.requirements.MasterSecretRequirement;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
import org.whispersystems.jobqueue.JobParameters;
|
||||
import org.whispersystems.jobqueue.requirements.NetworkRequirement;
|
||||
import org.whispersystems.libaxolotl.util.guava.Optional;
|
||||
import org.whispersystems.textsecure.api.TextSecureMessageSender;
|
||||
import org.whispersystems.textsecure.api.crypto.UntrustedIdentityException;
|
||||
import org.whispersystems.textsecure.api.messages.TextSecureAttachment;
|
||||
import org.whispersystems.textsecure.api.messages.TextSecureAttachmentStream;
|
||||
import org.whispersystems.textsecure.api.messages.multidevice.DeviceContact;
|
||||
import org.whispersystems.textsecure.api.messages.multidevice.DeviceContactsOutputStream;
|
||||
import org.whispersystems.textsecure.api.messages.multidevice.TextSecureSyncMessage;
|
||||
import org.whispersystems.textsecure.api.push.exceptions.PushNetworkException;
|
||||
import org.whispersystems.libsignal.util.guava.Optional;
|
||||
import org.whispersystems.signalservice.api.SignalServiceMessageSender;
|
||||
import org.whispersystems.signalservice.api.crypto.UntrustedIdentityException;
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceAttachment;
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceAttachmentStream;
|
||||
import org.whispersystems.signalservice.api.messages.multidevice.DeviceContact;
|
||||
import org.whispersystems.signalservice.api.messages.multidevice.DeviceContactsOutputStream;
|
||||
import org.whispersystems.signalservice.api.messages.multidevice.SignalServiceSyncMessage;
|
||||
import org.whispersystems.signalservice.api.push.exceptions.PushNetworkException;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Collection;
|
||||
|
||||
import javax.inject.Inject;
|
||||
@ -59,8 +56,8 @@ public class MultiDeviceContactUpdateJob extends MasterSecretJob implements Inje
|
||||
public void onRun(MasterSecret masterSecret)
|
||||
throws IOException, UntrustedIdentityException, NetworkException
|
||||
{
|
||||
TextSecureMessageSender messageSender = messageSenderFactory.create();
|
||||
File contactDataFile = createTempFile("multidevice-contact-update");
|
||||
SignalServiceMessageSender messageSender = messageSenderFactory.create();
|
||||
File contactDataFile = createTempFile("multidevice-contact-update");
|
||||
|
||||
try {
|
||||
DeviceContactsOutputStream out = new DeviceContactsOutputStream(new FileOutputStream(contactDataFile));
|
||||
@ -98,36 +95,36 @@ public class MultiDeviceContactUpdateJob extends MasterSecretJob implements Inje
|
||||
|
||||
}
|
||||
|
||||
private void sendUpdate(TextSecureMessageSender messageSender, File contactsFile)
|
||||
private void sendUpdate(SignalServiceMessageSender messageSender, File contactsFile)
|
||||
throws IOException, UntrustedIdentityException, NetworkException
|
||||
{
|
||||
if (contactsFile.length() > 0) {
|
||||
FileInputStream contactsFileStream = new FileInputStream(contactsFile);
|
||||
TextSecureAttachmentStream attachmentStream = TextSecureAttachment.newStreamBuilder()
|
||||
.withStream(contactsFileStream)
|
||||
.withContentType("application/octet-stream")
|
||||
.withLength(contactsFile.length())
|
||||
.build();
|
||||
FileInputStream contactsFileStream = new FileInputStream(contactsFile);
|
||||
SignalServiceAttachmentStream attachmentStream = SignalServiceAttachment.newStreamBuilder()
|
||||
.withStream(contactsFileStream)
|
||||
.withContentType("application/octet-stream")
|
||||
.withLength(contactsFile.length())
|
||||
.build();
|
||||
|
||||
try {
|
||||
messageSender.sendMessage(TextSecureSyncMessage.forContacts(attachmentStream));
|
||||
messageSender.sendMessage(SignalServiceSyncMessage.forContacts(attachmentStream));
|
||||
} catch (IOException ioe) {
|
||||
throw new NetworkException(ioe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Optional<TextSecureAttachmentStream> getAvatar(Uri uri) throws IOException {
|
||||
private Optional<SignalServiceAttachmentStream> getAvatar(Uri uri) throws IOException {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
|
||||
try {
|
||||
Uri displayPhotoUri = Uri.withAppendedPath(uri, ContactsContract.Contacts.Photo.DISPLAY_PHOTO);
|
||||
AssetFileDescriptor fd = context.getContentResolver().openAssetFileDescriptor(displayPhotoUri, "r");
|
||||
|
||||
return Optional.of(TextSecureAttachment.newStreamBuilder()
|
||||
.withStream(fd.createInputStream())
|
||||
.withContentType("image/*")
|
||||
.withLength(fd.getLength())
|
||||
.build());
|
||||
return Optional.of(SignalServiceAttachment.newStreamBuilder()
|
||||
.withStream(fd.createInputStream())
|
||||
.withContentType("image/*")
|
||||
.withLength(fd.getLength())
|
||||
.build());
|
||||
} catch (IOException e) {
|
||||
Log.w(TAG, e);
|
||||
}
|
||||
@ -150,11 +147,11 @@ public class MultiDeviceContactUpdateJob extends MasterSecretJob implements Inje
|
||||
byte[] data = cursor.getBlob(0);
|
||||
|
||||
if (data != null) {
|
||||
return Optional.of(TextSecureAttachment.newStreamBuilder()
|
||||
.withStream(new ByteArrayInputStream(data))
|
||||
.withContentType("image/*")
|
||||
.withLength(data.length)
|
||||
.build());
|
||||
return Optional.of(SignalServiceAttachment.newStreamBuilder()
|
||||
.withStream(new ByteArrayInputStream(data))
|
||||
.withContentType("image/*")
|
||||
.withLength(data.length)
|
||||
.build());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -12,15 +12,15 @@ import org.thoughtcrime.securesms.dependencies.TextSecureCommunicationModule;
|
||||
import org.thoughtcrime.securesms.jobs.requirements.MasterSecretRequirement;
|
||||
import org.whispersystems.jobqueue.JobParameters;
|
||||
import org.whispersystems.jobqueue.requirements.NetworkRequirement;
|
||||
import org.whispersystems.libaxolotl.util.guava.Optional;
|
||||
import org.whispersystems.textsecure.api.TextSecureMessageSender;
|
||||
import org.whispersystems.textsecure.api.crypto.UntrustedIdentityException;
|
||||
import org.whispersystems.textsecure.api.messages.TextSecureAttachment;
|
||||
import org.whispersystems.textsecure.api.messages.TextSecureAttachmentStream;
|
||||
import org.whispersystems.textsecure.api.messages.multidevice.DeviceGroup;
|
||||
import org.whispersystems.textsecure.api.messages.multidevice.DeviceGroupsOutputStream;
|
||||
import org.whispersystems.textsecure.api.messages.multidevice.TextSecureSyncMessage;
|
||||
import org.whispersystems.textsecure.api.push.exceptions.PushNetworkException;
|
||||
import org.whispersystems.libsignal.util.guava.Optional;
|
||||
import org.whispersystems.signalservice.api.SignalServiceMessageSender;
|
||||
import org.whispersystems.signalservice.api.crypto.UntrustedIdentityException;
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceAttachment;
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceAttachmentStream;
|
||||
import org.whispersystems.signalservice.api.messages.multidevice.DeviceGroup;
|
||||
import org.whispersystems.signalservice.api.messages.multidevice.DeviceGroupsOutputStream;
|
||||
import org.whispersystems.signalservice.api.messages.multidevice.SignalServiceSyncMessage;
|
||||
import org.whispersystems.signalservice.api.push.exceptions.PushNetworkException;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.File;
|
||||
@ -49,9 +49,9 @@ public class MultiDeviceGroupUpdateJob extends MasterSecretJob implements Inject
|
||||
|
||||
@Override
|
||||
public void onRun(MasterSecret masterSecret) throws Exception {
|
||||
TextSecureMessageSender messageSender = messageSenderFactory.create();
|
||||
File contactDataFile = createTempFile("multidevice-contact-update");
|
||||
GroupDatabase.Reader reader = null;
|
||||
SignalServiceMessageSender messageSender = messageSenderFactory.create();
|
||||
File contactDataFile = createTempFile("multidevice-contact-update");
|
||||
GroupDatabase.Reader reader = null;
|
||||
|
||||
GroupDatabase.GroupRecord record;
|
||||
|
||||
@ -97,28 +97,28 @@ public class MultiDeviceGroupUpdateJob extends MasterSecretJob implements Inject
|
||||
|
||||
}
|
||||
|
||||
private void sendUpdate(TextSecureMessageSender messageSender, File contactsFile)
|
||||
private void sendUpdate(SignalServiceMessageSender messageSender, File contactsFile)
|
||||
throws IOException, UntrustedIdentityException
|
||||
{
|
||||
FileInputStream contactsFileStream = new FileInputStream(contactsFile);
|
||||
TextSecureAttachmentStream attachmentStream = TextSecureAttachment.newStreamBuilder()
|
||||
.withStream(contactsFileStream)
|
||||
.withContentType("application/octet-stream")
|
||||
.withLength(contactsFile.length())
|
||||
.build();
|
||||
FileInputStream contactsFileStream = new FileInputStream(contactsFile);
|
||||
SignalServiceAttachmentStream attachmentStream = SignalServiceAttachment.newStreamBuilder()
|
||||
.withStream(contactsFileStream)
|
||||
.withContentType("application/octet-stream")
|
||||
.withLength(contactsFile.length())
|
||||
.build();
|
||||
|
||||
messageSender.sendMessage(TextSecureSyncMessage.forGroups(attachmentStream));
|
||||
messageSender.sendMessage(SignalServiceSyncMessage.forGroups(attachmentStream));
|
||||
}
|
||||
|
||||
|
||||
private Optional<TextSecureAttachmentStream> getAvatar(@Nullable byte[] avatar) {
|
||||
private Optional<SignalServiceAttachmentStream> getAvatar(@Nullable byte[] avatar) {
|
||||
if (avatar == null) return Optional.absent();
|
||||
|
||||
return Optional.of(TextSecureAttachment.newStreamBuilder()
|
||||
.withStream(new ByteArrayInputStream(avatar))
|
||||
.withContentType("image/*")
|
||||
.withLength(avatar.length)
|
||||
.build());
|
||||
return Optional.of(SignalServiceAttachment.newStreamBuilder()
|
||||
.withStream(new ByteArrayInputStream(avatar))
|
||||
.withContentType("image/*")
|
||||
.withLength(avatar.length)
|
||||
.build());
|
||||
}
|
||||
|
||||
private File createTempFile(String prefix) throws IOException {
|
||||
|
@ -9,11 +9,11 @@ import org.thoughtcrime.securesms.dependencies.TextSecureCommunicationModule;
|
||||
import org.thoughtcrime.securesms.jobs.requirements.MasterSecretRequirement;
|
||||
import org.whispersystems.jobqueue.JobParameters;
|
||||
import org.whispersystems.jobqueue.requirements.NetworkRequirement;
|
||||
import org.whispersystems.textsecure.api.TextSecureMessageSender;
|
||||
import org.whispersystems.textsecure.api.crypto.UntrustedIdentityException;
|
||||
import org.whispersystems.textsecure.api.messages.multidevice.ReadMessage;
|
||||
import org.whispersystems.textsecure.api.messages.multidevice.TextSecureSyncMessage;
|
||||
import org.whispersystems.textsecure.api.push.exceptions.PushNetworkException;
|
||||
import org.whispersystems.signalservice.api.SignalServiceMessageSender;
|
||||
import org.whispersystems.signalservice.api.crypto.UntrustedIdentityException;
|
||||
import org.whispersystems.signalservice.api.messages.multidevice.ReadMessage;
|
||||
import org.whispersystems.signalservice.api.messages.multidevice.SignalServiceSyncMessage;
|
||||
import org.whispersystems.signalservice.api.push.exceptions.PushNetworkException;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
@ -55,8 +55,8 @@ public class MultiDeviceReadUpdateJob extends MasterSecretJob implements Injecta
|
||||
readMessages.add(new ReadMessage(messageId.sender, messageId.timestamp));
|
||||
}
|
||||
|
||||
TextSecureMessageSender messageSender = messageSenderFactory.create();
|
||||
messageSender.sendMessage(TextSecureSyncMessage.forRead(readMessages));
|
||||
SignalServiceMessageSender messageSender = messageSenderFactory.create();
|
||||
messageSender.sendMessage(SignalServiceSyncMessage.forRead(readMessages));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -8,11 +8,11 @@ import org.thoughtcrime.securesms.database.DatabaseFactory;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.whispersystems.jobqueue.JobManager;
|
||||
import org.whispersystems.jobqueue.JobParameters;
|
||||
import org.whispersystems.libaxolotl.InvalidVersionException;
|
||||
import org.whispersystems.textsecure.api.messages.TextSecureEnvelope;
|
||||
import org.whispersystems.libsignal.InvalidVersionException;
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceEnvelope;
|
||||
import org.thoughtcrime.securesms.database.TextSecureDirectory;
|
||||
import org.thoughtcrime.securesms.database.NotInDirectoryException;
|
||||
import org.whispersystems.textsecure.api.push.ContactTokenDetails;
|
||||
import org.whispersystems.signalservice.api.push.ContactTokenDetails;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@ -42,8 +42,8 @@ public class PushContentReceiveJob extends PushReceivedJob {
|
||||
@Override
|
||||
public void onRun() {
|
||||
try {
|
||||
String sessionKey = TextSecurePreferences.getSignalingKey(context);
|
||||
TextSecureEnvelope envelope = new TextSecureEnvelope(data, sessionKey);
|
||||
String sessionKey = TextSecurePreferences.getSignalingKey(context);
|
||||
SignalServiceEnvelope envelope = new SignalServiceEnvelope(data, sessionKey);
|
||||
|
||||
handle(envelope, true);
|
||||
} catch (IOException | InvalidVersionException e) {
|
||||
|
@ -13,11 +13,10 @@ import org.thoughtcrime.securesms.crypto.MasterSecret;
|
||||
import org.thoughtcrime.securesms.crypto.MasterSecretUnion;
|
||||
import org.thoughtcrime.securesms.crypto.MasterSecretUtil;
|
||||
import org.thoughtcrime.securesms.crypto.SecurityEvent;
|
||||
import org.thoughtcrime.securesms.crypto.storage.TextSecureAxolotlStore;
|
||||
import org.thoughtcrime.securesms.crypto.storage.SignalProtocolStoreImpl;
|
||||
import org.thoughtcrime.securesms.crypto.storage.TextSecureSessionStore;
|
||||
import org.thoughtcrime.securesms.database.DatabaseFactory;
|
||||
import org.thoughtcrime.securesms.database.EncryptingSmsDatabase;
|
||||
import org.thoughtcrime.securesms.database.MessagingDatabase;
|
||||
import org.thoughtcrime.securesms.database.MessagingDatabase.SyncMessageId;
|
||||
import org.thoughtcrime.securesms.database.MmsDatabase;
|
||||
import org.thoughtcrime.securesms.database.NoSuchMessageException;
|
||||
@ -40,29 +39,29 @@ import org.thoughtcrime.securesms.util.Base64;
|
||||
import org.thoughtcrime.securesms.util.GroupUtil;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.whispersystems.jobqueue.JobParameters;
|
||||
import org.whispersystems.libaxolotl.DuplicateMessageException;
|
||||
import org.whispersystems.libaxolotl.IdentityKey;
|
||||
import org.whispersystems.libaxolotl.InvalidKeyException;
|
||||
import org.whispersystems.libaxolotl.InvalidKeyIdException;
|
||||
import org.whispersystems.libaxolotl.InvalidMessageException;
|
||||
import org.whispersystems.libaxolotl.InvalidVersionException;
|
||||
import org.whispersystems.libaxolotl.LegacyMessageException;
|
||||
import org.whispersystems.libaxolotl.NoSessionException;
|
||||
import org.whispersystems.libaxolotl.UntrustedIdentityException;
|
||||
import org.whispersystems.libaxolotl.protocol.PreKeyWhisperMessage;
|
||||
import org.whispersystems.libaxolotl.state.AxolotlStore;
|
||||
import org.whispersystems.libaxolotl.state.SessionStore;
|
||||
import org.whispersystems.libaxolotl.util.guava.Optional;
|
||||
import org.whispersystems.textsecure.api.crypto.TextSecureCipher;
|
||||
import org.whispersystems.textsecure.api.messages.TextSecureContent;
|
||||
import org.whispersystems.textsecure.api.messages.TextSecureDataMessage;
|
||||
import org.whispersystems.textsecure.api.messages.TextSecureEnvelope;
|
||||
import org.whispersystems.textsecure.api.messages.TextSecureGroup;
|
||||
import org.whispersystems.textsecure.api.messages.multidevice.ReadMessage;
|
||||
import org.whispersystems.textsecure.api.messages.multidevice.RequestMessage;
|
||||
import org.whispersystems.textsecure.api.messages.multidevice.SentTranscriptMessage;
|
||||
import org.whispersystems.textsecure.api.messages.multidevice.TextSecureSyncMessage;
|
||||
import org.whispersystems.textsecure.api.push.TextSecureAddress;
|
||||
import org.whispersystems.libsignal.DuplicateMessageException;
|
||||
import org.whispersystems.libsignal.IdentityKey;
|
||||
import org.whispersystems.libsignal.InvalidKeyException;
|
||||
import org.whispersystems.libsignal.InvalidKeyIdException;
|
||||
import org.whispersystems.libsignal.InvalidMessageException;
|
||||
import org.whispersystems.libsignal.InvalidVersionException;
|
||||
import org.whispersystems.libsignal.LegacyMessageException;
|
||||
import org.whispersystems.libsignal.NoSessionException;
|
||||
import org.whispersystems.libsignal.UntrustedIdentityException;
|
||||
import org.whispersystems.libsignal.protocol.PreKeySignalMessage;
|
||||
import org.whispersystems.libsignal.state.SignalProtocolStore;
|
||||
import org.whispersystems.libsignal.state.SessionStore;
|
||||
import org.whispersystems.libsignal.util.guava.Optional;
|
||||
import org.whispersystems.signalservice.api.crypto.SignalServiceCipher;
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceContent;
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceDataMessage;
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceEnvelope;
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceGroup;
|
||||
import org.whispersystems.signalservice.api.messages.multidevice.ReadMessage;
|
||||
import org.whispersystems.signalservice.api.messages.multidevice.RequestMessage;
|
||||
import org.whispersystems.signalservice.api.messages.multidevice.SentTranscriptMessage;
|
||||
import org.whispersystems.signalservice.api.messages.multidevice.SignalServiceSyncMessage;
|
||||
import org.whispersystems.signalservice.api.push.SignalServiceAddress;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
@ -104,10 +103,10 @@ public class PushDecryptJob extends ContextJob {
|
||||
return;
|
||||
}
|
||||
|
||||
MasterSecret masterSecret = KeyCachingService.getMasterSecret(context);
|
||||
PushDatabase database = DatabaseFactory.getPushDatabase(context);
|
||||
TextSecureEnvelope envelope = database.get(messageId);
|
||||
Optional<Long> optionalSmsMessageId = smsMessageId > 0 ? Optional.of(smsMessageId) :
|
||||
MasterSecret masterSecret = KeyCachingService.getMasterSecret(context);
|
||||
PushDatabase database = DatabaseFactory.getPushDatabase(context);
|
||||
SignalServiceEnvelope envelope = database.get(messageId);
|
||||
Optional<Long> optionalSmsMessageId = smsMessageId > 0 ? Optional.of(smsMessageId) :
|
||||
Optional.<Long>absent();
|
||||
|
||||
MasterSecretUnion masterSecretUnion;
|
||||
@ -129,23 +128,23 @@ public class PushDecryptJob extends ContextJob {
|
||||
|
||||
}
|
||||
|
||||
private void handleMessage(MasterSecretUnion masterSecret, TextSecureEnvelope envelope, Optional<Long> smsMessageId) {
|
||||
private void handleMessage(MasterSecretUnion masterSecret, SignalServiceEnvelope envelope, Optional<Long> smsMessageId) {
|
||||
try {
|
||||
AxolotlStore axolotlStore = new TextSecureAxolotlStore(context);
|
||||
TextSecureAddress localAddress = new TextSecureAddress(TextSecurePreferences.getLocalNumber(context));
|
||||
TextSecureCipher cipher = new TextSecureCipher(localAddress, axolotlStore);
|
||||
SignalProtocolStore axolotlStore = new SignalProtocolStoreImpl(context);
|
||||
SignalServiceAddress localAddress = new SignalServiceAddress(TextSecurePreferences.getLocalNumber(context));
|
||||
SignalServiceCipher cipher = new SignalServiceCipher(localAddress, axolotlStore);
|
||||
|
||||
TextSecureContent content = cipher.decrypt(envelope);
|
||||
SignalServiceContent content = cipher.decrypt(envelope);
|
||||
|
||||
if (content.getDataMessage().isPresent()) {
|
||||
TextSecureDataMessage message = content.getDataMessage().get();
|
||||
SignalServiceDataMessage message = content.getDataMessage().get();
|
||||
|
||||
if (message.isEndSession()) handleEndSessionMessage(masterSecret, envelope, message, smsMessageId);
|
||||
else if (message.isGroupUpdate()) handleGroupMessage(masterSecret, envelope, message, smsMessageId);
|
||||
else if (message.getAttachments().isPresent()) handleMediaMessage(masterSecret, envelope, message, smsMessageId);
|
||||
else handleTextMessage(masterSecret, envelope, message, smsMessageId);
|
||||
} else if (content.getSyncMessage().isPresent()) {
|
||||
TextSecureSyncMessage syncMessage = content.getSyncMessage().get();
|
||||
SignalServiceSyncMessage syncMessage = content.getSyncMessage().get();
|
||||
|
||||
if (syncMessage.getSent().isPresent()) handleSynchronizeSentMessage(masterSecret, envelope, syncMessage.getSent().get(), smsMessageId);
|
||||
else if (syncMessage.getRequest().isPresent()) handleSynchronizeRequestMessage(masterSecret, syncMessage.getRequest().get());
|
||||
@ -153,7 +152,7 @@ public class PushDecryptJob extends ContextJob {
|
||||
else Log.w(TAG, "Contains no known sync types...");
|
||||
}
|
||||
|
||||
if (envelope.isPreKeyWhisperMessage()) {
|
||||
if (envelope.isPreKeySignalMessage()) {
|
||||
ApplicationContext.getInstance(context).getJobManager().add(new RefreshPreKeysJob(context));
|
||||
}
|
||||
} catch (InvalidVersionException e) {
|
||||
@ -177,16 +176,16 @@ public class PushDecryptJob extends ContextJob {
|
||||
}
|
||||
}
|
||||
|
||||
private void handleEndSessionMessage(@NonNull MasterSecretUnion masterSecret,
|
||||
@NonNull TextSecureEnvelope envelope,
|
||||
@NonNull TextSecureDataMessage message,
|
||||
@NonNull Optional<Long> smsMessageId)
|
||||
private void handleEndSessionMessage(@NonNull MasterSecretUnion masterSecret,
|
||||
@NonNull SignalServiceEnvelope envelope,
|
||||
@NonNull SignalServiceDataMessage message,
|
||||
@NonNull Optional<Long> smsMessageId)
|
||||
{
|
||||
EncryptingSmsDatabase smsDatabase = DatabaseFactory.getEncryptingSmsDatabase(context);
|
||||
IncomingTextMessage incomingTextMessage = new IncomingTextMessage(envelope.getSource(),
|
||||
envelope.getSourceDevice(),
|
||||
message.getTimestamp(),
|
||||
"", Optional.<TextSecureGroup>absent());
|
||||
"", Optional.<SignalServiceGroup>absent());
|
||||
|
||||
long threadId;
|
||||
|
||||
@ -208,8 +207,8 @@ public class PushDecryptJob extends ContextJob {
|
||||
}
|
||||
|
||||
private void handleGroupMessage(@NonNull MasterSecretUnion masterSecret,
|
||||
@NonNull TextSecureEnvelope envelope,
|
||||
@NonNull TextSecureDataMessage message,
|
||||
@NonNull SignalServiceEnvelope envelope,
|
||||
@NonNull SignalServiceDataMessage message,
|
||||
@NonNull Optional<Long> smsMessageId)
|
||||
{
|
||||
GroupMessageProcessor.process(context, masterSecret, envelope, message, false);
|
||||
@ -220,7 +219,7 @@ public class PushDecryptJob extends ContextJob {
|
||||
}
|
||||
|
||||
private void handleSynchronizeSentMessage(@NonNull MasterSecretUnion masterSecret,
|
||||
@NonNull TextSecureEnvelope envelope,
|
||||
@NonNull SignalServiceEnvelope envelope,
|
||||
@NonNull SentTranscriptMessage message,
|
||||
@NonNull Optional<Long> smsMessageId)
|
||||
throws MmsException
|
||||
@ -269,8 +268,8 @@ public class PushDecryptJob extends ContextJob {
|
||||
}
|
||||
|
||||
private void handleMediaMessage(@NonNull MasterSecretUnion masterSecret,
|
||||
@NonNull TextSecureEnvelope envelope,
|
||||
@NonNull TextSecureDataMessage message,
|
||||
@NonNull SignalServiceEnvelope envelope,
|
||||
@NonNull SignalServiceDataMessage message,
|
||||
@NonNull Optional<Long> smsMessageId)
|
||||
throws MmsException
|
||||
{
|
||||
@ -333,8 +332,8 @@ public class PushDecryptJob extends ContextJob {
|
||||
}
|
||||
|
||||
private void handleTextMessage(@NonNull MasterSecretUnion masterSecret,
|
||||
@NonNull TextSecureEnvelope envelope,
|
||||
@NonNull TextSecureDataMessage message,
|
||||
@NonNull SignalServiceEnvelope envelope,
|
||||
@NonNull SignalServiceDataMessage message,
|
||||
@NonNull Optional<Long> smsMessageId)
|
||||
{
|
||||
EncryptingSmsDatabase database = DatabaseFactory.getEncryptingSmsDatabase(context);
|
||||
@ -383,7 +382,7 @@ public class PushDecryptJob extends ContextJob {
|
||||
}
|
||||
|
||||
private void handleInvalidVersionMessage(@NonNull MasterSecretUnion masterSecret,
|
||||
@NonNull TextSecureEnvelope envelope,
|
||||
@NonNull SignalServiceEnvelope envelope,
|
||||
@NonNull Optional<Long> smsMessageId)
|
||||
{
|
||||
EncryptingSmsDatabase smsDatabase = DatabaseFactory.getEncryptingSmsDatabase(context);
|
||||
@ -398,7 +397,7 @@ public class PushDecryptJob extends ContextJob {
|
||||
}
|
||||
|
||||
private void handleCorruptMessage(@NonNull MasterSecretUnion masterSecret,
|
||||
@NonNull TextSecureEnvelope envelope,
|
||||
@NonNull SignalServiceEnvelope envelope,
|
||||
@NonNull Optional<Long> smsMessageId)
|
||||
{
|
||||
EncryptingSmsDatabase smsDatabase = DatabaseFactory.getEncryptingSmsDatabase(context);
|
||||
@ -413,7 +412,7 @@ public class PushDecryptJob extends ContextJob {
|
||||
}
|
||||
|
||||
private void handleNoSessionMessage(@NonNull MasterSecretUnion masterSecret,
|
||||
@NonNull TextSecureEnvelope envelope,
|
||||
@NonNull SignalServiceEnvelope envelope,
|
||||
@NonNull Optional<Long> smsMessageId)
|
||||
{
|
||||
EncryptingSmsDatabase smsDatabase = DatabaseFactory.getEncryptingSmsDatabase(context);
|
||||
@ -428,7 +427,7 @@ public class PushDecryptJob extends ContextJob {
|
||||
}
|
||||
|
||||
private void handleLegacyMessage(@NonNull MasterSecretUnion masterSecret,
|
||||
@NonNull TextSecureEnvelope envelope,
|
||||
@NonNull SignalServiceEnvelope envelope,
|
||||
@NonNull Optional<Long> smsMessageId)
|
||||
{
|
||||
EncryptingSmsDatabase smsDatabase = DatabaseFactory.getEncryptingSmsDatabase(context);
|
||||
@ -443,7 +442,7 @@ public class PushDecryptJob extends ContextJob {
|
||||
}
|
||||
|
||||
private void handleDuplicateMessage(@NonNull MasterSecretUnion masterSecret,
|
||||
@NonNull TextSecureEnvelope envelope,
|
||||
@NonNull SignalServiceEnvelope envelope,
|
||||
@NonNull Optional<Long> smsMessageId)
|
||||
{
|
||||
// Let's start ignoring these now
|
||||
@ -459,19 +458,19 @@ public class PushDecryptJob extends ContextJob {
|
||||
}
|
||||
|
||||
private void handleUntrustedIdentityMessage(@NonNull MasterSecretUnion masterSecret,
|
||||
@NonNull TextSecureEnvelope envelope,
|
||||
@NonNull SignalServiceEnvelope envelope,
|
||||
@NonNull Optional<Long> smsMessageId)
|
||||
{
|
||||
try {
|
||||
EncryptingSmsDatabase database = DatabaseFactory.getEncryptingSmsDatabase(context);
|
||||
Recipients recipients = RecipientFactory.getRecipientsFromString(context, envelope.getSource(), false);
|
||||
long recipientId = recipients.getPrimaryRecipient().getRecipientId();
|
||||
PreKeyWhisperMessage whisperMessage = new PreKeyWhisperMessage(envelope.getLegacyMessage());
|
||||
PreKeySignalMessage whisperMessage = new PreKeySignalMessage(envelope.getLegacyMessage());
|
||||
IdentityKey identityKey = whisperMessage.getIdentityKey();
|
||||
String encoded = Base64.encodeBytes(envelope.getLegacyMessage());
|
||||
IncomingTextMessage textMessage = new IncomingTextMessage(envelope.getSource(), envelope.getSourceDevice(),
|
||||
envelope.getTimestamp(), encoded,
|
||||
Optional.<TextSecureGroup>absent());
|
||||
Optional.<SignalServiceGroup>absent());
|
||||
|
||||
if (!smsMessageId.isPresent()) {
|
||||
IncomingPreKeyBundleMessage bundleMessage = new IncomingPreKeyBundleMessage(textMessage, encoded);
|
||||
@ -489,11 +488,11 @@ public class PushDecryptJob extends ContextJob {
|
||||
}
|
||||
}
|
||||
|
||||
private Pair<Long, Long> insertPlaceholder(@NonNull TextSecureEnvelope envelope) {
|
||||
private Pair<Long, Long> insertPlaceholder(@NonNull SignalServiceEnvelope envelope) {
|
||||
EncryptingSmsDatabase database = DatabaseFactory.getEncryptingSmsDatabase(context);
|
||||
IncomingTextMessage textMessage = new IncomingTextMessage(envelope.getSource(), envelope.getSourceDevice(),
|
||||
envelope.getTimestamp(), "",
|
||||
Optional.<TextSecureGroup>absent());
|
||||
Optional.<SignalServiceGroup>absent());
|
||||
|
||||
textMessage = new IncomingEncryptedMessage(textMessage, "");
|
||||
return database.insertMessageInbox(textMessage);
|
||||
|
@ -20,16 +20,16 @@ import org.thoughtcrime.securesms.transport.UndeliverableMessageException;
|
||||
import org.thoughtcrime.securesms.util.GroupUtil;
|
||||
import org.whispersystems.jobqueue.JobParameters;
|
||||
import org.whispersystems.jobqueue.requirements.NetworkRequirement;
|
||||
import org.whispersystems.textsecure.api.TextSecureMessageSender;
|
||||
import org.whispersystems.textsecure.api.crypto.UntrustedIdentityException;
|
||||
import org.whispersystems.textsecure.api.messages.TextSecureAttachment;
|
||||
import org.whispersystems.textsecure.api.messages.TextSecureDataMessage;
|
||||
import org.whispersystems.textsecure.api.messages.TextSecureGroup;
|
||||
import org.whispersystems.textsecure.api.push.TextSecureAddress;
|
||||
import org.whispersystems.textsecure.api.push.exceptions.EncapsulatedExceptions;
|
||||
import org.whispersystems.textsecure.api.push.exceptions.NetworkFailureException;
|
||||
import org.whispersystems.textsecure.api.util.InvalidNumberException;
|
||||
import org.whispersystems.textsecure.internal.push.TextSecureProtos.GroupContext;
|
||||
import org.whispersystems.signalservice.api.SignalServiceMessageSender;
|
||||
import org.whispersystems.signalservice.api.crypto.UntrustedIdentityException;
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceAttachment;
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceDataMessage;
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceGroup;
|
||||
import org.whispersystems.signalservice.api.push.SignalServiceAddress;
|
||||
import org.whispersystems.signalservice.api.push.exceptions.EncapsulatedExceptions;
|
||||
import org.whispersystems.signalservice.api.push.exceptions.NetworkFailureException;
|
||||
import org.whispersystems.signalservice.api.util.InvalidNumberException;
|
||||
import org.whispersystems.signalservice.internal.push.SignalServiceProtos.GroupContext;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.LinkedList;
|
||||
@ -132,11 +132,11 @@ public class PushGroupSendJob extends PushSendJob implements InjectableType {
|
||||
throws IOException, RecipientFormattingException, InvalidNumberException,
|
||||
EncapsulatedExceptions, UndeliverableMessageException
|
||||
{
|
||||
TextSecureMessageSender messageSender = messageSenderFactory.create();
|
||||
byte[] groupId = GroupUtil.getDecodedId(message.getRecipients().getPrimaryRecipient().getNumber());
|
||||
Recipients recipients = DatabaseFactory.getGroupDatabase(context).getGroupMembers(groupId, false);
|
||||
List<TextSecureAttachment> attachments = getAttachmentsFor(masterSecret, message.getAttachments());
|
||||
List<TextSecureAddress> addresses;
|
||||
SignalServiceMessageSender messageSender = messageSenderFactory.create();
|
||||
byte[] groupId = GroupUtil.getDecodedId(message.getRecipients().getPrimaryRecipient().getNumber());
|
||||
Recipients recipients = DatabaseFactory.getGroupDatabase(context).getGroupMembers(groupId, false);
|
||||
List<SignalServiceAttachment> attachments = getAttachmentsFor(masterSecret, message.getAttachments());
|
||||
List<SignalServiceAddress> addresses;
|
||||
|
||||
if (filterRecipientId >= 0) addresses = getPushAddresses(filterRecipientId);
|
||||
else addresses = getPushAddresses(recipients);
|
||||
@ -144,22 +144,22 @@ public class PushGroupSendJob extends PushSendJob implements InjectableType {
|
||||
if (message.isGroup()) {
|
||||
OutgoingGroupMediaMessage groupMessage = (OutgoingGroupMediaMessage) message;
|
||||
GroupContext groupContext = groupMessage.getGroupContext();
|
||||
TextSecureAttachment avatar = attachments.isEmpty() ? null : attachments.get(0);
|
||||
TextSecureGroup.Type type = groupMessage.isGroupQuit() ? TextSecureGroup.Type.QUIT : TextSecureGroup.Type.UPDATE;
|
||||
TextSecureGroup group = new TextSecureGroup(type, groupId, groupContext.getName(), groupContext.getMembersList(), avatar);
|
||||
TextSecureDataMessage groupDataMessage = new TextSecureDataMessage(message.getSentTimeMillis(), group, null, null);
|
||||
SignalServiceAttachment avatar = attachments.isEmpty() ? null : attachments.get(0);
|
||||
SignalServiceGroup.Type type = groupMessage.isGroupQuit() ? SignalServiceGroup.Type.QUIT : SignalServiceGroup.Type.UPDATE;
|
||||
SignalServiceGroup group = new SignalServiceGroup(type, groupId, groupContext.getName(), groupContext.getMembersList(), avatar);
|
||||
SignalServiceDataMessage groupDataMessage = new SignalServiceDataMessage(message.getSentTimeMillis(), group, null, null);
|
||||
|
||||
messageSender.sendMessage(addresses, groupDataMessage);
|
||||
} else {
|
||||
TextSecureGroup group = new TextSecureGroup(groupId);
|
||||
TextSecureDataMessage groupMessage = new TextSecureDataMessage(message.getSentTimeMillis(), group, attachments, message.getBody());
|
||||
SignalServiceGroup group = new SignalServiceGroup(groupId);
|
||||
SignalServiceDataMessage groupMessage = new SignalServiceDataMessage(message.getSentTimeMillis(), group, attachments, message.getBody());
|
||||
|
||||
messageSender.sendMessage(addresses, groupMessage);
|
||||
}
|
||||
}
|
||||
|
||||
private List<TextSecureAddress> getPushAddresses(Recipients recipients) throws InvalidNumberException {
|
||||
List<TextSecureAddress> addresses = new LinkedList<>();
|
||||
private List<SignalServiceAddress> getPushAddresses(Recipients recipients) throws InvalidNumberException {
|
||||
List<SignalServiceAddress> addresses = new LinkedList<>();
|
||||
|
||||
for (Recipient recipient : recipients.getRecipientsList()) {
|
||||
addresses.add(getPushAddress(recipient.getNumber()));
|
||||
@ -168,8 +168,8 @@ public class PushGroupSendJob extends PushSendJob implements InjectableType {
|
||||
return addresses;
|
||||
}
|
||||
|
||||
private List<TextSecureAddress> getPushAddresses(long filterRecipientId) throws InvalidNumberException {
|
||||
List<TextSecureAddress> addresses = new LinkedList<>();
|
||||
private List<SignalServiceAddress> getPushAddresses(long filterRecipientId) throws InvalidNumberException {
|
||||
List<SignalServiceAddress> addresses = new LinkedList<>();
|
||||
addresses.add(getPushAddress(RecipientFactory.getRecipientForId(context, filterRecipientId, false).getNumber()));
|
||||
return addresses;
|
||||
}
|
||||
|
@ -17,13 +17,13 @@ import org.thoughtcrime.securesms.recipients.Recipients;
|
||||
import org.thoughtcrime.securesms.transport.InsecureFallbackApprovalException;
|
||||
import org.thoughtcrime.securesms.transport.RetryLaterException;
|
||||
import org.thoughtcrime.securesms.transport.UndeliverableMessageException;
|
||||
import org.whispersystems.textsecure.api.TextSecureMessageSender;
|
||||
import org.whispersystems.textsecure.api.crypto.UntrustedIdentityException;
|
||||
import org.whispersystems.textsecure.api.messages.TextSecureAttachment;
|
||||
import org.whispersystems.textsecure.api.messages.TextSecureDataMessage;
|
||||
import org.whispersystems.textsecure.api.push.TextSecureAddress;
|
||||
import org.whispersystems.textsecure.api.push.exceptions.UnregisteredUserException;
|
||||
import org.whispersystems.textsecure.api.util.InvalidNumberException;
|
||||
import org.whispersystems.signalservice.api.SignalServiceMessageSender;
|
||||
import org.whispersystems.signalservice.api.crypto.UntrustedIdentityException;
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceAttachment;
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceDataMessage;
|
||||
import org.whispersystems.signalservice.api.push.SignalServiceAddress;
|
||||
import org.whispersystems.signalservice.api.push.exceptions.UnregisteredUserException;
|
||||
import org.whispersystems.signalservice.api.util.InvalidNumberException;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
@ -112,17 +112,17 @@ public class PushMediaSendJob extends PushSendJob implements InjectableType {
|
||||
throw new UndeliverableMessageException("No destination address.");
|
||||
}
|
||||
|
||||
TextSecureMessageSender messageSender = messageSenderFactory.create();
|
||||
SignalServiceMessageSender messageSender = messageSenderFactory.create();
|
||||
|
||||
try {
|
||||
TextSecureAddress address = getPushAddress(message.getRecipients().getPrimaryRecipient().getNumber());
|
||||
List<Attachment> scaledAttachments = scaleAttachments(masterSecret, MediaConstraints.PUSH_CONSTRAINTS, message.getAttachments());
|
||||
List<TextSecureAttachment> attachmentStreams = getAttachmentsFor(masterSecret, scaledAttachments);
|
||||
TextSecureDataMessage mediaMessage = TextSecureDataMessage.newBuilder()
|
||||
.withBody(message.getBody())
|
||||
.withAttachments(attachmentStreams)
|
||||
.withTimestamp(message.getSentTimeMillis())
|
||||
.build();
|
||||
SignalServiceAddress address = getPushAddress(message.getRecipients().getPrimaryRecipient().getNumber());
|
||||
List<Attachment> scaledAttachments = scaleAttachments(masterSecret, MediaConstraints.PUSH_CONSTRAINTS, message.getAttachments());
|
||||
List<SignalServiceAttachment> attachmentStreams = getAttachmentsFor(masterSecret, scaledAttachments);
|
||||
SignalServiceDataMessage mediaMessage = SignalServiceDataMessage.newBuilder()
|
||||
.withBody(message.getBody())
|
||||
.withAttachments(attachmentStreams)
|
||||
.withTimestamp(message.getSentTimeMillis())
|
||||
.build();
|
||||
|
||||
messageSender.sendMessage(address, mediaMessage);
|
||||
} catch (InvalidNumberException | UnregisteredUserException e) {
|
||||
|
@ -6,9 +6,9 @@ import android.util.Log;
|
||||
import org.thoughtcrime.securesms.dependencies.InjectableType;
|
||||
import org.whispersystems.jobqueue.JobParameters;
|
||||
import org.whispersystems.jobqueue.requirements.NetworkRequirement;
|
||||
import org.whispersystems.textsecure.api.TextSecureMessageReceiver;
|
||||
import org.whispersystems.textsecure.api.messages.TextSecureEnvelope;
|
||||
import org.whispersystems.textsecure.api.push.exceptions.PushNetworkException;
|
||||
import org.whispersystems.signalservice.api.SignalServiceMessageReceiver;
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceEnvelope;
|
||||
import org.whispersystems.signalservice.api.push.exceptions.PushNetworkException;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
@ -19,7 +19,7 @@ public class PushNotificationReceiveJob extends PushReceivedJob implements Injec
|
||||
|
||||
private static final String TAG = PushNotificationReceiveJob.class.getSimpleName();
|
||||
|
||||
@Inject transient TextSecureMessageReceiver receiver;
|
||||
@Inject transient SignalServiceMessageReceiver receiver;
|
||||
|
||||
public PushNotificationReceiveJob(Context context) {
|
||||
super(context, JobParameters.newBuilder()
|
||||
@ -33,9 +33,9 @@ public class PushNotificationReceiveJob extends PushReceivedJob implements Injec
|
||||
|
||||
@Override
|
||||
public void onRun() throws IOException {
|
||||
receiver.retrieveMessages(new TextSecureMessageReceiver.MessageReceivedCallback() {
|
||||
receiver.retrieveMessages(new SignalServiceMessageReceiver.MessageReceivedCallback() {
|
||||
@Override
|
||||
public void onMessage(TextSecureEnvelope envelope) {
|
||||
public void onMessage(SignalServiceEnvelope envelope) {
|
||||
handle(envelope, false);
|
||||
}
|
||||
});
|
||||
|
@ -14,8 +14,8 @@ import org.thoughtcrime.securesms.recipients.Recipients;
|
||||
import org.thoughtcrime.securesms.service.KeyCachingService;
|
||||
import org.whispersystems.jobqueue.JobManager;
|
||||
import org.whispersystems.jobqueue.JobParameters;
|
||||
import org.whispersystems.textsecure.api.messages.TextSecureEnvelope;
|
||||
import org.whispersystems.textsecure.api.push.ContactTokenDetails;
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceEnvelope;
|
||||
import org.whispersystems.signalservice.api.push.ContactTokenDetails;
|
||||
|
||||
public abstract class PushReceivedJob extends ContextJob {
|
||||
|
||||
@ -25,7 +25,7 @@ public abstract class PushReceivedJob extends ContextJob {
|
||||
super(context, parameters);
|
||||
}
|
||||
|
||||
public void handle(TextSecureEnvelope envelope, boolean sendExplicitReceipt) {
|
||||
public void handle(SignalServiceEnvelope envelope, boolean sendExplicitReceipt) {
|
||||
if (!isActiveNumber(context, envelope.getSource())) {
|
||||
TextSecureDirectory directory = TextSecureDirectory.getInstance(context);
|
||||
ContactTokenDetails contactTokenDetails = new ContactTokenDetails();
|
||||
@ -39,14 +39,14 @@ public abstract class PushReceivedJob extends ContextJob {
|
||||
|
||||
if (envelope.isReceipt()) {
|
||||
handleReceipt(envelope);
|
||||
} else if (envelope.isPreKeyWhisperMessage() || envelope.isWhisperMessage()) {
|
||||
} else if (envelope.isPreKeySignalMessage() || envelope.isSignalMessage()) {
|
||||
handleMessage(envelope, sendExplicitReceipt);
|
||||
} else {
|
||||
Log.w(TAG, "Received envelope of unknown type: " + envelope.getType());
|
||||
}
|
||||
}
|
||||
|
||||
private void handleMessage(TextSecureEnvelope envelope, boolean sendExplicitReceipt) {
|
||||
private void handleMessage(SignalServiceEnvelope envelope, boolean sendExplicitReceipt) {
|
||||
Recipients recipients = RecipientFactory.getRecipientsFromString(context, envelope.getSource(), false);
|
||||
JobManager jobManager = ApplicationContext.getInstance(context).getJobManager();
|
||||
|
||||
@ -64,7 +64,7 @@ public abstract class PushReceivedJob extends ContextJob {
|
||||
}
|
||||
}
|
||||
|
||||
private void handleReceipt(TextSecureEnvelope envelope) {
|
||||
private void handleReceipt(SignalServiceEnvelope envelope) {
|
||||
Log.w(TAG, String.format("Received receipt: (XXXXX, %d)", envelope.getTimestamp()));
|
||||
DatabaseFactory.getMmsSmsDatabase(context).incrementDeliveryReceiptCount(new SyncMessageId(envelope.getSource(),
|
||||
envelope.getTimestamp()));
|
||||
|
@ -15,11 +15,11 @@ import org.thoughtcrime.securesms.recipients.Recipients;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
import org.whispersystems.jobqueue.JobParameters;
|
||||
import org.whispersystems.jobqueue.requirements.NetworkRequirement;
|
||||
import org.whispersystems.libaxolotl.util.guava.Optional;
|
||||
import org.whispersystems.textsecure.api.messages.TextSecureAttachment;
|
||||
import org.whispersystems.textsecure.api.messages.TextSecureAttachment.ProgressListener;
|
||||
import org.whispersystems.textsecure.api.push.TextSecureAddress;
|
||||
import org.whispersystems.textsecure.api.util.InvalidNumberException;
|
||||
import org.whispersystems.libsignal.util.guava.Optional;
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceAttachment;
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceAttachment.ProgressListener;
|
||||
import org.whispersystems.signalservice.api.push.SignalServiceAddress;
|
||||
import org.whispersystems.signalservice.api.util.InvalidNumberException;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@ -48,14 +48,14 @@ public abstract class PushSendJob extends SendJob {
|
||||
return builder.create();
|
||||
}
|
||||
|
||||
protected TextSecureAddress getPushAddress(String number) throws InvalidNumberException {
|
||||
protected SignalServiceAddress getPushAddress(String number) throws InvalidNumberException {
|
||||
String e164number = Util.canonicalizeNumber(context, number);
|
||||
String relay = TextSecureDirectory.getInstance(context).getRelay(e164number);
|
||||
return new TextSecureAddress(e164number, Optional.fromNullable(relay));
|
||||
return new SignalServiceAddress(e164number, Optional.fromNullable(relay));
|
||||
}
|
||||
|
||||
protected List<TextSecureAttachment> getAttachmentsFor(MasterSecret masterSecret, List<Attachment> parts) {
|
||||
List<TextSecureAttachment> attachments = new LinkedList<>();
|
||||
protected List<SignalServiceAttachment> getAttachmentsFor(MasterSecret masterSecret, List<Attachment> parts) {
|
||||
List<SignalServiceAttachment> attachments = new LinkedList<>();
|
||||
|
||||
for (final Attachment attachment : parts) {
|
||||
if (ContentType.isImageType(attachment.getContentType()) ||
|
||||
@ -65,17 +65,17 @@ public abstract class PushSendJob extends SendJob {
|
||||
try {
|
||||
if (attachment.getDataUri() == null) throw new IOException("Assertion failed, outgoing attachment has no data!");
|
||||
InputStream is = PartAuthority.getAttachmentStream(context, masterSecret, attachment.getDataUri());
|
||||
attachments.add(TextSecureAttachment.newStreamBuilder()
|
||||
.withStream(is)
|
||||
.withContentType(attachment.getContentType())
|
||||
.withLength(attachment.getSize())
|
||||
.withListener(new ProgressListener() {
|
||||
@Override
|
||||
public void onAttachmentProgress(long total, long progress) {
|
||||
EventBus.getDefault().postSticky(new PartProgressEvent(attachment, total, progress));
|
||||
}
|
||||
})
|
||||
.build());
|
||||
attachments.add(SignalServiceAttachment.newStreamBuilder()
|
||||
.withStream(is)
|
||||
.withContentType(attachment.getContentType())
|
||||
.withLength(attachment.getSize())
|
||||
.withListener(new ProgressListener() {
|
||||
@Override
|
||||
public void onAttachmentProgress(long total, long progress) {
|
||||
EventBus.getDefault().postSticky(new PartProgressEvent(attachment, total, progress));
|
||||
}
|
||||
})
|
||||
.build());
|
||||
} catch (IOException ioe) {
|
||||
Log.w(TAG, "Couldn't open attachment", ioe);
|
||||
}
|
||||
|
@ -16,12 +16,12 @@ import org.thoughtcrime.securesms.recipients.RecipientFactory;
|
||||
import org.thoughtcrime.securesms.recipients.Recipients;
|
||||
import org.thoughtcrime.securesms.transport.InsecureFallbackApprovalException;
|
||||
import org.thoughtcrime.securesms.transport.RetryLaterException;
|
||||
import org.whispersystems.textsecure.api.TextSecureMessageSender;
|
||||
import org.whispersystems.textsecure.api.crypto.UntrustedIdentityException;
|
||||
import org.whispersystems.textsecure.api.messages.TextSecureDataMessage;
|
||||
import org.whispersystems.textsecure.api.push.TextSecureAddress;
|
||||
import org.whispersystems.textsecure.api.push.exceptions.UnregisteredUserException;
|
||||
import org.whispersystems.textsecure.api.util.InvalidNumberException;
|
||||
import org.whispersystems.signalservice.api.SignalServiceMessageSender;
|
||||
import org.whispersystems.signalservice.api.crypto.UntrustedIdentityException;
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceDataMessage;
|
||||
import org.whispersystems.signalservice.api.push.SignalServiceAddress;
|
||||
import org.whispersystems.signalservice.api.push.exceptions.UnregisteredUserException;
|
||||
import org.whispersystems.signalservice.api.util.InvalidNumberException;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@ -103,13 +103,13 @@ public class PushTextSendJob extends PushSendJob implements InjectableType {
|
||||
throws UntrustedIdentityException, InsecureFallbackApprovalException, RetryLaterException
|
||||
{
|
||||
try {
|
||||
TextSecureAddress address = getPushAddress(message.getIndividualRecipient().getNumber());
|
||||
TextSecureMessageSender messageSender = messageSenderFactory.create();
|
||||
TextSecureDataMessage textSecureMessage = TextSecureDataMessage.newBuilder()
|
||||
.withTimestamp(message.getDateSent())
|
||||
.withBody(message.getBody().getBody())
|
||||
.asEndSessionMessage(message.isEndSession())
|
||||
.build();
|
||||
SignalServiceAddress address = getPushAddress(message.getIndividualRecipient().getNumber());
|
||||
SignalServiceMessageSender messageSender = messageSenderFactory.create();
|
||||
SignalServiceDataMessage textSecureMessage = SignalServiceDataMessage.newBuilder()
|
||||
.withTimestamp(message.getDateSent())
|
||||
.withBody(message.getBody().getBody())
|
||||
.asEndSessionMessage(message.isEndSession())
|
||||
.build();
|
||||
|
||||
|
||||
messageSender.sendMessage(address, textSecureMessage);
|
||||
|
@ -9,8 +9,8 @@ import org.thoughtcrime.securesms.dependencies.InjectableType;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.whispersystems.jobqueue.JobParameters;
|
||||
import org.whispersystems.jobqueue.requirements.NetworkRequirement;
|
||||
import org.whispersystems.textsecure.api.TextSecureAccountManager;
|
||||
import org.whispersystems.textsecure.api.push.exceptions.NetworkFailureException;
|
||||
import org.whispersystems.signalservice.api.SignalServiceAccountManager;
|
||||
import org.whispersystems.signalservice.api.push.exceptions.NetworkFailureException;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@ -22,8 +22,8 @@ public class RefreshAttributesJob extends ContextJob implements InjectableType {
|
||||
|
||||
private static final String TAG = RefreshAttributesJob.class.getSimpleName();
|
||||
|
||||
@Inject transient TextSecureAccountManager textSecureAccountManager;
|
||||
@Inject transient RedPhoneAccountManager redPhoneAccountManager;
|
||||
@Inject transient SignalServiceAccountManager textSecureAccountManager;
|
||||
@Inject transient RedPhoneAccountManager redPhoneAccountManager;
|
||||
|
||||
public RefreshAttributesJob(Context context) {
|
||||
super(context, JobParameters.newBuilder()
|
||||
|
@ -12,12 +12,12 @@ import org.thoughtcrime.securesms.jobs.requirements.MasterSecretRequirement;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.whispersystems.jobqueue.JobParameters;
|
||||
import org.whispersystems.jobqueue.requirements.NetworkRequirement;
|
||||
import org.whispersystems.libaxolotl.IdentityKeyPair;
|
||||
import org.whispersystems.libaxolotl.state.PreKeyRecord;
|
||||
import org.whispersystems.libaxolotl.state.SignedPreKeyRecord;
|
||||
import org.whispersystems.textsecure.api.TextSecureAccountManager;
|
||||
import org.whispersystems.textsecure.api.push.exceptions.NonSuccessfulResponseCodeException;
|
||||
import org.whispersystems.textsecure.api.push.exceptions.PushNetworkException;
|
||||
import org.whispersystems.libsignal.IdentityKeyPair;
|
||||
import org.whispersystems.libsignal.state.PreKeyRecord;
|
||||
import org.whispersystems.libsignal.state.SignedPreKeyRecord;
|
||||
import org.whispersystems.signalservice.api.SignalServiceAccountManager;
|
||||
import org.whispersystems.signalservice.api.push.exceptions.NonSuccessfulResponseCodeException;
|
||||
import org.whispersystems.signalservice.api.push.exceptions.PushNetworkException;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
@ -30,7 +30,7 @@ public class RefreshPreKeysJob extends MasterSecretJob implements InjectableType
|
||||
|
||||
private static final int PREKEY_MINIMUM = 10;
|
||||
|
||||
@Inject transient TextSecureAccountManager accountManager;
|
||||
@Inject transient SignalServiceAccountManager accountManager;
|
||||
|
||||
public RefreshPreKeysJob(Context context) {
|
||||
super(context, JobParameters.newBuilder()
|
||||
|
@ -16,7 +16,7 @@ import org.thoughtcrime.securesms.recipients.Recipients;
|
||||
import org.thoughtcrime.securesms.service.KeyCachingService;
|
||||
import org.thoughtcrime.securesms.sms.IncomingTextMessage;
|
||||
import org.whispersystems.jobqueue.JobParameters;
|
||||
import org.whispersystems.libaxolotl.util.guava.Optional;
|
||||
import org.whispersystems.libsignal.util.guava.Optional;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
@ -17,7 +17,7 @@ import org.thoughtcrime.securesms.jobs.requirements.MasterSecretRequirement;
|
||||
import org.thoughtcrime.securesms.notifications.MessageNotifier;
|
||||
import org.thoughtcrime.securesms.service.SmsDeliveryListener;
|
||||
import org.whispersystems.jobqueue.JobParameters;
|
||||
import org.whispersystems.libaxolotl.state.SessionStore;
|
||||
import org.whispersystems.libsignal.state.SessionStore;
|
||||
|
||||
public class SmsSentJob extends MasterSecretJob {
|
||||
|
||||
|
@ -7,7 +7,7 @@ import org.whispersystems.jobqueue.EncryptionKeys;
|
||||
import org.whispersystems.jobqueue.Job;
|
||||
import org.whispersystems.jobqueue.persistence.JavaJobSerializer;
|
||||
import org.whispersystems.jobqueue.persistence.JobSerializer;
|
||||
import org.whispersystems.libaxolotl.InvalidMessageException;
|
||||
import org.whispersystems.libsignal.InvalidMessageException;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
@ -52,7 +52,7 @@ import org.thoughtcrime.securesms.util.ViewUtil;
|
||||
import org.thoughtcrime.securesms.util.concurrent.AssertedSuccessListener;
|
||||
import org.thoughtcrime.securesms.util.concurrent.ListenableFuture;
|
||||
import org.thoughtcrime.securesms.util.concurrent.ListenableFuture.Listener;
|
||||
import org.whispersystems.libaxolotl.util.guava.Optional;
|
||||
import org.whispersystems.libsignal.util.guava.Optional;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Iterator;
|
||||
|
@ -10,7 +10,7 @@ import com.bumptech.glide.load.data.DataFetcher;
|
||||
import com.bumptech.glide.load.data.StreamLocalUriFetcher;
|
||||
|
||||
import org.thoughtcrime.securesms.crypto.MasterSecret;
|
||||
import org.whispersystems.textsecure.api.crypto.AttachmentCipherInputStream;
|
||||
import org.whispersystems.signalservice.api.crypto.AttachmentCipherInputStream;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
|
@ -5,9 +5,9 @@ import org.thoughtcrime.securesms.attachments.PointerAttachment;
|
||||
import org.thoughtcrime.securesms.crypto.MasterSecretUnion;
|
||||
import org.thoughtcrime.securesms.database.MmsAddresses;
|
||||
import org.thoughtcrime.securesms.util.GroupUtil;
|
||||
import org.whispersystems.libaxolotl.util.guava.Optional;
|
||||
import org.whispersystems.textsecure.api.messages.TextSecureAttachment;
|
||||
import org.whispersystems.textsecure.api.messages.TextSecureGroup;
|
||||
import org.whispersystems.libsignal.util.guava.Optional;
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceAttachment;
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceGroup;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
@ -48,8 +48,8 @@ public class IncomingMediaMessage {
|
||||
int subscriptionId,
|
||||
Optional<String> relay,
|
||||
Optional<String> body,
|
||||
Optional<TextSecureGroup> group,
|
||||
Optional<List<TextSecureAttachment>> attachments)
|
||||
Optional<SignalServiceGroup> group,
|
||||
Optional<List<SignalServiceAttachment>> attachments)
|
||||
{
|
||||
this.push = true;
|
||||
this.from = from;
|
||||
|
@ -42,7 +42,7 @@ import org.thoughtcrime.securesms.util.ServiceUtil;
|
||||
import org.thoughtcrime.securesms.util.TelephonyUtil;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
import org.whispersystems.libaxolotl.util.guava.Optional;
|
||||
import org.whispersystems.libsignal.util.guava.Optional;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
@ -5,7 +5,7 @@ import android.net.Uri;
|
||||
import android.support.annotation.NonNull;
|
||||
|
||||
import org.thoughtcrime.securesms.components.location.SignalPlace;
|
||||
import org.whispersystems.libaxolotl.util.guava.Optional;
|
||||
import org.whispersystems.libsignal.util.guava.Optional;
|
||||
|
||||
public class LocationSlide extends ImageSlide {
|
||||
|
||||
|
@ -7,7 +7,7 @@ import org.thoughtcrime.securesms.attachments.Attachment;
|
||||
import org.thoughtcrime.securesms.database.ThreadDatabase;
|
||||
import org.thoughtcrime.securesms.recipients.Recipients;
|
||||
import org.thoughtcrime.securesms.util.Base64;
|
||||
import org.whispersystems.textsecure.internal.push.TextSecureProtos.GroupContext;
|
||||
import org.whispersystems.signalservice.internal.push.SignalServiceProtos.GroupContext;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.LinkedList;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user