From 7b589c4300f5cad4c7b061a397a26269d2eb73f0 Mon Sep 17 00:00:00 2001 From: Moxie Marlinspike Date: Wed, 23 Mar 2016 10:34:41 -0700 Subject: [PATCH] TextSecure is now SignalService // FREEBIE --- build.gradle | 14 +-- .../redphone/call/ProximityLock.java | 2 +- .../signaling/RedPhoneAccountManager.java | 4 +- .../signaling/RedPhoneTrustStore.java | 2 +- .../redphone/signaling/SignalingSocket.java | 2 +- .../signaling/signals/InitiateSignal.java | 4 +- .../securesms/ApplicationContext.java | 6 +- .../securesms/ConfirmIdentityDialog.java | 16 +-- .../securesms/ConversationActivity.java | 8 +- .../securesms/ConversationItem.java | 2 +- .../securesms/ConversationListFragment.java | 2 +- .../securesms/DeviceActivity.java | 24 ++-- .../securesms/DeviceListFragment.java | 6 +- .../securesms/DeviceListItem.java | 2 +- .../securesms/ExperienceUpgradeActivity.java | 2 +- .../securesms/GroupCreateActivity.java | 4 +- .../securesms/GroupMembersDialog.java | 2 +- .../securesms/InviteActivity.java | 2 +- .../securesms/KeyScanningActivity.java | 2 +- .../securesms/RegistrationActivity.java | 2 +- .../RegistrationProgressActivity.java | 14 +-- .../securesms/TransportOption.java | 2 +- .../securesms/TransportOptions.java | 2 +- .../securesms/VerifyIdentityActivity.java | 16 +-- .../securesms/ViewIdentityActivity.java | 2 +- .../attachments/PointerAttachment.java | 8 +- .../securesms/attachments/UriAttachment.java | 2 +- .../securesms/audio/AudioSlidePlayer.java | 2 +- .../securesms/components/SendButton.java | 2 +- .../securesms/components/ThumbnailView.java | 2 +- .../components/camera/CameraView.java | 2 +- .../securesms/contacts/ContactsDatabase.java | 8 +- .../crypto/AsymmetricMasterCipher.java | 12 +- .../crypto/AsymmetricMasterSecret.java | 4 +- .../crypto/IdentityKeyParcelable.java | 4 +- .../securesms/crypto/IdentityKeyUtil.java | 12 +- .../securesms/crypto/MasterCipher.java | 10 +- .../securesms/crypto/MasterSecretUnion.java | 2 +- .../securesms/crypto/MasterSecretUtil.java | 10 +- .../securesms/crypto/MediaKey.java | 2 +- .../securesms/crypto/PreKeyUtil.java | 20 +-- .../securesms/crypto/PublicKey.java | 6 +- .../securesms/crypto/SessionUtil.java | 10 +- ...tore.java => SignalProtocolStoreImpl.java} | 36 +++--- .../storage/TextSecureIdentityKeyStore.java | 6 +- .../crypto/storage/TextSecurePreKeyStore.java | 12 +- .../storage/TextSecureSessionStore.java | 40 +++--- .../securesms/database/ApnDatabase.java | 2 +- .../database/CanonicalAddressDatabase.java | 4 +- .../securesms/database/DatabaseFactory.java | 4 +- .../securesms/database/DraftDatabase.java | 2 +- .../database/EncryptingSmsDatabase.java | 2 +- .../securesms/database/GroupDatabase.java | 6 +- .../securesms/database/IdentityDatabase.java | 4 +- .../securesms/database/MessagingDatabase.java | 2 +- .../securesms/database/MmsDatabase.java | 6 +- .../securesms/database/MmsSmsDatabase.java | 2 +- .../securesms/database/PushDatabase.java | 34 ++--- .../database/RecipientPreferenceDatabase.java | 2 +- .../securesms/database/SmsDatabase.java | 2 +- .../database/TextSecureDirectory.java | 6 +- .../securesms/database/ThreadDatabase.java | 2 +- .../documents/IdentityKeyMismatch.java | 4 +- .../database/loaders/CountryListLoader.java | 2 +- .../database/loaders/DeviceListLoader.java | 12 +- .../dependencies/AxolotlStorageModule.java | 7 +- .../TextSecureCommunicationModule.java | 46 +++---- .../securesms/groups/GroupManager.java | 4 +- .../groups/GroupMessageProcessor.java | 60 ++++----- .../securesms/jobs/AttachmentDownloadJob.java | 22 ++-- .../securesms/jobs/AvatarDownloadJob.java | 6 +- .../securesms/jobs/CleanPreKeysJob.java | 16 +-- .../securesms/jobs/CreateSignedPreKeyJob.java | 10 +- .../securesms/jobs/DeliveryReceiptJob.java | 14 +-- .../securesms/jobs/DirectoryRefreshJob.java | 2 +- .../securesms/jobs/GcmRefreshJob.java | 10 +- .../jobs/MasterSecretDecryptJob.java | 2 +- .../securesms/jobs/MmsDownloadJob.java | 10 +- .../jobs/MultiDeviceContactUpdateJob.java | 63 +++++----- .../jobs/MultiDeviceGroupUpdateJob.java | 52 ++++---- .../jobs/MultiDeviceReadUpdateJob.java | 14 +-- .../securesms/jobs/PushContentReceiveJob.java | 10 +- .../securesms/jobs/PushDecryptJob.java | 117 +++++++++--------- .../securesms/jobs/PushGroupSendJob.java | 50 ++++---- .../securesms/jobs/PushMediaSendJob.java | 32 ++--- .../jobs/PushNotificationReceiveJob.java | 12 +- .../securesms/jobs/PushReceivedJob.java | 12 +- .../securesms/jobs/PushSendJob.java | 40 +++--- .../securesms/jobs/PushTextSendJob.java | 26 ++-- .../securesms/jobs/RefreshAttributesJob.java | 8 +- .../securesms/jobs/RefreshPreKeysJob.java | 14 +-- .../securesms/jobs/SmsReceiveJob.java | 2 +- .../securesms/jobs/SmsSentJob.java | 2 +- .../persistence/EncryptingJobSerializer.java | 2 +- .../securesms/mms/AttachmentManager.java | 2 +- .../mms/AttachmentStreamLocalUriFetcher.java | 2 +- .../securesms/mms/IncomingMediaMessage.java | 10 +- .../securesms/mms/LegacyMmsConnection.java | 2 +- .../securesms/mms/LocationSlide.java | 2 +- .../mms/OutgoingGroupMediaMessage.java | 2 +- src/org/thoughtcrime/securesms/mms/Slide.java | 2 +- .../thoughtcrime/securesms/mms/SlideDeck.java | 2 +- .../notifications/MessageNotifier.java | 4 +- .../notifications/WearReplyReceiver.java | 2 +- .../AdvancedPreferenceFragment.java | 18 +-- .../securesms/push/SecurityEventListener.java | 8 +- .../push/TextSecureCommunicationFactory.java | 32 ++--- .../push/TextSecurePushTrustStore.java | 4 +- .../recipients/RecipientFactory.java | 2 +- .../recipients/RecipientProvider.java | 2 +- .../service/MessageRetrievalService.java | 18 +-- .../service/QuickResponseService.java | 2 +- .../service/RegistrationService.java | 20 +-- .../securesms/sms/IncomingGroupMessage.java | 2 +- .../securesms/sms/IncomingJoinedMessage.java | 6 +- .../securesms/sms/IncomingTextMessage.java | 12 +- .../securesms/sms/MessageSender.java | 10 +- .../securesms/util/DirectoryHelper.java | 12 +- .../securesms/util/GroupUtil.java | 2 +- .../util/SelectedRecipientsAdapter.java | 2 +- src/org/thoughtcrime/securesms/util/Util.java | 4 +- .../dualsim/SubscriptionManagerCompat.java | 2 +- .../securesms/crypto/MasterCipherTest.java | 2 +- .../securesms/jobs/CleanPreKeysJobTest.java | 40 +++--- .../jobs/DeliveryReceiptJobTest.java | 26 ++-- .../util/PhoneNumberFormatterTest.java | 4 +- 126 files changed, 681 insertions(+), 698 deletions(-) rename src/org/thoughtcrime/securesms/crypto/storage/{TextSecureAxolotlStore.java => SignalProtocolStoreImpl.java} (71%) diff --git a/build.gradle b/build.gradle index e4c00d3594..d7259f0f40 100644 --- a/build.gradle +++ b/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', ] } diff --git a/src/org/thoughtcrime/redphone/call/ProximityLock.java b/src/org/thoughtcrime/redphone/call/ProximityLock.java index 92a05461a0..0c2ba41eef 100644 --- a/src/org/thoughtcrime/redphone/call/ProximityLock.java +++ b/src/org/thoughtcrime/redphone/call/ProximityLock.java @@ -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; diff --git a/src/org/thoughtcrime/redphone/signaling/RedPhoneAccountManager.java b/src/org/thoughtcrime/redphone/signaling/RedPhoneAccountManager.java index f835d0acf2..cb43574dd6 100644 --- a/src/org/thoughtcrime/redphone/signaling/RedPhoneAccountManager.java +++ b/src/org/thoughtcrime/redphone/signaling/RedPhoneAccountManager.java @@ -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; diff --git a/src/org/thoughtcrime/redphone/signaling/RedPhoneTrustStore.java b/src/org/thoughtcrime/redphone/signaling/RedPhoneTrustStore.java index b3b1066ae4..61baf5cc30 100644 --- a/src/org/thoughtcrime/redphone/signaling/RedPhoneTrustStore.java +++ b/src/org/thoughtcrime/redphone/signaling/RedPhoneTrustStore.java @@ -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; diff --git a/src/org/thoughtcrime/redphone/signaling/SignalingSocket.java b/src/org/thoughtcrime/redphone/signaling/SignalingSocket.java index d3b954da75..2ffb140361 100644 --- a/src/org/thoughtcrime/redphone/signaling/SignalingSocket.java +++ b/src/org/thoughtcrime/redphone/signaling/SignalingSocket.java @@ -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; diff --git a/src/org/thoughtcrime/redphone/signaling/signals/InitiateSignal.java b/src/org/thoughtcrime/redphone/signaling/signals/InitiateSignal.java index a01693d747..65da5f0cdf 100644 --- a/src/org/thoughtcrime/redphone/signaling/signals/InitiateSignal.java +++ b/src/org/thoughtcrime/redphone/signaling/signals/InitiateSignal.java @@ -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. diff --git a/src/org/thoughtcrime/securesms/ApplicationContext.java b/src/org/thoughtcrime/securesms/ApplicationContext.java index 8fbc6ff0c0..25ea0de618 100644 --- a/src/org/thoughtcrime/securesms/ApplicationContext.java +++ b/src/org/thoughtcrime/securesms/ApplicationContext.java @@ -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() { diff --git a/src/org/thoughtcrime/securesms/ConfirmIdentityDialog.java b/src/org/thoughtcrime/securesms/ConfirmIdentityDialog.java index 4e32c1b132..e8534f34db 100644 --- a/src/org/thoughtcrime/securesms/ConfirmIdentityDialog.java +++ b/src/org/thoughtcrime/securesms/ConfirmIdentityDialog.java @@ -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); diff --git a/src/org/thoughtcrime/securesms/ConversationActivity.java b/src/org/thoughtcrime/securesms/ConversationActivity.java index fbf651d436..1504e885a0 100644 --- a/src/org/thoughtcrime/securesms/ConversationActivity.java +++ b/src/org/thoughtcrime/securesms/ConversationActivity.java @@ -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 diff --git a/src/org/thoughtcrime/securesms/ConversationItem.java b/src/org/thoughtcrime/securesms/ConversationItem.java index c2bbfa9121..01e1ca07a2 100644 --- a/src/org/thoughtcrime/securesms/ConversationItem.java +++ b/src/org/thoughtcrime/securesms/ConversationItem.java @@ -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; diff --git a/src/org/thoughtcrime/securesms/ConversationListFragment.java b/src/org/thoughtcrime/securesms/ConversationListFragment.java index 6bbf8c6047..b054569c37 100644 --- a/src/org/thoughtcrime/securesms/ConversationListFragment.java +++ b/src/org/thoughtcrime/securesms/ConversationListFragment.java @@ -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; diff --git a/src/org/thoughtcrime/securesms/DeviceActivity.java b/src/org/thoughtcrime/securesms/DeviceActivity.java index f24cdea9f9..4f364a9ddd 100644 --- a/src/org/thoughtcrime/securesms/DeviceActivity.java +++ b/src/org/thoughtcrime/securesms/DeviceActivity.java @@ -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!"); diff --git a/src/org/thoughtcrime/securesms/DeviceListFragment.java b/src/org/thoughtcrime/securesms/DeviceListFragment.java index 5907f9ec1f..c7a5bda65d 100644 --- a/src/org/thoughtcrime/securesms/DeviceListFragment.java +++ b/src/org/thoughtcrime/securesms/DeviceListFragment.java @@ -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; diff --git a/src/org/thoughtcrime/securesms/DeviceListItem.java b/src/org/thoughtcrime/securesms/DeviceListItem.java index bd6ba2b6e4..70bc593179 100644 --- a/src/org/thoughtcrime/securesms/DeviceListItem.java +++ b/src/org/thoughtcrime/securesms/DeviceListItem.java @@ -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; diff --git a/src/org/thoughtcrime/securesms/ExperienceUpgradeActivity.java b/src/org/thoughtcrime/securesms/ExperienceUpgradeActivity.java index ffb9a88ecb..caf9809fbc 100644 --- a/src/org/thoughtcrime/securesms/ExperienceUpgradeActivity.java +++ b/src/org/thoughtcrime/securesms/ExperienceUpgradeActivity.java @@ -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; diff --git a/src/org/thoughtcrime/securesms/GroupCreateActivity.java b/src/org/thoughtcrime/securesms/GroupCreateActivity.java index dc1a33cc70..80fc558757 100644 --- a/src/org/thoughtcrime/securesms/GroupCreateActivity.java +++ b/src/org/thoughtcrime/securesms/GroupCreateActivity.java @@ -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; diff --git a/src/org/thoughtcrime/securesms/GroupMembersDialog.java b/src/org/thoughtcrime/securesms/GroupMembersDialog.java index cfca22f04d..be6859d617 100644 --- a/src/org/thoughtcrime/securesms/GroupMembersDialog.java +++ b/src/org/thoughtcrime/securesms/GroupMembersDialog.java @@ -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; diff --git a/src/org/thoughtcrime/securesms/InviteActivity.java b/src/org/thoughtcrime/securesms/InviteActivity.java index b16c73c749..dc2e4ccb8d 100644 --- a/src/org/thoughtcrime/securesms/InviteActivity.java +++ b/src/org/thoughtcrime/securesms/InviteActivity.java @@ -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; diff --git a/src/org/thoughtcrime/securesms/KeyScanningActivity.java b/src/org/thoughtcrime/securesms/KeyScanningActivity.java index 8e745b8fe2..234e558298 100644 --- a/src/org/thoughtcrime/securesms/KeyScanningActivity.java +++ b/src/org/thoughtcrime/securesms/KeyScanningActivity.java @@ -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. diff --git a/src/org/thoughtcrime/securesms/RegistrationActivity.java b/src/org/thoughtcrime/securesms/RegistrationActivity.java index 61b94f92f6..cc7c8e031e 100644 --- a/src/org/thoughtcrime/securesms/RegistrationActivity.java +++ b/src/org/thoughtcrime/securesms/RegistrationActivity.java @@ -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 diff --git a/src/org/thoughtcrime/securesms/RegistrationProgressActivity.java b/src/org/thoughtcrime/securesms/RegistrationProgressActivity.java index 0e7feeee0d..6f193b3bd7 100644 --- a/src/org/thoughtcrime/securesms/RegistrationProgressActivity.java +++ b/src/org/thoughtcrime/securesms/RegistrationProgressActivity.java @@ -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; diff --git a/src/org/thoughtcrime/securesms/TransportOption.java b/src/org/thoughtcrime/securesms/TransportOption.java index 7d91d1c04a..de21cb0f66 100644 --- a/src/org/thoughtcrime/securesms/TransportOption.java +++ b/src/org/thoughtcrime/securesms/TransportOption.java @@ -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 { diff --git a/src/org/thoughtcrime/securesms/TransportOptions.java b/src/org/thoughtcrime/securesms/TransportOptions.java index ccbc66143c..a8aca89b3e 100644 --- a/src/org/thoughtcrime/securesms/TransportOptions.java +++ b/src/org/thoughtcrime/securesms/TransportOptions.java @@ -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; diff --git a/src/org/thoughtcrime/securesms/VerifyIdentityActivity.java b/src/org/thoughtcrime/securesms/VerifyIdentityActivity.java index a212fd6329..95b7e5f153 100644 --- a/src/org/thoughtcrime/securesms/VerifyIdentityActivity.java +++ b/src/org/thoughtcrime/securesms/VerifyIdentityActivity.java @@ -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; diff --git a/src/org/thoughtcrime/securesms/ViewIdentityActivity.java b/src/org/thoughtcrime/securesms/ViewIdentityActivity.java index 6cd7dde8ac..210850deff 100644 --- a/src/org/thoughtcrime/securesms/ViewIdentityActivity.java +++ b/src/org/thoughtcrime/securesms/ViewIdentityActivity.java @@ -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; /** diff --git a/src/org/thoughtcrime/securesms/attachments/PointerAttachment.java b/src/org/thoughtcrime/securesms/attachments/PointerAttachment.java index 7f666db109..cf03ee882e 100644 --- a/src/org/thoughtcrime/securesms/attachments/PointerAttachment.java +++ b/src/org/thoughtcrime/securesms/attachments/PointerAttachment.java @@ -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 forPointers(@NonNull MasterSecretUnion masterSecret, Optional> pointers) { + public static List forPointers(@NonNull MasterSecretUnion masterSecret, Optional> pointers) { List 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(), diff --git a/src/org/thoughtcrime/securesms/attachments/UriAttachment.java b/src/org/thoughtcrime/securesms/attachments/UriAttachment.java index c7b73bd528..ea6828bc76 100644 --- a/src/org/thoughtcrime/securesms/attachments/UriAttachment.java +++ b/src/org/thoughtcrime/securesms/attachments/UriAttachment.java @@ -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; diff --git a/src/org/thoughtcrime/securesms/audio/AudioSlidePlayer.java b/src/org/thoughtcrime/securesms/audio/AudioSlidePlayer.java index 13f62835d9..fe4d29b6e1 100644 --- a/src/org/thoughtcrime/securesms/audio/AudioSlidePlayer.java +++ b/src/org/thoughtcrime/securesms/audio/AudioSlidePlayer.java @@ -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; diff --git a/src/org/thoughtcrime/securesms/components/SendButton.java b/src/org/thoughtcrime/securesms/components/SendButton.java index f0e6d4e72e..9ef421d2b1 100644 --- a/src/org/thoughtcrime/securesms/components/SendButton.java +++ b/src/org/thoughtcrime/securesms/components/SendButton.java @@ -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, diff --git a/src/org/thoughtcrime/securesms/components/ThumbnailView.java b/src/org/thoughtcrime/securesms/components/ThumbnailView.java index be2faf1971..e75a8b8d34 100644 --- a/src/org/thoughtcrime/securesms/components/ThumbnailView.java +++ b/src/org/thoughtcrime/securesms/components/ThumbnailView.java @@ -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 { diff --git a/src/org/thoughtcrime/securesms/components/camera/CameraView.java b/src/org/thoughtcrime/securesms/components/camera/CameraView.java index c00d264b2e..ce771fe2c3 100644 --- a/src/org/thoughtcrime/securesms/components/camera/CameraView.java +++ b/src/org/thoughtcrime/securesms/components/camera/CameraView.java @@ -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 { diff --git a/src/org/thoughtcrime/securesms/contacts/ContactsDatabase.java b/src/org/thoughtcrime/securesms/contacts/ContactsDatabase.java index 35ccba3f63..a55c1d9e31 100644 --- a/src/org/thoughtcrime/securesms/contacts/ContactsDatabase.java +++ b/src/org/thoughtcrime/securesms/contacts/ContactsDatabase.java @@ -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; diff --git a/src/org/thoughtcrime/securesms/crypto/AsymmetricMasterCipher.java b/src/org/thoughtcrime/securesms/crypto/AsymmetricMasterCipher.java index 23255c5206..c38c5d08ca 100644 --- a/src/org/thoughtcrime/securesms/crypto/AsymmetricMasterCipher.java +++ b/src/org/thoughtcrime/securesms/crypto/AsymmetricMasterCipher.java @@ -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; diff --git a/src/org/thoughtcrime/securesms/crypto/AsymmetricMasterSecret.java b/src/org/thoughtcrime/securesms/crypto/AsymmetricMasterSecret.java index bc82032e34..36dfe4b1d8 100644 --- a/src/org/thoughtcrime/securesms/crypto/AsymmetricMasterSecret.java +++ b/src/org/thoughtcrime/securesms/crypto/AsymmetricMasterSecret.java @@ -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 diff --git a/src/org/thoughtcrime/securesms/crypto/IdentityKeyParcelable.java b/src/org/thoughtcrime/securesms/crypto/IdentityKeyParcelable.java index 4969e8f3e8..d03ec492cd 100644 --- a/src/org/thoughtcrime/securesms/crypto/IdentityKeyParcelable.java +++ b/src/org/thoughtcrime/securesms/crypto/IdentityKeyParcelable.java @@ -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 { diff --git a/src/org/thoughtcrime/securesms/crypto/IdentityKeyUtil.java b/src/org/thoughtcrime/securesms/crypto/IdentityKeyUtil.java index 6b1168e8b2..f7a9bb6d81 100644 --- a/src/org/thoughtcrime/securesms/crypto/IdentityKeyUtil.java +++ b/src/org/thoughtcrime/securesms/crypto/IdentityKeyUtil.java @@ -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; diff --git a/src/org/thoughtcrime/securesms/crypto/MasterCipher.java b/src/org/thoughtcrime/securesms/crypto/MasterCipher.java index 969320391c..701f5c2b34 100644 --- a/src/org/thoughtcrime/securesms/crypto/MasterCipher.java +++ b/src/org/thoughtcrime/securesms/crypto/MasterCipher.java @@ -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); } } diff --git a/src/org/thoughtcrime/securesms/crypto/MasterSecretUnion.java b/src/org/thoughtcrime/securesms/crypto/MasterSecretUnion.java index 121562630f..26b8ad1edc 100644 --- a/src/org/thoughtcrime/securesms/crypto/MasterSecretUnion.java +++ b/src/org/thoughtcrime/securesms/crypto/MasterSecretUnion.java @@ -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 { diff --git a/src/org/thoughtcrime/securesms/crypto/MasterSecretUtil.java b/src/org/thoughtcrime/securesms/crypto/MasterSecretUtil.java index 598fdfc28a..a0f2cd4507 100644 --- a/src/org/thoughtcrime/securesms/crypto/MasterSecretUtil.java +++ b/src/org/thoughtcrime/securesms/crypto/MasterSecretUtil.java @@ -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; diff --git a/src/org/thoughtcrime/securesms/crypto/MediaKey.java b/src/org/thoughtcrime/securesms/crypto/MediaKey.java index 058b5448fe..1c25b5ac5f 100644 --- a/src/org/thoughtcrime/securesms/crypto/MediaKey.java +++ b/src/org/thoughtcrime/securesms/crypto/MediaKey.java @@ -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; diff --git a/src/org/thoughtcrime/securesms/crypto/PreKeyUtil.java b/src/org/thoughtcrime/securesms/crypto/PreKeyUtil.java index b857946886..7333bfbfa9 100644 --- a/src/org/thoughtcrime/securesms/crypto/PreKeyUtil.java +++ b/src/org/thoughtcrime/securesms/crypto/PreKeyUtil.java @@ -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; diff --git a/src/org/thoughtcrime/securesms/crypto/PublicKey.java b/src/org/thoughtcrime/securesms/crypto/PublicKey.java index 58f9795518..c94ca3cf7f 100644 --- a/src/org/thoughtcrime/securesms/crypto/PublicKey.java +++ b/src/org/thoughtcrime/securesms/crypto/PublicKey.java @@ -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; diff --git a/src/org/thoughtcrime/securesms/crypto/SessionUtil.java b/src/org/thoughtcrime/securesms/crypto/SessionUtil.java index 3953643dbb..d1974face3 100644 --- a/src/org/thoughtcrime/securesms/crypto/SessionUtil.java +++ b/src/org/thoughtcrime/securesms/crypto/SessionUtil.java @@ -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); } diff --git a/src/org/thoughtcrime/securesms/crypto/storage/TextSecureAxolotlStore.java b/src/org/thoughtcrime/securesms/crypto/storage/SignalProtocolStoreImpl.java similarity index 71% rename from src/org/thoughtcrime/securesms/crypto/storage/TextSecureAxolotlStore.java rename to src/org/thoughtcrime/securesms/crypto/storage/SignalProtocolStoreImpl.java index 51d35aeed2..797bf4b029 100644 --- a/src/org/thoughtcrime/securesms/crypto/storage/TextSecureAxolotlStore.java +++ b/src/org/thoughtcrime/securesms/crypto/storage/SignalProtocolStoreImpl.java @@ -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); } diff --git a/src/org/thoughtcrime/securesms/crypto/storage/TextSecureIdentityKeyStore.java b/src/org/thoughtcrime/securesms/crypto/storage/TextSecureIdentityKeyStore.java index f3a6de3d7c..a801806765 100644 --- a/src/org/thoughtcrime/securesms/crypto/storage/TextSecureIdentityKeyStore.java +++ b/src/org/thoughtcrime/securesms/crypto/storage/TextSecureIdentityKeyStore.java @@ -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 { diff --git a/src/org/thoughtcrime/securesms/crypto/storage/TextSecurePreKeyStore.java b/src/org/thoughtcrime/securesms/crypto/storage/TextSecurePreKeyStore.java index 31bd1c49d5..68c727caa5 100644 --- a/src/org/thoughtcrime/securesms/crypto/storage/TextSecurePreKeyStore.java +++ b/src/org/thoughtcrime/securesms/crypto/storage/TextSecurePreKeyStore.java @@ -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; diff --git a/src/org/thoughtcrime/securesms/crypto/storage/TextSecureSessionStore.java b/src/org/thoughtcrime/securesms/crypto/storage/TextSecureSessionStore.java index 05b36c65d0..fcab61ba47 100644 --- a/src/org/thoughtcrime/securesms/crypto/storage/TextSecureSessionStore.java +++ b/src/org/thoughtcrime/securesms/crypto/storage/TextSecureSessionStore.java @@ -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 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; diff --git a/src/org/thoughtcrime/securesms/database/ApnDatabase.java b/src/org/thoughtcrime/securesms/database/ApnDatabase.java index ea3d872c8d..ad069ea6b0 100644 --- a/src/org/thoughtcrime/securesms/database/ApnDatabase.java +++ b/src/org/thoughtcrime/securesms/database/ApnDatabase.java @@ -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; diff --git a/src/org/thoughtcrime/securesms/database/CanonicalAddressDatabase.java b/src/org/thoughtcrime/securesms/database/CanonicalAddressDatabase.java index 934795c549..9c0b76d460 100644 --- a/src/org/thoughtcrime/securesms/database/CanonicalAddressDatabase.java +++ b/src/org/thoughtcrime/securesms/database/CanonicalAddressDatabase.java @@ -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; diff --git a/src/org/thoughtcrime/securesms/database/DatabaseFactory.java b/src/org/thoughtcrime/securesms/database/DatabaseFactory.java index 8329150e4e..c541564d91 100644 --- a/src/org/thoughtcrime/securesms/database/DatabaseFactory.java +++ b/src/org/thoughtcrime/securesms/database/DatabaseFactory.java @@ -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; diff --git a/src/org/thoughtcrime/securesms/database/DraftDatabase.java b/src/org/thoughtcrime/securesms/database/DraftDatabase.java index 30470de9ba..886dd2b314 100644 --- a/src/org/thoughtcrime/securesms/database/DraftDatabase.java +++ b/src/org/thoughtcrime/securesms/database/DraftDatabase.java @@ -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; diff --git a/src/org/thoughtcrime/securesms/database/EncryptingSmsDatabase.java b/src/org/thoughtcrime/securesms/database/EncryptingSmsDatabase.java index 9109db04fa..b91b204385 100644 --- a/src/org/thoughtcrime/securesms/database/EncryptingSmsDatabase.java +++ b/src/org/thoughtcrime/securesms/database/EncryptingSmsDatabase.java @@ -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; diff --git a/src/org/thoughtcrime/securesms/database/GroupDatabase.java b/src/org/thoughtcrime/securesms/database/GroupDatabase.java index d11fbfa56b..cb687b3bd6 100644 --- a/src/org/thoughtcrime/securesms/database/GroupDatabase.java +++ b/src/org/thoughtcrime/securesms/database/GroupDatabase.java @@ -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 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); diff --git a/src/org/thoughtcrime/securesms/database/IdentityDatabase.java b/src/org/thoughtcrime/securesms/database/IdentityDatabase.java index 5868bdcc40..571f0f65b7 100644 --- a/src/org/thoughtcrime/securesms/database/IdentityDatabase.java +++ b/src/org/thoughtcrime/securesms/database/IdentityDatabase.java @@ -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; diff --git a/src/org/thoughtcrime/securesms/database/MessagingDatabase.java b/src/org/thoughtcrime/securesms/database/MessagingDatabase.java index 5dd1010035..3e05c2ddc7 100644 --- a/src/org/thoughtcrime/securesms/database/MessagingDatabase.java +++ b/src/org/thoughtcrime/securesms/database/MessagingDatabase.java @@ -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; diff --git a/src/org/thoughtcrime/securesms/database/MmsDatabase.java b/src/org/thoughtcrime/securesms/database/MmsDatabase.java index fea87f5509..8f0aa7e2ea 100644 --- a/src/org/thoughtcrime/securesms/database/MmsDatabase.java +++ b/src/org/thoughtcrime/securesms/database/MmsDatabase.java @@ -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; diff --git a/src/org/thoughtcrime/securesms/database/MmsSmsDatabase.java b/src/org/thoughtcrime/securesms/database/MmsSmsDatabase.java index 64de15e990..dfccd983ef 100644 --- a/src/org/thoughtcrime/securesms/database/MmsSmsDatabase.java +++ b/src/org/thoughtcrime/securesms/database/MmsSmsDatabase.java @@ -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; diff --git a/src/org/thoughtcrime/securesms/database/PushDatabase.java b/src/org/thoughtcrime/securesms/database/PushDatabase.java index 1328290b75..c0cf991f53 100644 --- a/src/org/thoughtcrime/securesms/database/PushDatabase.java +++ b/src/org/thoughtcrime/securesms/database/PushDatabase.java @@ -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 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 find(TextSecureEnvelope envelope) { + private Optional 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); } diff --git a/src/org/thoughtcrime/securesms/database/RecipientPreferenceDatabase.java b/src/org/thoughtcrime/securesms/database/RecipientPreferenceDatabase.java index 7d1271acb6..1b626486f2 100644 --- a/src/org/thoughtcrime/securesms/database/RecipientPreferenceDatabase.java +++ b/src/org/thoughtcrime/securesms/database/RecipientPreferenceDatabase.java @@ -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; diff --git a/src/org/thoughtcrime/securesms/database/SmsDatabase.java b/src/org/thoughtcrime/securesms/database/SmsDatabase.java index e893a531df..16038b7174 100644 --- a/src/org/thoughtcrime/securesms/database/SmsDatabase.java +++ b/src/org/thoughtcrime/securesms/database/SmsDatabase.java @@ -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; diff --git a/src/org/thoughtcrime/securesms/database/TextSecureDirectory.java b/src/org/thoughtcrime/securesms/database/TextSecureDirectory.java index 5370fc0bd7..91d153b638 100644 --- a/src/org/thoughtcrime/securesms/database/TextSecureDirectory.java +++ b/src/org/thoughtcrime/securesms/database/TextSecureDirectory.java @@ -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; diff --git a/src/org/thoughtcrime/securesms/database/ThreadDatabase.java b/src/org/thoughtcrime/securesms/database/ThreadDatabase.java index 17b7dfc651..0eb544d45c 100644 --- a/src/org/thoughtcrime/securesms/database/ThreadDatabase.java +++ b/src/org/thoughtcrime/securesms/database/ThreadDatabase.java @@ -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; diff --git a/src/org/thoughtcrime/securesms/database/documents/IdentityKeyMismatch.java b/src/org/thoughtcrime/securesms/database/documents/IdentityKeyMismatch.java index 1d1c63f97a..ff7a48356f 100644 --- a/src/org/thoughtcrime/securesms/database/documents/IdentityKeyMismatch.java +++ b/src/org/thoughtcrime/securesms/database/documents/IdentityKeyMismatch.java @@ -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; diff --git a/src/org/thoughtcrime/securesms/database/loaders/CountryListLoader.java b/src/org/thoughtcrime/securesms/database/loaders/CountryListLoader.java index 5083f1dc17..22b85a19a8 100644 --- a/src/org/thoughtcrime/securesms/database/loaders/CountryListLoader.java +++ b/src/org/thoughtcrime/securesms/database/loaders/CountryListLoader.java @@ -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>> { diff --git a/src/org/thoughtcrime/securesms/database/loaders/DeviceListLoader.java b/src/org/thoughtcrime/securesms/database/loaders/DeviceListLoader.java index dfdf07ce39..48e70be1de 100644 --- a/src/org/thoughtcrime/securesms/database/loaders/DeviceListLoader.java +++ b/src/org/thoughtcrime/securesms/database/loaders/DeviceListLoader.java @@ -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> { 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> { Iterator iterator = devices.iterator(); while (iterator.hasNext()) { - if ((iterator.next().getId() == TextSecureAddress.DEFAULT_DEVICE_ID)) { + if ((iterator.next().getId() == SignalServiceAddress.DEFAULT_DEVICE_ID)) { iterator.remove(); } } diff --git a/src/org/thoughtcrime/securesms/dependencies/AxolotlStorageModule.java b/src/org/thoughtcrime/securesms/dependencies/AxolotlStorageModule.java index 5e5d51301a..4d4029261e 100644 --- a/src/org/thoughtcrime/securesms/dependencies/AxolotlStorageModule.java +++ b/src/org/thoughtcrime/securesms/dependencies/AxolotlStorageModule.java @@ -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); } }; } diff --git a/src/org/thoughtcrime/securesms/dependencies/TextSecureCommunicationModule.java b/src/org/thoughtcrime/securesms/dependencies/TextSecureCommunicationModule.java index 44b0ed57cf..c1945264e3 100644 --- a/src/org/thoughtcrime/securesms/dependencies/TextSecureCommunicationModule.java +++ b/src/org/thoughtcrime/securesms/dependencies/TextSecureCommunicationModule.java @@ -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.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.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 { diff --git a/src/org/thoughtcrime/securesms/groups/GroupManager.java b/src/org/thoughtcrime/securesms/groups/GroupManager.java index adc2f4da57..3243d6fbb6 100644 --- a/src/org/thoughtcrime/securesms/groups/GroupManager.java +++ b/src/org/thoughtcrime/securesms/groups/GroupManager.java @@ -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; diff --git a/src/org/thoughtcrime/securesms/groups/GroupMessageProcessor.java b/src/org/thoughtcrime/securesms/groups/GroupMessageProcessor.java index 1387604b4e..1b9b17e306 100644 --- a/src/org/thoughtcrime/securesms/groups/GroupMessageProcessor.java +++ b/src/org/thoughtcrime/securesms/groups/GroupMessageProcessor.java @@ -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())); diff --git a/src/org/thoughtcrime/securesms/jobs/AttachmentDownloadJob.java b/src/org/thoughtcrime/securesms/jobs/AttachmentDownloadJob.java index ee46d4ed7c..af91ddc74b 100644 --- a/src/org/thoughtcrime/securesms/jobs/AttachmentDownloadJob.java +++ b/src/org/thoughtcrime/securesms/jobs/AttachmentDownloadJob.java @@ -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); diff --git a/src/org/thoughtcrime/securesms/jobs/AvatarDownloadJob.java b/src/org/thoughtcrime/securesms/jobs/AvatarDownloadJob.java index fc260acd1b..eef39c6f1c 100644 --- a/src/org/thoughtcrime/securesms/jobs/AvatarDownloadJob.java +++ b/src/org/thoughtcrime/securesms/jobs/AvatarDownloadJob.java @@ -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; diff --git a/src/org/thoughtcrime/securesms/jobs/CleanPreKeysJob.java b/src/org/thoughtcrime/securesms/jobs/CleanPreKeysJob.java index a00e1a7117..22d597ccd1 100644 --- a/src/org/thoughtcrime/securesms/jobs/CleanPreKeysJob.java +++ b/src/org/thoughtcrime/securesms/jobs/CleanPreKeysJob.java @@ -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) { diff --git a/src/org/thoughtcrime/securesms/jobs/CreateSignedPreKeyJob.java b/src/org/thoughtcrime/securesms/jobs/CreateSignedPreKeyJob.java index b0828ef9fe..424dce8bca 100644 --- a/src/org/thoughtcrime/securesms/jobs/CreateSignedPreKeyJob.java +++ b/src/org/thoughtcrime/securesms/jobs/CreateSignedPreKeyJob.java @@ -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() diff --git a/src/org/thoughtcrime/securesms/jobs/DeliveryReceiptJob.java b/src/org/thoughtcrime/securesms/jobs/DeliveryReceiptJob.java index 4e4f04ac85..8765fa53dc 100644 --- a/src/org/thoughtcrime/securesms/jobs/DeliveryReceiptJob.java +++ b/src/org/thoughtcrime/securesms/jobs/DeliveryReceiptJob.java @@ -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); } diff --git a/src/org/thoughtcrime/securesms/jobs/DirectoryRefreshJob.java b/src/org/thoughtcrime/securesms/jobs/DirectoryRefreshJob.java index 8202dc589b..cdc6a515dd 100644 --- a/src/org/thoughtcrime/securesms/jobs/DirectoryRefreshJob.java +++ b/src/org/thoughtcrime/securesms/jobs/DirectoryRefreshJob.java @@ -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; diff --git a/src/org/thoughtcrime/securesms/jobs/GcmRefreshJob.java b/src/org/thoughtcrime/securesms/jobs/GcmRefreshJob.java index c704864bbb..1895868d87 100644 --- a/src/org/thoughtcrime/securesms/jobs/GcmRefreshJob.java +++ b/src/org/thoughtcrime/securesms/jobs/GcmRefreshJob.java @@ -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()); diff --git a/src/org/thoughtcrime/securesms/jobs/MasterSecretDecryptJob.java b/src/org/thoughtcrime/securesms/jobs/MasterSecretDecryptJob.java index 161a82711d..b126b1edf9 100644 --- a/src/org/thoughtcrime/securesms/jobs/MasterSecretDecryptJob.java +++ b/src/org/thoughtcrime/securesms/jobs/MasterSecretDecryptJob.java @@ -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; diff --git a/src/org/thoughtcrime/securesms/jobs/MmsDownloadJob.java b/src/org/thoughtcrime/securesms/jobs/MmsDownloadJob.java index 260277d17d..9a40bc701e 100644 --- a/src/org/thoughtcrime/securesms/jobs/MmsDownloadJob.java +++ b/src/org/thoughtcrime/securesms/jobs/MmsDownloadJob.java @@ -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; diff --git a/src/org/thoughtcrime/securesms/jobs/MultiDeviceContactUpdateJob.java b/src/org/thoughtcrime/securesms/jobs/MultiDeviceContactUpdateJob.java index f0a9dffb99..1cc85a1571 100644 --- a/src/org/thoughtcrime/securesms/jobs/MultiDeviceContactUpdateJob.java +++ b/src/org/thoughtcrime/securesms/jobs/MultiDeviceContactUpdateJob.java @@ -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 getAvatar(Uri uri) throws IOException { + private Optional 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()); } } diff --git a/src/org/thoughtcrime/securesms/jobs/MultiDeviceGroupUpdateJob.java b/src/org/thoughtcrime/securesms/jobs/MultiDeviceGroupUpdateJob.java index 9603e0df5a..2aacd90087 100644 --- a/src/org/thoughtcrime/securesms/jobs/MultiDeviceGroupUpdateJob.java +++ b/src/org/thoughtcrime/securesms/jobs/MultiDeviceGroupUpdateJob.java @@ -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 getAvatar(@Nullable byte[] avatar) { + private Optional 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 { diff --git a/src/org/thoughtcrime/securesms/jobs/MultiDeviceReadUpdateJob.java b/src/org/thoughtcrime/securesms/jobs/MultiDeviceReadUpdateJob.java index 1a3a671a6c..efa06278cb 100644 --- a/src/org/thoughtcrime/securesms/jobs/MultiDeviceReadUpdateJob.java +++ b/src/org/thoughtcrime/securesms/jobs/MultiDeviceReadUpdateJob.java @@ -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 diff --git a/src/org/thoughtcrime/securesms/jobs/PushContentReceiveJob.java b/src/org/thoughtcrime/securesms/jobs/PushContentReceiveJob.java index 7869e42517..f1ef2fefb5 100644 --- a/src/org/thoughtcrime/securesms/jobs/PushContentReceiveJob.java +++ b/src/org/thoughtcrime/securesms/jobs/PushContentReceiveJob.java @@ -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) { diff --git a/src/org/thoughtcrime/securesms/jobs/PushDecryptJob.java b/src/org/thoughtcrime/securesms/jobs/PushDecryptJob.java index 440d4e9c67..c9bdfa469b 100644 --- a/src/org/thoughtcrime/securesms/jobs/PushDecryptJob.java +++ b/src/org/thoughtcrime/securesms/jobs/PushDecryptJob.java @@ -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 optionalSmsMessageId = smsMessageId > 0 ? Optional.of(smsMessageId) : + MasterSecret masterSecret = KeyCachingService.getMasterSecret(context); + PushDatabase database = DatabaseFactory.getPushDatabase(context); + SignalServiceEnvelope envelope = database.get(messageId); + Optional optionalSmsMessageId = smsMessageId > 0 ? Optional.of(smsMessageId) : Optional.absent(); MasterSecretUnion masterSecretUnion; @@ -129,23 +128,23 @@ public class PushDecryptJob extends ContextJob { } - private void handleMessage(MasterSecretUnion masterSecret, TextSecureEnvelope envelope, Optional smsMessageId) { + private void handleMessage(MasterSecretUnion masterSecret, SignalServiceEnvelope envelope, Optional 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 smsMessageId) + private void handleEndSessionMessage(@NonNull MasterSecretUnion masterSecret, + @NonNull SignalServiceEnvelope envelope, + @NonNull SignalServiceDataMessage message, + @NonNull Optional smsMessageId) { EncryptingSmsDatabase smsDatabase = DatabaseFactory.getEncryptingSmsDatabase(context); IncomingTextMessage incomingTextMessage = new IncomingTextMessage(envelope.getSource(), envelope.getSourceDevice(), message.getTimestamp(), - "", Optional.absent()); + "", Optional.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 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 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 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 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 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 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 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 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 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 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.absent()); + Optional.absent()); if (!smsMessageId.isPresent()) { IncomingPreKeyBundleMessage bundleMessage = new IncomingPreKeyBundleMessage(textMessage, encoded); @@ -489,11 +488,11 @@ public class PushDecryptJob extends ContextJob { } } - private Pair insertPlaceholder(@NonNull TextSecureEnvelope envelope) { + private Pair insertPlaceholder(@NonNull SignalServiceEnvelope envelope) { EncryptingSmsDatabase database = DatabaseFactory.getEncryptingSmsDatabase(context); IncomingTextMessage textMessage = new IncomingTextMessage(envelope.getSource(), envelope.getSourceDevice(), envelope.getTimestamp(), "", - Optional.absent()); + Optional.absent()); textMessage = new IncomingEncryptedMessage(textMessage, ""); return database.insertMessageInbox(textMessage); diff --git a/src/org/thoughtcrime/securesms/jobs/PushGroupSendJob.java b/src/org/thoughtcrime/securesms/jobs/PushGroupSendJob.java index 30c9ad85a6..40f6a654c1 100644 --- a/src/org/thoughtcrime/securesms/jobs/PushGroupSendJob.java +++ b/src/org/thoughtcrime/securesms/jobs/PushGroupSendJob.java @@ -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 attachments = getAttachmentsFor(masterSecret, message.getAttachments()); - List addresses; + SignalServiceMessageSender messageSender = messageSenderFactory.create(); + byte[] groupId = GroupUtil.getDecodedId(message.getRecipients().getPrimaryRecipient().getNumber()); + Recipients recipients = DatabaseFactory.getGroupDatabase(context).getGroupMembers(groupId, false); + List attachments = getAttachmentsFor(masterSecret, message.getAttachments()); + List 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 getPushAddresses(Recipients recipients) throws InvalidNumberException { - List addresses = new LinkedList<>(); + private List getPushAddresses(Recipients recipients) throws InvalidNumberException { + List 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 getPushAddresses(long filterRecipientId) throws InvalidNumberException { - List addresses = new LinkedList<>(); + private List getPushAddresses(long filterRecipientId) throws InvalidNumberException { + List addresses = new LinkedList<>(); addresses.add(getPushAddress(RecipientFactory.getRecipientForId(context, filterRecipientId, false).getNumber())); return addresses; } diff --git a/src/org/thoughtcrime/securesms/jobs/PushMediaSendJob.java b/src/org/thoughtcrime/securesms/jobs/PushMediaSendJob.java index 1ca0aabeed..416113f802 100644 --- a/src/org/thoughtcrime/securesms/jobs/PushMediaSendJob.java +++ b/src/org/thoughtcrime/securesms/jobs/PushMediaSendJob.java @@ -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 scaledAttachments = scaleAttachments(masterSecret, MediaConstraints.PUSH_CONSTRAINTS, message.getAttachments()); - List 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 scaledAttachments = scaleAttachments(masterSecret, MediaConstraints.PUSH_CONSTRAINTS, message.getAttachments()); + List 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) { diff --git a/src/org/thoughtcrime/securesms/jobs/PushNotificationReceiveJob.java b/src/org/thoughtcrime/securesms/jobs/PushNotificationReceiveJob.java index f27d1bf683..fde0478a39 100644 --- a/src/org/thoughtcrime/securesms/jobs/PushNotificationReceiveJob.java +++ b/src/org/thoughtcrime/securesms/jobs/PushNotificationReceiveJob.java @@ -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); } }); diff --git a/src/org/thoughtcrime/securesms/jobs/PushReceivedJob.java b/src/org/thoughtcrime/securesms/jobs/PushReceivedJob.java index 747875090d..0bd5cc94cd 100644 --- a/src/org/thoughtcrime/securesms/jobs/PushReceivedJob.java +++ b/src/org/thoughtcrime/securesms/jobs/PushReceivedJob.java @@ -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())); diff --git a/src/org/thoughtcrime/securesms/jobs/PushSendJob.java b/src/org/thoughtcrime/securesms/jobs/PushSendJob.java index 02d1f633fe..6f79d5f19a 100644 --- a/src/org/thoughtcrime/securesms/jobs/PushSendJob.java +++ b/src/org/thoughtcrime/securesms/jobs/PushSendJob.java @@ -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 getAttachmentsFor(MasterSecret masterSecret, List parts) { - List attachments = new LinkedList<>(); + protected List getAttachmentsFor(MasterSecret masterSecret, List parts) { + List 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); } diff --git a/src/org/thoughtcrime/securesms/jobs/PushTextSendJob.java b/src/org/thoughtcrime/securesms/jobs/PushTextSendJob.java index 2d3730c5a7..f7db1af6bf 100644 --- a/src/org/thoughtcrime/securesms/jobs/PushTextSendJob.java +++ b/src/org/thoughtcrime/securesms/jobs/PushTextSendJob.java @@ -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); diff --git a/src/org/thoughtcrime/securesms/jobs/RefreshAttributesJob.java b/src/org/thoughtcrime/securesms/jobs/RefreshAttributesJob.java index 654b3ce304..f1a0669a22 100644 --- a/src/org/thoughtcrime/securesms/jobs/RefreshAttributesJob.java +++ b/src/org/thoughtcrime/securesms/jobs/RefreshAttributesJob.java @@ -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() diff --git a/src/org/thoughtcrime/securesms/jobs/RefreshPreKeysJob.java b/src/org/thoughtcrime/securesms/jobs/RefreshPreKeysJob.java index aac7109884..8c088d3c4a 100644 --- a/src/org/thoughtcrime/securesms/jobs/RefreshPreKeysJob.java +++ b/src/org/thoughtcrime/securesms/jobs/RefreshPreKeysJob.java @@ -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() diff --git a/src/org/thoughtcrime/securesms/jobs/SmsReceiveJob.java b/src/org/thoughtcrime/securesms/jobs/SmsReceiveJob.java index a829c56eed..0bfa174b42 100644 --- a/src/org/thoughtcrime/securesms/jobs/SmsReceiveJob.java +++ b/src/org/thoughtcrime/securesms/jobs/SmsReceiveJob.java @@ -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; diff --git a/src/org/thoughtcrime/securesms/jobs/SmsSentJob.java b/src/org/thoughtcrime/securesms/jobs/SmsSentJob.java index 503323def8..f9b51a5031 100644 --- a/src/org/thoughtcrime/securesms/jobs/SmsSentJob.java +++ b/src/org/thoughtcrime/securesms/jobs/SmsSentJob.java @@ -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 { diff --git a/src/org/thoughtcrime/securesms/jobs/persistence/EncryptingJobSerializer.java b/src/org/thoughtcrime/securesms/jobs/persistence/EncryptingJobSerializer.java index 32e9f4cef7..07f376f3ee 100644 --- a/src/org/thoughtcrime/securesms/jobs/persistence/EncryptingJobSerializer.java +++ b/src/org/thoughtcrime/securesms/jobs/persistence/EncryptingJobSerializer.java @@ -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; diff --git a/src/org/thoughtcrime/securesms/mms/AttachmentManager.java b/src/org/thoughtcrime/securesms/mms/AttachmentManager.java index ded9179015..e5e0c401f6 100644 --- a/src/org/thoughtcrime/securesms/mms/AttachmentManager.java +++ b/src/org/thoughtcrime/securesms/mms/AttachmentManager.java @@ -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; diff --git a/src/org/thoughtcrime/securesms/mms/AttachmentStreamLocalUriFetcher.java b/src/org/thoughtcrime/securesms/mms/AttachmentStreamLocalUriFetcher.java index 72e3749cee..d929bf3476 100644 --- a/src/org/thoughtcrime/securesms/mms/AttachmentStreamLocalUriFetcher.java +++ b/src/org/thoughtcrime/securesms/mms/AttachmentStreamLocalUriFetcher.java @@ -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; diff --git a/src/org/thoughtcrime/securesms/mms/IncomingMediaMessage.java b/src/org/thoughtcrime/securesms/mms/IncomingMediaMessage.java index b47c796e1d..c4777c9fb6 100644 --- a/src/org/thoughtcrime/securesms/mms/IncomingMediaMessage.java +++ b/src/org/thoughtcrime/securesms/mms/IncomingMediaMessage.java @@ -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 relay, Optional body, - Optional group, - Optional> attachments) + Optional group, + Optional> attachments) { this.push = true; this.from = from; diff --git a/src/org/thoughtcrime/securesms/mms/LegacyMmsConnection.java b/src/org/thoughtcrime/securesms/mms/LegacyMmsConnection.java index 47ddc59979..f21cf1a8b4 100644 --- a/src/org/thoughtcrime/securesms/mms/LegacyMmsConnection.java +++ b/src/org/thoughtcrime/securesms/mms/LegacyMmsConnection.java @@ -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; diff --git a/src/org/thoughtcrime/securesms/mms/LocationSlide.java b/src/org/thoughtcrime/securesms/mms/LocationSlide.java index e9e6b9a14e..f679b8bf82 100644 --- a/src/org/thoughtcrime/securesms/mms/LocationSlide.java +++ b/src/org/thoughtcrime/securesms/mms/LocationSlide.java @@ -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 { diff --git a/src/org/thoughtcrime/securesms/mms/OutgoingGroupMediaMessage.java b/src/org/thoughtcrime/securesms/mms/OutgoingGroupMediaMessage.java index 80d4994bb8..cd226389e0 100644 --- a/src/org/thoughtcrime/securesms/mms/OutgoingGroupMediaMessage.java +++ b/src/org/thoughtcrime/securesms/mms/OutgoingGroupMediaMessage.java @@ -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; diff --git a/src/org/thoughtcrime/securesms/mms/Slide.java b/src/org/thoughtcrime/securesms/mms/Slide.java index f676ac3a6f..ba85a3d0a1 100644 --- a/src/org/thoughtcrime/securesms/mms/Slide.java +++ b/src/org/thoughtcrime/securesms/mms/Slide.java @@ -28,7 +28,7 @@ import org.thoughtcrime.securesms.attachments.UriAttachment; import org.thoughtcrime.securesms.database.AttachmentDatabase; import org.thoughtcrime.securesms.util.MediaUtil; import org.thoughtcrime.securesms.util.Util; -import org.whispersystems.libaxolotl.util.guava.Optional; +import org.whispersystems.libsignal.util.guava.Optional; public abstract class Slide { diff --git a/src/org/thoughtcrime/securesms/mms/SlideDeck.java b/src/org/thoughtcrime/securesms/mms/SlideDeck.java index 65bfefb2df..6d83e777e0 100644 --- a/src/org/thoughtcrime/securesms/mms/SlideDeck.java +++ b/src/org/thoughtcrime/securesms/mms/SlideDeck.java @@ -22,7 +22,7 @@ import android.support.annotation.Nullable; import org.thoughtcrime.securesms.attachments.Attachment; import org.thoughtcrime.securesms.util.MediaUtil; -import org.whispersystems.libaxolotl.util.guava.Optional; +import org.whispersystems.libsignal.util.guava.Optional; import java.util.LinkedList; import java.util.List; diff --git a/src/org/thoughtcrime/securesms/notifications/MessageNotifier.java b/src/org/thoughtcrime/securesms/notifications/MessageNotifier.java index bfa7a5cc09..6f6ba38b32 100644 --- a/src/org/thoughtcrime/securesms/notifications/MessageNotifier.java +++ b/src/org/thoughtcrime/securesms/notifications/MessageNotifier.java @@ -59,7 +59,7 @@ import org.thoughtcrime.securesms.recipients.Recipients; import org.thoughtcrime.securesms.service.KeyCachingService; import org.thoughtcrime.securesms.util.SpanUtil; import org.thoughtcrime.securesms.util.TextSecurePreferences; -import org.whispersystems.textsecure.api.messages.TextSecureEnvelope; +import org.whispersystems.signalservice.api.messages.SignalServiceEnvelope; import java.util.List; import java.util.ListIterator; @@ -336,7 +336,7 @@ public class MessageNotifier { @NonNull Cursor cursor) { PushDatabase.Reader reader = null; - TextSecureEnvelope envelope; + SignalServiceEnvelope envelope; try { reader = DatabaseFactory.getPushDatabase(context).readerFor(cursor); diff --git a/src/org/thoughtcrime/securesms/notifications/WearReplyReceiver.java b/src/org/thoughtcrime/securesms/notifications/WearReplyReceiver.java index 3f334a6535..f846a2e0fd 100644 --- a/src/org/thoughtcrime/securesms/notifications/WearReplyReceiver.java +++ b/src/org/thoughtcrime/securesms/notifications/WearReplyReceiver.java @@ -37,7 +37,7 @@ import org.thoughtcrime.securesms.recipients.RecipientFactory; import org.thoughtcrime.securesms.recipients.Recipients; import org.thoughtcrime.securesms.sms.MessageSender; import org.thoughtcrime.securesms.sms.OutgoingTextMessage; -import org.whispersystems.libaxolotl.util.guava.Optional; +import org.whispersystems.libsignal.util.guava.Optional; import java.util.LinkedList; import java.util.List; diff --git a/src/org/thoughtcrime/securesms/preferences/AdvancedPreferenceFragment.java b/src/org/thoughtcrime/securesms/preferences/AdvancedPreferenceFragment.java index 87be7a2a27..030b75d79e 100644 --- a/src/org/thoughtcrime/securesms/preferences/AdvancedPreferenceFragment.java +++ b/src/org/thoughtcrime/securesms/preferences/AdvancedPreferenceFragment.java @@ -33,9 +33,9 @@ import org.thoughtcrime.securesms.crypto.MasterSecret; import org.thoughtcrime.securesms.push.TextSecureCommunicationFactory; import org.thoughtcrime.securesms.util.task.ProgressDialogAsyncTask; import org.thoughtcrime.securesms.util.TextSecurePreferences; -import org.whispersystems.libaxolotl.util.guava.Optional; -import org.whispersystems.textsecure.api.TextSecureAccountManager; -import org.whispersystems.textsecure.api.push.exceptions.AuthorizationFailedException; +import org.whispersystems.libsignal.util.guava.Optional; +import org.whispersystems.signalservice.api.SignalServiceAccountManager; +import org.whispersystems.signalservice.api.push.exceptions.AuthorizationFailedException; import java.io.IOException; @@ -187,12 +187,12 @@ public class AdvancedPreferenceFragment extends PreferenceFragment { @Override protected Integer doInBackground(Void... params) { try { - Context context = getActivity(); - TextSecureAccountManager accountManager = TextSecureCommunicationFactory.createManager(context); - RedPhoneAccountManager redPhoneAccountManager = new RedPhoneAccountManager(BuildConfig.REDPHONE_MASTER_URL, - new RedPhoneTrustStore(context), - TextSecurePreferences.getLocalNumber(context), - TextSecurePreferences.getPushServerPassword(context)); + Context context = getActivity(); + SignalServiceAccountManager accountManager = TextSecureCommunicationFactory.createManager(context); + RedPhoneAccountManager redPhoneAccountManager = new RedPhoneAccountManager(BuildConfig.REDPHONE_MASTER_URL, + new RedPhoneTrustStore(context), + TextSecurePreferences.getLocalNumber(context), + TextSecurePreferences.getPushServerPassword(context)); try { accountManager.setGcmId(Optional.absent()); diff --git a/src/org/thoughtcrime/securesms/push/SecurityEventListener.java b/src/org/thoughtcrime/securesms/push/SecurityEventListener.java index c432cc80cf..cbb7bd0fe0 100644 --- a/src/org/thoughtcrime/securesms/push/SecurityEventListener.java +++ b/src/org/thoughtcrime/securesms/push/SecurityEventListener.java @@ -3,10 +3,10 @@ package org.thoughtcrime.securesms.push; import android.content.Context; import org.thoughtcrime.securesms.crypto.SecurityEvent; -import org.whispersystems.textsecure.api.TextSecureMessageSender; -import org.whispersystems.textsecure.api.push.TextSecureAddress; +import org.whispersystems.signalservice.api.SignalServiceMessageSender; +import org.whispersystems.signalservice.api.push.SignalServiceAddress; -public class SecurityEventListener implements TextSecureMessageSender.EventListener { +public class SecurityEventListener implements SignalServiceMessageSender.EventListener { private static final String TAG = SecurityEventListener.class.getSimpleName(); @@ -17,7 +17,7 @@ public class SecurityEventListener implements TextSecureMessageSender.EventListe } @Override - public void onSecurityEvent(TextSecureAddress textSecureAddress) { + public void onSecurityEvent(SignalServiceAddress textSecureAddress) { SecurityEvent.broadcastSecurityUpdateEvent(context); } } diff --git a/src/org/thoughtcrime/securesms/push/TextSecureCommunicationFactory.java b/src/org/thoughtcrime/securesms/push/TextSecureCommunicationFactory.java index 2aa7502dca..9107e71b16 100644 --- a/src/org/thoughtcrime/securesms/push/TextSecureCommunicationFactory.java +++ b/src/org/thoughtcrime/securesms/push/TextSecureCommunicationFactory.java @@ -2,35 +2,23 @@ package org.thoughtcrime.securesms.push; import android.content.Context; -import org.thoughtcrime.redphone.signaling.RedPhoneAccountManager; import org.thoughtcrime.securesms.BuildConfig; -import org.thoughtcrime.securesms.crypto.SecurityEvent; -import org.thoughtcrime.securesms.crypto.MasterSecret; -import org.thoughtcrime.securesms.crypto.storage.TextSecureAxolotlStore; -import org.thoughtcrime.securesms.database.DatabaseFactory; -import org.thoughtcrime.securesms.recipients.RecipientFactory; -import org.thoughtcrime.securesms.recipients.Recipients; 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 static org.whispersystems.textsecure.api.TextSecureMessageSender.EventListener; +import org.whispersystems.signalservice.api.SignalServiceAccountManager; public class TextSecureCommunicationFactory { - public static TextSecureAccountManager createManager(Context context) { - return new TextSecureAccountManager(BuildConfig.TEXTSECURE_URL, - new TextSecurePushTrustStore(context), - TextSecurePreferences.getLocalNumber(context), - TextSecurePreferences.getPushServerPassword(context), - BuildConfig.USER_AGENT); + public static SignalServiceAccountManager createManager(Context context) { + return new SignalServiceAccountManager(BuildConfig.TEXTSECURE_URL, + new TextSecurePushTrustStore(context), + TextSecurePreferences.getLocalNumber(context), + TextSecurePreferences.getPushServerPassword(context), + BuildConfig.USER_AGENT); } - public static TextSecureAccountManager createManager(Context context, String number, String password) { - return new TextSecureAccountManager(BuildConfig.TEXTSECURE_URL, new TextSecurePushTrustStore(context), - number, password, BuildConfig.USER_AGENT); + public static SignalServiceAccountManager createManager(Context context, String number, String password) { + return new SignalServiceAccountManager(BuildConfig.TEXTSECURE_URL, new TextSecurePushTrustStore(context), + number, password, BuildConfig.USER_AGENT); } } diff --git a/src/org/thoughtcrime/securesms/push/TextSecurePushTrustStore.java b/src/org/thoughtcrime/securesms/push/TextSecurePushTrustStore.java index 98785a0576..b403c332a2 100644 --- a/src/org/thoughtcrime/securesms/push/TextSecurePushTrustStore.java +++ b/src/org/thoughtcrime/securesms/push/TextSecurePushTrustStore.java @@ -3,8 +3,8 @@ package org.thoughtcrime.securesms.push; import android.content.Context; import org.thoughtcrime.securesms.R; -import org.whispersystems.textsecure.api.push.TrustStore; -import org.whispersystems.textsecure.internal.push.PushServiceSocket; +import org.whispersystems.signalservice.api.push.TrustStore; +import org.whispersystems.signalservice.internal.push.PushServiceSocket; import java.io.InputStream; diff --git a/src/org/thoughtcrime/securesms/recipients/RecipientFactory.java b/src/org/thoughtcrime/securesms/recipients/RecipientFactory.java index 8c91ba8539..632ba15018 100644 --- a/src/org/thoughtcrime/securesms/recipients/RecipientFactory.java +++ b/src/org/thoughtcrime/securesms/recipients/RecipientFactory.java @@ -22,7 +22,7 @@ import android.text.TextUtils; import org.thoughtcrime.securesms.database.CanonicalAddressDatabase; import org.thoughtcrime.securesms.util.Util; -import org.whispersystems.libaxolotl.util.guava.Optional; +import org.whispersystems.libsignal.util.guava.Optional; import java.util.Collection; import java.util.LinkedList; diff --git a/src/org/thoughtcrime/securesms/recipients/RecipientProvider.java b/src/org/thoughtcrime/securesms/recipients/RecipientProvider.java index cac201fd24..7def0b55ae 100644 --- a/src/org/thoughtcrime/securesms/recipients/RecipientProvider.java +++ b/src/org/thoughtcrime/securesms/recipients/RecipientProvider.java @@ -38,7 +38,7 @@ import org.thoughtcrime.securesms.util.GroupUtil; import org.thoughtcrime.securesms.util.LRUCache; import org.thoughtcrime.securesms.util.ListenableFutureTask; 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.util.Arrays; diff --git a/src/org/thoughtcrime/securesms/service/MessageRetrievalService.java b/src/org/thoughtcrime/securesms/service/MessageRetrievalService.java index 1eb29e633e..ac6e92b09d 100644 --- a/src/org/thoughtcrime/securesms/service/MessageRetrievalService.java +++ b/src/org/thoughtcrime/securesms/service/MessageRetrievalService.java @@ -14,10 +14,10 @@ import org.thoughtcrime.securesms.util.TextSecurePreferences; import org.whispersystems.jobqueue.requirements.NetworkRequirement; import org.whispersystems.jobqueue.requirements.NetworkRequirementProvider; import org.whispersystems.jobqueue.requirements.RequirementListener; -import org.whispersystems.libaxolotl.InvalidVersionException; -import org.whispersystems.textsecure.api.TextSecureMessagePipe; -import org.whispersystems.textsecure.api.TextSecureMessageReceiver; -import org.whispersystems.textsecure.api.messages.TextSecureEnvelope; +import org.whispersystems.libsignal.InvalidVersionException; +import org.whispersystems.signalservice.api.SignalServiceMessagePipe; +import org.whispersystems.signalservice.api.SignalServiceMessageReceiver; +import org.whispersystems.signalservice.api.messages.SignalServiceEnvelope; import java.util.LinkedList; import java.util.List; @@ -39,7 +39,7 @@ public class MessageRetrievalService extends Service implements Runnable, Inject private NetworkRequirementProvider networkRequirementProvider; @Inject - public TextSecureMessageReceiver receiver; + public SignalServiceMessageReceiver receiver; private int activeActivities = 0; private List pushPending = new LinkedList<>(); @@ -73,16 +73,16 @@ public class MessageRetrievalService extends Service implements Runnable, Inject waitForConnectionNecessary(); Log.w(TAG, "Making websocket connection...."); - TextSecureMessagePipe pipe = receiver.createMessagePipe(); + SignalServiceMessagePipe pipe = receiver.createMessagePipe(); try { while (isConnectionNecessary()) { try { Log.w(TAG, "Reading message..."); pipe.read(REQUEST_TIMEOUT_MINUTES, TimeUnit.MINUTES, - new TextSecureMessagePipe.MessagePipeCallback() { + new SignalServiceMessagePipe.MessagePipeCallback() { @Override - public void onMessage(TextSecureEnvelope envelope) { + public void onMessage(SignalServiceEnvelope envelope) { Log.w(TAG, "Retrieved envelope! " + envelope.getSource()); PushContentReceiveJob receiveJob = new PushContentReceiveJob(MessageRetrievalService.this); @@ -162,7 +162,7 @@ public class MessageRetrievalService extends Service implements Runnable, Inject } } - private void shutdown(TextSecureMessagePipe pipe) { + private void shutdown(SignalServiceMessagePipe pipe) { try { pipe.shutdown(); } catch (Throwable t) { diff --git a/src/org/thoughtcrime/securesms/service/QuickResponseService.java b/src/org/thoughtcrime/securesms/service/QuickResponseService.java index 467f4d0e98..0452998086 100644 --- a/src/org/thoughtcrime/securesms/service/QuickResponseService.java +++ b/src/org/thoughtcrime/securesms/service/QuickResponseService.java @@ -19,7 +19,7 @@ import org.thoughtcrime.securesms.recipients.Recipients; import org.thoughtcrime.securesms.sms.MessageSender; import org.thoughtcrime.securesms.sms.OutgoingTextMessage; import org.thoughtcrime.securesms.util.Rfc5724Uri; -import org.whispersystems.libaxolotl.util.guava.Optional; +import org.whispersystems.libsignal.util.guava.Optional; import java.net.URISyntaxException; import java.net.URLDecoder; diff --git a/src/org/thoughtcrime/securesms/service/RegistrationService.java b/src/org/thoughtcrime/securesms/service/RegistrationService.java index 879aac469a..49d3482761 100644 --- a/src/org/thoughtcrime/securesms/service/RegistrationService.java +++ b/src/org/thoughtcrime/securesms/service/RegistrationService.java @@ -27,13 +27,13 @@ import org.thoughtcrime.securesms.recipients.RecipientFactory; import org.thoughtcrime.securesms.util.DirectoryHelper; import org.thoughtcrime.securesms.util.TextSecurePreferences; import org.thoughtcrime.securesms.util.Util; -import org.whispersystems.libaxolotl.IdentityKeyPair; -import org.whispersystems.libaxolotl.state.PreKeyRecord; -import org.whispersystems.libaxolotl.state.SignedPreKeyRecord; -import org.whispersystems.libaxolotl.util.KeyHelper; -import org.whispersystems.libaxolotl.util.guava.Optional; -import org.whispersystems.textsecure.api.TextSecureAccountManager; -import org.whispersystems.textsecure.api.push.exceptions.ExpectationFailedException; +import org.whispersystems.libsignal.IdentityKeyPair; +import org.whispersystems.libsignal.state.PreKeyRecord; +import org.whispersystems.libsignal.state.SignedPreKeyRecord; +import org.whispersystems.libsignal.util.KeyHelper; +import org.whispersystems.libsignal.util.guava.Optional; +import org.whispersystems.signalservice.api.SignalServiceAccountManager; +import org.whispersystems.signalservice.api.push.exceptions.ExpectationFailedException; import java.io.IOException; import java.lang.ref.WeakReference; @@ -161,7 +161,7 @@ public class RegistrationService extends Service { String signalingKey = intent.getStringExtra("signaling_key"); try { - TextSecureAccountManager accountManager = TextSecureCommunicationFactory.createManager(this, number, password); + SignalServiceAccountManager accountManager = TextSecureCommunicationFactory.createManager(this, number, password); handleCommonRegistration(accountManager, number, password, signalingKey); @@ -198,7 +198,7 @@ public class RegistrationService extends Service { initializeChallengeListener(); setState(new RegistrationState(RegistrationState.STATE_CONNECTING, number)); - TextSecureAccountManager accountManager = TextSecureCommunicationFactory.createManager(this, number, password); + SignalServiceAccountManager accountManager = TextSecureCommunicationFactory.createManager(this, number, password); accountManager.requestSmsVerificationCode(); setState(new RegistrationState(RegistrationState.STATE_VERIFYING, number)); @@ -231,7 +231,7 @@ public class RegistrationService extends Service { } } - private void handleCommonRegistration(TextSecureAccountManager accountManager, String number, String password, String signalingKey) + private void handleCommonRegistration(SignalServiceAccountManager accountManager, String number, String password, String signalingKey) throws IOException { setState(new RegistrationState(RegistrationState.STATE_GENERATING_KEYS, number)); diff --git a/src/org/thoughtcrime/securesms/sms/IncomingGroupMessage.java b/src/org/thoughtcrime/securesms/sms/IncomingGroupMessage.java index 29e940adb2..49e5947274 100644 --- a/src/org/thoughtcrime/securesms/sms/IncomingGroupMessage.java +++ b/src/org/thoughtcrime/securesms/sms/IncomingGroupMessage.java @@ -1,6 +1,6 @@ package org.thoughtcrime.securesms.sms; -import static org.whispersystems.textsecure.internal.push.TextSecureProtos.GroupContext; +import static org.whispersystems.signalservice.internal.push.SignalServiceProtos.GroupContext; public class IncomingGroupMessage extends IncomingTextMessage { diff --git a/src/org/thoughtcrime/securesms/sms/IncomingJoinedMessage.java b/src/org/thoughtcrime/securesms/sms/IncomingJoinedMessage.java index 993f80ffdb..5dedce9bd6 100644 --- a/src/org/thoughtcrime/securesms/sms/IncomingJoinedMessage.java +++ b/src/org/thoughtcrime/securesms/sms/IncomingJoinedMessage.java @@ -1,12 +1,12 @@ package org.thoughtcrime.securesms.sms; -import org.whispersystems.libaxolotl.util.guava.Optional; -import org.whispersystems.textsecure.api.messages.TextSecureGroup; +import org.whispersystems.libsignal.util.guava.Optional; +import org.whispersystems.signalservice.api.messages.SignalServiceGroup; public class IncomingJoinedMessage extends IncomingTextMessage { public IncomingJoinedMessage(String sender) { - super(sender, 1, System.currentTimeMillis(), null, Optional.absent()); + super(sender, 1, System.currentTimeMillis(), null, Optional.absent()); } @Override diff --git a/src/org/thoughtcrime/securesms/sms/IncomingTextMessage.java b/src/org/thoughtcrime/securesms/sms/IncomingTextMessage.java index 410eec1574..75efaf6460 100644 --- a/src/org/thoughtcrime/securesms/sms/IncomingTextMessage.java +++ b/src/org/thoughtcrime/securesms/sms/IncomingTextMessage.java @@ -5,9 +5,9 @@ import android.os.Parcelable; import android.telephony.SmsMessage; import org.thoughtcrime.securesms.util.GroupUtil; -import org.whispersystems.libaxolotl.util.guava.Optional; -import org.whispersystems.textsecure.api.messages.TextSecureGroup; -import org.whispersystems.textsecure.api.push.TextSecureAddress; +import org.whispersystems.libsignal.util.guava.Optional; +import org.whispersystems.signalservice.api.messages.SignalServiceGroup; +import org.whispersystems.signalservice.api.push.SignalServiceAddress; import java.util.List; @@ -40,7 +40,7 @@ public class IncomingTextMessage implements Parcelable { public IncomingTextMessage(SmsMessage message, int subscriptionId) { this.message = message.getDisplayMessageBody(); this.sender = message.getDisplayOriginatingAddress(); - this.senderDeviceId = TextSecureAddress.DEFAULT_DEVICE_ID; + this.senderDeviceId = SignalServiceAddress.DEFAULT_DEVICE_ID; this.protocol = message.getProtocolIdentifier(); this.serviceCenterAddress = message.getServiceCenterAddress(); this.replyPathPresent = message.isReplyPathPresent(); @@ -52,7 +52,7 @@ public class IncomingTextMessage implements Parcelable { } public IncomingTextMessage(String sender, int senderDeviceId, long sentTimestampMillis, - String encodedBody, Optional group) + String encodedBody, Optional group) { this.message = encodedBody; this.sender = sender; @@ -124,7 +124,7 @@ public class IncomingTextMessage implements Parcelable { { this.message = ""; this.sender = sender; - this.senderDeviceId = TextSecureAddress.DEFAULT_DEVICE_ID; + this.senderDeviceId = SignalServiceAddress.DEFAULT_DEVICE_ID; this.protocol = 31338; this.serviceCenterAddress = "Outgoing"; this.replyPathPresent = true; diff --git a/src/org/thoughtcrime/securesms/sms/MessageSender.java b/src/org/thoughtcrime/securesms/sms/MessageSender.java index 8fb91178ee..77d80b0b16 100644 --- a/src/org/thoughtcrime/securesms/sms/MessageSender.java +++ b/src/org/thoughtcrime/securesms/sms/MessageSender.java @@ -43,10 +43,10 @@ import org.thoughtcrime.securesms.util.GroupUtil; import org.thoughtcrime.securesms.util.TextSecurePreferences; import org.thoughtcrime.securesms.util.Util; import org.whispersystems.jobqueue.JobManager; -import org.whispersystems.libaxolotl.util.guava.Optional; -import org.whispersystems.textsecure.api.TextSecureAccountManager; -import org.whispersystems.textsecure.api.push.ContactTokenDetails; -import org.whispersystems.textsecure.api.util.InvalidNumberException; +import org.whispersystems.libsignal.util.guava.Optional; +import org.whispersystems.signalservice.api.SignalServiceAccountManager; +import org.whispersystems.signalservice.api.push.ContactTokenDetails; +import org.whispersystems.signalservice.api.util.InvalidNumberException; import java.io.IOException; @@ -277,7 +277,7 @@ public class MessageSender { return directory.isSecureTextSupported(destination); } catch (NotInDirectoryException e) { try { - TextSecureAccountManager accountManager = TextSecureCommunicationFactory.createManager(context); + SignalServiceAccountManager accountManager = TextSecureCommunicationFactory.createManager(context); Optional registeredUser = accountManager.getContact(destination); if (!registeredUser.isPresent()) { diff --git a/src/org/thoughtcrime/securesms/util/DirectoryHelper.java b/src/org/thoughtcrime/securesms/util/DirectoryHelper.java index f2e656e71b..e808f5d4d1 100644 --- a/src/org/thoughtcrime/securesms/util/DirectoryHelper.java +++ b/src/org/thoughtcrime/securesms/util/DirectoryHelper.java @@ -25,10 +25,10 @@ import org.thoughtcrime.securesms.push.TextSecureCommunicationFactory; import org.thoughtcrime.securesms.recipients.Recipients; import org.thoughtcrime.securesms.sms.IncomingJoinedMessage; import org.thoughtcrime.securesms.util.DirectoryHelper.UserCapabilities.Capability; -import org.whispersystems.libaxolotl.util.guava.Optional; -import org.whispersystems.textsecure.api.TextSecureAccountManager; -import org.whispersystems.textsecure.api.push.ContactTokenDetails; -import org.whispersystems.textsecure.api.util.InvalidNumberException; +import org.whispersystems.libsignal.util.guava.Optional; +import org.whispersystems.signalservice.api.SignalServiceAccountManager; +import org.whispersystems.signalservice.api.push.ContactTokenDetails; +import org.whispersystems.signalservice.api.util.InvalidNumberException; import java.io.IOException; import java.util.Calendar; @@ -83,7 +83,7 @@ public class DirectoryHelper { } public static @NonNull List refreshDirectory(@NonNull Context context, - @NonNull TextSecureAccountManager accountManager, + @NonNull SignalServiceAccountManager accountManager, @NonNull String localNumber) throws IOException { @@ -112,7 +112,7 @@ public class DirectoryHelper { { try { TextSecureDirectory directory = TextSecureDirectory.getInstance(context); - TextSecureAccountManager accountManager = TextSecureCommunicationFactory.createManager(context); + SignalServiceAccountManager accountManager = TextSecureCommunicationFactory.createManager(context); String number = Util.canonicalizeNumber(context, recipients.getPrimaryRecipient().getNumber()); Optional details = accountManager.getContact(number); diff --git a/src/org/thoughtcrime/securesms/util/GroupUtil.java b/src/org/thoughtcrime/securesms/util/GroupUtil.java index fb7095ffbe..3a1422dce5 100644 --- a/src/org/thoughtcrime/securesms/util/GroupUtil.java +++ b/src/org/thoughtcrime/securesms/util/GroupUtil.java @@ -11,7 +11,7 @@ import org.thoughtcrime.securesms.recipients.Recipients; import java.io.IOException; -import static org.whispersystems.textsecure.internal.push.TextSecureProtos.GroupContext; +import static org.whispersystems.signalservice.internal.push.SignalServiceProtos.GroupContext; public class GroupUtil { diff --git a/src/org/thoughtcrime/securesms/util/SelectedRecipientsAdapter.java b/src/org/thoughtcrime/securesms/util/SelectedRecipientsAdapter.java index a58565280a..ae49d41a62 100644 --- a/src/org/thoughtcrime/securesms/util/SelectedRecipientsAdapter.java +++ b/src/org/thoughtcrime/securesms/util/SelectedRecipientsAdapter.java @@ -12,7 +12,7 @@ import android.widget.TextView; import org.thoughtcrime.securesms.R; import org.thoughtcrime.securesms.recipients.Recipient; -import org.whispersystems.libaxolotl.util.guava.Optional; +import org.whispersystems.libsignal.util.guava.Optional; import java.util.Collection; import java.util.Collections; diff --git a/src/org/thoughtcrime/securesms/util/Util.java b/src/org/thoughtcrime/securesms/util/Util.java index fe2bb39c5b..f826de5179 100644 --- a/src/org/thoughtcrime/securesms/util/Util.java +++ b/src/org/thoughtcrime/securesms/util/Util.java @@ -42,8 +42,8 @@ import com.google.i18n.phonenumbers.PhoneNumberUtil; import org.thoughtcrime.securesms.BuildConfig; import org.thoughtcrime.securesms.mms.OutgoingLegacyMmsConnection; -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.io.ByteArrayOutputStream; import java.io.IOException; diff --git a/src/org/thoughtcrime/securesms/util/dualsim/SubscriptionManagerCompat.java b/src/org/thoughtcrime/securesms/util/dualsim/SubscriptionManagerCompat.java index 0a29d68d86..8196638d7b 100644 --- a/src/org/thoughtcrime/securesms/util/dualsim/SubscriptionManagerCompat.java +++ b/src/org/thoughtcrime/securesms/util/dualsim/SubscriptionManagerCompat.java @@ -6,7 +6,7 @@ import android.support.annotation.NonNull; import android.telephony.SubscriptionInfo; import android.telephony.SubscriptionManager; -import org.whispersystems.libaxolotl.util.guava.Optional; +import org.whispersystems.libsignal.util.guava.Optional; import java.util.LinkedList; import java.util.List; diff --git a/test/unitTest/java/org/thoughtcrime/securesms/crypto/MasterCipherTest.java b/test/unitTest/java/org/thoughtcrime/securesms/crypto/MasterCipherTest.java index 8a75b1b29f..3d71cfaee3 100644 --- a/test/unitTest/java/org/thoughtcrime/securesms/crypto/MasterCipherTest.java +++ b/test/unitTest/java/org/thoughtcrime/securesms/crypto/MasterCipherTest.java @@ -4,7 +4,7 @@ import org.junit.Before; import org.junit.Test; import org.powermock.core.classloader.annotations.PowerMockIgnore; import org.thoughtcrime.securesms.BaseUnitTest; -import org.whispersystems.libaxolotl.InvalidMessageException; +import org.whispersystems.libsignal.InvalidMessageException; @PowerMockIgnore("javax.crypto.*") public class MasterCipherTest extends BaseUnitTest { diff --git a/test/unitTest/java/org/thoughtcrime/securesms/jobs/CleanPreKeysJobTest.java b/test/unitTest/java/org/thoughtcrime/securesms/jobs/CleanPreKeysJobTest.java index 8215dfa69b..8b41b5d320 100644 --- a/test/unitTest/java/org/thoughtcrime/securesms/jobs/CleanPreKeysJobTest.java +++ b/test/unitTest/java/org/thoughtcrime/securesms/jobs/CleanPreKeysJobTest.java @@ -4,12 +4,12 @@ import org.junit.Test; import org.thoughtcrime.securesms.BaseUnitTest; import org.thoughtcrime.securesms.crypto.MasterSecret; import org.thoughtcrime.securesms.dependencies.AxolotlStorageModule; -import org.whispersystems.libaxolotl.ecc.Curve; -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.PushNetworkException; +import org.whispersystems.libsignal.ecc.Curve; +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.PushNetworkException; import java.io.IOException; import java.util.LinkedList; @@ -32,9 +32,9 @@ import static org.mockito.Mockito.when; public class CleanPreKeysJobTest extends BaseUnitTest { @Test public void testSignedPreKeyRotationNotRegistered() throws IOException, MasterSecretJob.RequirementNotMetException { - TextSecureAccountManager accountManager = mock(TextSecureAccountManager.class); - SignedPreKeyStore signedPreKeyStore = mock(SignedPreKeyStore.class); - MasterSecret masterSecret = mock(MasterSecret.class); + SignalServiceAccountManager accountManager = mock(SignalServiceAccountManager.class); + SignedPreKeyStore signedPreKeyStore = mock(SignedPreKeyStore.class); + MasterSecret masterSecret = mock(MasterSecret.class); when(accountManager.getSignedPreKey()).thenReturn(null); CleanPreKeysJob cleanPreKeysJob = new CleanPreKeysJob(context); @@ -50,10 +50,10 @@ public class CleanPreKeysJobTest extends BaseUnitTest { @Test public void testSignedPreKeyEviction() throws Exception { - SignedPreKeyStore signedPreKeyStore = mock(SignedPreKeyStore.class); - TextSecureAccountManager accountManager = mock(TextSecureAccountManager.class); - SignedPreKeyEntity currentSignedPreKeyEntity = mock(SignedPreKeyEntity.class); - MasterSecret masterSecret = mock(MasterSecret.class); + SignedPreKeyStore signedPreKeyStore = mock(SignedPreKeyStore.class); + SignalServiceAccountManager accountManager = mock(SignalServiceAccountManager.class); + SignedPreKeyEntity currentSignedPreKeyEntity = mock(SignedPreKeyEntity.class); + MasterSecret masterSecret = mock(MasterSecret.class); when(currentSignedPreKeyEntity.getKeyId()).thenReturn(3133); when(accountManager.getSignedPreKey()).thenReturn(currentSignedPreKeyEntity); @@ -84,9 +84,9 @@ public class CleanPreKeysJobTest extends BaseUnitTest { @Test public void testSignedPreKeyNoEviction() throws Exception { - SignedPreKeyStore signedPreKeyStore = mock(SignedPreKeyStore.class); - TextSecureAccountManager accountManager = mock(TextSecureAccountManager.class); - SignedPreKeyEntity currentSignedPreKeyEntity = mock(SignedPreKeyEntity.class); + SignedPreKeyStore signedPreKeyStore = mock(SignedPreKeyStore.class); + SignalServiceAccountManager accountManager = mock(SignalServiceAccountManager.class); + SignedPreKeyEntity currentSignedPreKeyEntity = mock(SignedPreKeyEntity.class); when(currentSignedPreKeyEntity.getKeyId()).thenReturn(3133); when(accountManager.getSignedPreKey()).thenReturn(currentSignedPreKeyEntity); @@ -111,7 +111,7 @@ public class CleanPreKeysJobTest extends BaseUnitTest { @Test public void testConnectionError() throws Exception { SignedPreKeyStore signedPreKeyStore = mock(SignedPreKeyStore.class); - TextSecureAccountManager accountManager = mock(TextSecureAccountManager.class); + SignalServiceAccountManager accountManager = mock(SignalServiceAccountManager.class); MasterSecret masterSecret = mock(MasterSecret.class); when(accountManager.getSignedPreKey()).thenThrow(new PushNetworkException("Connectivity error!")); @@ -131,15 +131,15 @@ public class CleanPreKeysJobTest extends BaseUnitTest { @Module(injects = {CleanPreKeysJob.class}) public static class TestModule { - private final TextSecureAccountManager accountManager; + private final SignalServiceAccountManager accountManager; private final SignedPreKeyStore signedPreKeyStore; - private TestModule(TextSecureAccountManager accountManager, SignedPreKeyStore signedPreKeyStore) { + private TestModule(SignalServiceAccountManager accountManager, SignedPreKeyStore signedPreKeyStore) { this.accountManager = accountManager; this.signedPreKeyStore = signedPreKeyStore; } - @Provides TextSecureAccountManager provideTextSecureAccountManager() { + @Provides SignalServiceAccountManager provideTextSecureAccountManager() { return accountManager; } diff --git a/test/unitTest/java/org/thoughtcrime/securesms/jobs/DeliveryReceiptJobTest.java b/test/unitTest/java/org/thoughtcrime/securesms/jobs/DeliveryReceiptJobTest.java index da74965949..00e3117317 100644 --- a/test/unitTest/java/org/thoughtcrime/securesms/jobs/DeliveryReceiptJobTest.java +++ b/test/unitTest/java/org/thoughtcrime/securesms/jobs/DeliveryReceiptJobTest.java @@ -5,10 +5,10 @@ import org.mockito.ArgumentCaptor; import org.mockito.Mockito; import org.thoughtcrime.securesms.BaseUnitTest; import org.thoughtcrime.securesms.dependencies.TextSecureCommunicationModule.TextSecureMessageSenderFactory; -import org.whispersystems.textsecure.api.TextSecureMessageSender; -import org.whispersystems.textsecure.api.push.TextSecureAddress; -import org.whispersystems.textsecure.api.push.exceptions.NotFoundException; -import org.whispersystems.textsecure.api.push.exceptions.PushNetworkException; +import org.whispersystems.signalservice.api.SignalServiceMessageSender; +import org.whispersystems.signalservice.api.push.SignalServiceAddress; +import org.whispersystems.signalservice.api.push.exceptions.NotFoundException; +import org.whispersystems.signalservice.api.push.exceptions.PushNetworkException; import java.io.IOException; @@ -26,7 +26,7 @@ import static org.mockito.Mockito.verify; public class DeliveryReceiptJobTest extends BaseUnitTest { @Test public void testDelivery() throws IOException { - TextSecureMessageSender textSecureMessageSender = mock(TextSecureMessageSender.class); + SignalServiceMessageSender textSecureMessageSender = mock(SignalServiceMessageSender.class); long timestamp = System.currentTimeMillis(); DeliveryReceiptJob deliveryReceiptJob = new DeliveryReceiptJob(context, @@ -38,7 +38,7 @@ public class DeliveryReceiptJobTest extends BaseUnitTest { deliveryReceiptJob.onRun(); - ArgumentCaptor captor = ArgumentCaptor.forClass(TextSecureAddress.class); + ArgumentCaptor captor = ArgumentCaptor.forClass(SignalServiceAddress.class); verify(textSecureMessageSender).sendDeliveryReceipt(captor.capture(), eq(timestamp)); assertTrue(captor.getValue().getRelay().get().equals("foo")); @@ -46,12 +46,12 @@ public class DeliveryReceiptJobTest extends BaseUnitTest { } public void testNetworkError() throws IOException { - TextSecureMessageSender textSecureMessageSender = mock(TextSecureMessageSender.class); + SignalServiceMessageSender textSecureMessageSender = mock(SignalServiceMessageSender.class); long timestamp = System.currentTimeMillis(); Mockito.doThrow(new PushNetworkException("network error")) .when(textSecureMessageSender) - .sendDeliveryReceipt(any(TextSecureAddress.class), eq(timestamp)); + .sendDeliveryReceipt(any(SignalServiceAddress.class), eq(timestamp)); DeliveryReceiptJob deliveryReceiptJob = new DeliveryReceiptJob(context, @@ -70,7 +70,7 @@ public class DeliveryReceiptJobTest extends BaseUnitTest { Mockito.doThrow(new NotFoundException("not found")) .when(textSecureMessageSender) - .sendDeliveryReceipt(any(TextSecureAddress.class), eq(timestamp)); + .sendDeliveryReceipt(any(SignalServiceAddress.class), eq(timestamp)); try { deliveryReceiptJob.onRun(); @@ -83,17 +83,17 @@ public class DeliveryReceiptJobTest extends BaseUnitTest { @Module(injects = DeliveryReceiptJob.class) public static class TestModule { - private final TextSecureMessageSender textSecureMessageSender; + private final SignalServiceMessageSender textSecureMessageSender; - public TestModule(TextSecureMessageSender textSecureMessageSender) { + public TestModule(SignalServiceMessageSender textSecureMessageSender) { this.textSecureMessageSender = textSecureMessageSender; } @Provides - TextSecureMessageSenderFactory provideTextSecureMessageSenderFactory() { + TextSecureMessageSenderFactory provideSignalServiceMessageSenderFactory() { return new TextSecureMessageSenderFactory() { @Override - public TextSecureMessageSender create() { + public SignalServiceMessageSender create() { return textSecureMessageSender; } }; diff --git a/test/unitTest/java/org/thoughtcrime/securesms/util/PhoneNumberFormatterTest.java b/test/unitTest/java/org/thoughtcrime/securesms/util/PhoneNumberFormatterTest.java index 732a2ceef6..2260d3f6c9 100644 --- a/test/unitTest/java/org/thoughtcrime/securesms/util/PhoneNumberFormatterTest.java +++ b/test/unitTest/java/org/thoughtcrime/securesms/util/PhoneNumberFormatterTest.java @@ -4,8 +4,8 @@ import junit.framework.AssertionFailedError; import org.junit.Test; import org.thoughtcrime.securesms.BaseUnitTest; -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 static org.assertj.core.api.Assertions.assertThat;