Search in sources :

Example 1 with StreamDetails

use of org.whispersystems.signalservice.api.util.StreamDetails in project Signal-Android by signalapp.

the class SignalServiceAccountManager method setVersionedProfile.

/**
 * @return The avatar URL path, if one was written.
 */
public Optional<String> setVersionedProfile(ACI aci, ProfileKey profileKey, String name, String about, String aboutEmoji, Optional<SignalServiceProtos.PaymentAddress> paymentsAddress, StreamDetails avatar, List<String> visibleBadgeIds) throws IOException {
    if (name == null)
        name = "";
    ProfileCipher profileCipher = new ProfileCipher(profileKey);
    byte[] ciphertextName = profileCipher.encryptString(name, ProfileCipher.getTargetNameLength(name));
    byte[] ciphertextAbout = profileCipher.encryptString(about, ProfileCipher.getTargetAboutLength(about));
    byte[] ciphertextEmoji = profileCipher.encryptString(aboutEmoji, ProfileCipher.EMOJI_PADDED_LENGTH);
    byte[] ciphertextMobileCoinAddress = paymentsAddress.transform(address -> profileCipher.encryptWithLength(address.toByteArray(), ProfileCipher.PAYMENTS_ADDRESS_CONTENT_SIZE)).orNull();
    boolean hasAvatar = avatar != null;
    ProfileAvatarData profileAvatarData = null;
    if (hasAvatar) {
        profileAvatarData = new ProfileAvatarData(avatar.getStream(), ProfileCipherOutputStream.getCiphertextLength(avatar.getLength()), avatar.getContentType(), new ProfileCipherOutputStreamFactory(profileKey));
    }
    return this.pushServiceSocket.writeProfile(new SignalServiceProfileWrite(profileKey.getProfileKeyVersion(aci.uuid()).serialize(), ciphertextName, ciphertextAbout, ciphertextEmoji, ciphertextMobileCoinAddress, hasAvatar, profileKey.getCommitment(aci.uuid()).serialize(), visibleBadgeIds), profileAvatarData);
}
Also used : ReadOperation(org.whispersystems.signalservice.internal.storage.protos.ReadOperation) ServiceIdType(org.whispersystems.signalservice.api.push.ServiceIdType) Quote(org.whispersystems.signalservice.internal.contacts.crypto.Quote) ProfileKey(org.signal.zkgroup.profiles.ProfileKey) StorageManifest(org.whispersystems.signalservice.internal.storage.protos.StorageManifest) ProfileCipher(org.whispersystems.signalservice.api.crypto.ProfileCipher) ProfileAndCredential(org.whispersystems.signalservice.api.profiles.ProfileAndCredential) StorageKey(org.whispersystems.signalservice.api.storage.StorageKey) Preconditions(org.whispersystems.libsignal.util.guava.Preconditions) Map(java.util.Map) SignalStorageModels(org.whispersystems.signalservice.api.storage.SignalStorageModels) AuthCredentials(org.whispersystems.signalservice.internal.push.AuthCredentials) ProvisionMessage(org.whispersystems.signalservice.internal.push.ProvisioningProtos.ProvisionMessage) RequestVerificationCodeResponse(org.whispersystems.signalservice.internal.push.RequestVerificationCodeResponse) SignalStorageCipher(org.whispersystems.signalservice.api.storage.SignalStorageCipher) SignalServiceProtos(org.whispersystems.signalservice.internal.push.SignalServiceProtos) RemoteAttestationUtil(org.whispersystems.signalservice.internal.push.RemoteAttestationUtil) ACI(org.whispersystems.signalservice.api.push.ACI) Set(java.util.Set) GroupsV2Operations(org.whispersystems.signalservice.api.groupsv2.GroupsV2Operations) IdentityKey(org.whispersystems.libsignal.IdentityKey) CredentialsProvider(org.whispersystems.signalservice.api.util.CredentialsProvider) ProfileCipherOutputStream(org.whispersystems.signalservice.api.crypto.ProfileCipherOutputStream) Base64(org.whispersystems.util.Base64) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) IdentityKeyPair(org.whispersystems.libsignal.IdentityKeyPair) StorageManifestKey(org.whispersystems.signalservice.api.storage.StorageManifestKey) SignalStorageRecord(org.whispersystems.signalservice.api.storage.SignalStorageRecord) NoContentException(org.whispersystems.signalservice.api.push.exceptions.NoContentException) Single(io.reactivex.rxjava3.core.Single) SignalServiceProfileWrite(org.whispersystems.signalservice.api.profiles.SignalServiceProfileWrite) PreKeyRecord(org.whispersystems.libsignal.state.PreKeyRecord) InvalidKeyException(org.whispersystems.libsignal.InvalidKeyException) ArrayList(java.util.ArrayList) WhoAmIResponse(org.whispersystems.signalservice.internal.push.WhoAmIResponse) ECPublicKey(org.whispersystems.libsignal.ecc.ECPublicKey) DeviceInfo(org.whispersystems.signalservice.api.messages.multidevice.DeviceInfo) StaticCredentialsProvider(org.whispersystems.signalservice.internal.util.StaticCredentialsProvider) UnauthenticatedQuoteException(org.whispersystems.signalservice.internal.contacts.crypto.UnauthenticatedQuoteException) ProfileKeyCredential(org.signal.zkgroup.profiles.ProfileKeyCredential) PushNetworkException(org.whispersystems.signalservice.api.push.exceptions.PushNetworkException) StreamDetails(org.whispersystems.signalservice.api.util.StreamDetails) IOException(java.io.IOException) ProfileAvatarData(org.whispersystems.signalservice.internal.push.ProfileAvatarData) GroupsV2Api(org.whispersystems.signalservice.api.groupsv2.GroupsV2Api) Optional(org.whispersystems.libsignal.util.guava.Optional) ExecutionException(java.util.concurrent.ExecutionException) PrimaryProvisioningCipher(org.whispersystems.signalservice.internal.crypto.PrimaryProvisioningCipher) ServiceId(org.whispersystems.signalservice.api.push.ServiceId) RemoteConfigResponse(org.whispersystems.signalservice.internal.push.RemoteConfigResponse) StorageItems(org.whispersystems.signalservice.internal.storage.protos.StorageItems) MasterKey(org.whispersystems.signalservice.api.kbs.MasterKey) TurnServerInfo(org.whispersystems.signalservice.api.messages.calls.TurnServerInfo) ManifestRecord(org.whispersystems.signalservice.internal.storage.protos.ManifestRecord) WriteOperation(org.whispersystems.signalservice.internal.storage.protos.WriteOperation) Util(org.whispersystems.signalservice.internal.util.Util) TimeoutException(java.util.concurrent.TimeoutException) SignedPreKeyRecord(org.whispersystems.libsignal.state.SignedPreKeyRecord) NotFoundException(org.whispersystems.signalservice.api.push.exceptions.NotFoundException) DiscoveryRequest(org.whispersystems.signalservice.internal.contacts.entities.DiscoveryRequest) ByteArrayInputStream(java.io.ByteArrayInputStream) Locale(java.util.Locale) NonSuccessfulResponseCodeException(org.whispersystems.signalservice.api.push.exceptions.NonSuccessfulResponseCodeException) InvalidCiphertextException(org.whispersystems.signalservice.api.crypto.InvalidCiphertextException) CdshAuthResponse(org.whispersystems.signalservice.internal.push.CdshAuthResponse) StorageId(org.whispersystems.signalservice.api.storage.StorageId) ContactDiscoveryCipher(org.whispersystems.signalservice.internal.contacts.crypto.ContactDiscoveryCipher) VerifyAccountResponse(org.whispersystems.signalservice.internal.push.VerifyAccountResponse) PushServiceSocket(org.whispersystems.signalservice.internal.push.PushServiceSocket) VerifyDeviceResponse(org.whispersystems.signalservice.api.messages.multidevice.VerifyDeviceResponse) SignatureException(java.security.SignatureException) Collection(java.util.Collection) KeyStore(java.security.KeyStore) UUID(java.util.UUID) SignalServiceConfiguration(org.whispersystems.signalservice.internal.configuration.SignalServiceConfiguration) ByteString(com.google.protobuf.ByteString) DiscoveryResponse(org.whispersystems.signalservice.internal.contacts.entities.DiscoveryResponse) List(java.util.List) CurrencyConversions(org.whispersystems.signalservice.api.payments.CurrencyConversions) ProfileCipherOutputStreamFactory(org.whispersystems.signalservice.internal.push.http.ProfileCipherOutputStreamFactory) ProvisioningVersion(org.whispersystems.signalservice.internal.push.ProvisioningProtos.ProvisioningVersion) CdshService(org.whispersystems.signalservice.api.services.CdshService) AccountAttributes(org.whispersystems.signalservice.api.account.AccountAttributes) DataInputStream(java.io.DataInputStream) MessageDigest(java.security.MessageDigest) HashMap(java.util.HashMap) ClientZkOperations(org.whispersystems.signalservice.api.groupsv2.ClientZkOperations) UnauthenticatedResponseException(org.whispersystems.signalservice.internal.contacts.crypto.UnauthenticatedResponseException) Log(org.whispersystems.libsignal.logging.Log) LinkedList(java.util.LinkedList) SignalStorageManifest(org.whispersystems.signalservice.api.storage.SignalStorageManifest) PNI(org.whispersystems.signalservice.api.push.PNI) SignedPreKeyEntity(org.whispersystems.signalservice.api.push.SignedPreKeyEntity) RemoteAttestation(org.whispersystems.signalservice.internal.contacts.crypto.RemoteAttestation) ServiceResponse(org.whispersystems.signalservice.internal.ServiceResponse) TimeUnit(java.util.concurrent.TimeUnit) StorageItem(org.whispersystems.signalservice.internal.storage.protos.StorageItem) Collections(java.util.Collections) ProfileCipherOutputStreamFactory(org.whispersystems.signalservice.internal.push.http.ProfileCipherOutputStreamFactory) SignalServiceProfileWrite(org.whispersystems.signalservice.api.profiles.SignalServiceProfileWrite) ProfileCipher(org.whispersystems.signalservice.api.crypto.ProfileCipher) ProfileAvatarData(org.whispersystems.signalservice.internal.push.ProfileAvatarData)

Example 2 with StreamDetails

use of org.whispersystems.signalservice.api.util.StreamDetails in project Signal-Android by signalapp.

the class CreateProfileActivity method handleUpload.

private void handleUpload() {
    final String name;
    final StreamDetails avatar;
    if (TextUtils.isEmpty(this.name.getText().toString()))
        name = null;
    else
        name = this.name.getText().toString();
    if (avatarBytes == null || avatarBytes.length == 0)
        avatar = null;
    else
        avatar = new StreamDetails(new ByteArrayInputStream(avatarBytes), "image/jpeg", avatarBytes.length);
    new AsyncTask<Void, Void, Boolean>() {

        @Override
        protected Boolean doInBackground(Void... params) {
            Context context = CreateProfileActivity.this;
            byte[] profileKey = ProfileKeyUtil.getProfileKey(CreateProfileActivity.this);
            try {
                accountManager.setProfileName(profileKey, name);
                TextSecurePreferences.setProfileName(context, name);
            } catch (IOException e) {
                Log.w(TAG, e);
                return false;
            }
            try {
                accountManager.setProfileAvatar(profileKey, avatar);
                AvatarHelper.setAvatar(CreateProfileActivity.this, Address.fromSerialized(TextSecurePreferences.getLocalNumber(context)), avatarBytes);
                TextSecurePreferences.setProfileAvatarId(CreateProfileActivity.this, new SecureRandom().nextInt());
            } catch (IOException e) {
                Log.w(TAG, e);
                return false;
            }
            ApplicationContext.getInstance(context).getJobManager().add(new MultiDeviceProfileKeyUpdateJob(context));
            return true;
        }

        @Override
        public void onPostExecute(Boolean result) {
            super.onPostExecute(result);
            if (result) {
                if (captureFile != null)
                    captureFile.delete();
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
                    handleFinishedLollipop();
                else
                    handleFinishedLegacy();
            } else {
                Toast.makeText(CreateProfileActivity.this, R.string.CreateProfileActivity_problem_setting_profile, Toast.LENGTH_LONG).show();
            }
        }
    }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
Also used : Context(android.content.Context) ByteArrayInputStream(java.io.ByteArrayInputStream) StreamDetails(org.whispersystems.signalservice.api.util.StreamDetails) SecureRandom(java.security.SecureRandom) MultiDeviceProfileKeyUpdateJob(org.thoughtcrime.securesms.jobs.MultiDeviceProfileKeyUpdateJob) IOException(java.io.IOException)

Example 3 with StreamDetails

use of org.whispersystems.signalservice.api.util.StreamDetails in project Signal-Android by WhisperSystems.

the class ManageProfileRepository method setAvatar.

public void setAvatar(@NonNull Context context, @NonNull byte[] data, @NonNull String contentType, @NonNull Consumer<Result> callback) {
    SignalExecutors.UNBOUNDED.execute(() -> {
        try {
            ProfileUtil.uploadProfileWithAvatar(context, new StreamDetails(new ByteArrayInputStream(data), contentType, data.length));
            AvatarHelper.setAvatar(context, Recipient.self().getId(), new ByteArrayInputStream(data));
            SignalStore.misc().markHasEverHadAnAvatar();
            ApplicationDependencies.getJobManager().add(new MultiDeviceProfileContentUpdateJob());
            callback.accept(Result.SUCCESS);
        } catch (IOException e) {
            Log.w(TAG, "Failed to upload profile during avatar change.", e);
            callback.accept(Result.FAILURE_NETWORK);
        }
    });
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) StreamDetails(org.whispersystems.signalservice.api.util.StreamDetails) IOException(java.io.IOException) MultiDeviceProfileContentUpdateJob(org.thoughtcrime.securesms.jobs.MultiDeviceProfileContentUpdateJob)

Example 4 with StreamDetails

use of org.whispersystems.signalservice.api.util.StreamDetails in project Signal-Android by WhisperSystems.

the class SignalServiceAccountManager method setVersionedProfile.

/**
 * @return The avatar URL path, if one was written.
 */
public Optional<String> setVersionedProfile(ACI aci, ProfileKey profileKey, String name, String about, String aboutEmoji, Optional<SignalServiceProtos.PaymentAddress> paymentsAddress, StreamDetails avatar, List<String> visibleBadgeIds) throws IOException {
    if (name == null)
        name = "";
    ProfileCipher profileCipher = new ProfileCipher(profileKey);
    byte[] ciphertextName = profileCipher.encryptString(name, ProfileCipher.getTargetNameLength(name));
    byte[] ciphertextAbout = profileCipher.encryptString(about, ProfileCipher.getTargetAboutLength(about));
    byte[] ciphertextEmoji = profileCipher.encryptString(aboutEmoji, ProfileCipher.EMOJI_PADDED_LENGTH);
    byte[] ciphertextMobileCoinAddress = paymentsAddress.transform(address -> profileCipher.encryptWithLength(address.toByteArray(), ProfileCipher.PAYMENTS_ADDRESS_CONTENT_SIZE)).orNull();
    boolean hasAvatar = avatar != null;
    ProfileAvatarData profileAvatarData = null;
    if (hasAvatar) {
        profileAvatarData = new ProfileAvatarData(avatar.getStream(), ProfileCipherOutputStream.getCiphertextLength(avatar.getLength()), avatar.getContentType(), new ProfileCipherOutputStreamFactory(profileKey));
    }
    return this.pushServiceSocket.writeProfile(new SignalServiceProfileWrite(profileKey.getProfileKeyVersion(aci.uuid()).serialize(), ciphertextName, ciphertextAbout, ciphertextEmoji, ciphertextMobileCoinAddress, hasAvatar, profileKey.getCommitment(aci.uuid()).serialize(), visibleBadgeIds), profileAvatarData);
}
Also used : ReadOperation(org.whispersystems.signalservice.internal.storage.protos.ReadOperation) ServiceIdType(org.whispersystems.signalservice.api.push.ServiceIdType) Quote(org.whispersystems.signalservice.internal.contacts.crypto.Quote) ProfileKey(org.signal.zkgroup.profiles.ProfileKey) StorageManifest(org.whispersystems.signalservice.internal.storage.protos.StorageManifest) ProfileCipher(org.whispersystems.signalservice.api.crypto.ProfileCipher) ProfileAndCredential(org.whispersystems.signalservice.api.profiles.ProfileAndCredential) StorageKey(org.whispersystems.signalservice.api.storage.StorageKey) Preconditions(org.whispersystems.libsignal.util.guava.Preconditions) Map(java.util.Map) SignalStorageModels(org.whispersystems.signalservice.api.storage.SignalStorageModels) AuthCredentials(org.whispersystems.signalservice.internal.push.AuthCredentials) ProvisionMessage(org.whispersystems.signalservice.internal.push.ProvisioningProtos.ProvisionMessage) RequestVerificationCodeResponse(org.whispersystems.signalservice.internal.push.RequestVerificationCodeResponse) SignalStorageCipher(org.whispersystems.signalservice.api.storage.SignalStorageCipher) SignalServiceProtos(org.whispersystems.signalservice.internal.push.SignalServiceProtos) RemoteAttestationUtil(org.whispersystems.signalservice.internal.push.RemoteAttestationUtil) ACI(org.whispersystems.signalservice.api.push.ACI) Set(java.util.Set) GroupsV2Operations(org.whispersystems.signalservice.api.groupsv2.GroupsV2Operations) IdentityKey(org.whispersystems.libsignal.IdentityKey) CredentialsProvider(org.whispersystems.signalservice.api.util.CredentialsProvider) ProfileCipherOutputStream(org.whispersystems.signalservice.api.crypto.ProfileCipherOutputStream) Base64(org.whispersystems.util.Base64) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) IdentityKeyPair(org.whispersystems.libsignal.IdentityKeyPair) StorageManifestKey(org.whispersystems.signalservice.api.storage.StorageManifestKey) SignalStorageRecord(org.whispersystems.signalservice.api.storage.SignalStorageRecord) NoContentException(org.whispersystems.signalservice.api.push.exceptions.NoContentException) Single(io.reactivex.rxjava3.core.Single) SignalServiceProfileWrite(org.whispersystems.signalservice.api.profiles.SignalServiceProfileWrite) PreKeyRecord(org.whispersystems.libsignal.state.PreKeyRecord) InvalidKeyException(org.whispersystems.libsignal.InvalidKeyException) ArrayList(java.util.ArrayList) WhoAmIResponse(org.whispersystems.signalservice.internal.push.WhoAmIResponse) ECPublicKey(org.whispersystems.libsignal.ecc.ECPublicKey) DeviceInfo(org.whispersystems.signalservice.api.messages.multidevice.DeviceInfo) StaticCredentialsProvider(org.whispersystems.signalservice.internal.util.StaticCredentialsProvider) UnauthenticatedQuoteException(org.whispersystems.signalservice.internal.contacts.crypto.UnauthenticatedQuoteException) ProfileKeyCredential(org.signal.zkgroup.profiles.ProfileKeyCredential) PushNetworkException(org.whispersystems.signalservice.api.push.exceptions.PushNetworkException) StreamDetails(org.whispersystems.signalservice.api.util.StreamDetails) IOException(java.io.IOException) ProfileAvatarData(org.whispersystems.signalservice.internal.push.ProfileAvatarData) GroupsV2Api(org.whispersystems.signalservice.api.groupsv2.GroupsV2Api) Optional(org.whispersystems.libsignal.util.guava.Optional) ExecutionException(java.util.concurrent.ExecutionException) PrimaryProvisioningCipher(org.whispersystems.signalservice.internal.crypto.PrimaryProvisioningCipher) ServiceId(org.whispersystems.signalservice.api.push.ServiceId) RemoteConfigResponse(org.whispersystems.signalservice.internal.push.RemoteConfigResponse) StorageItems(org.whispersystems.signalservice.internal.storage.protos.StorageItems) MasterKey(org.whispersystems.signalservice.api.kbs.MasterKey) TurnServerInfo(org.whispersystems.signalservice.api.messages.calls.TurnServerInfo) ManifestRecord(org.whispersystems.signalservice.internal.storage.protos.ManifestRecord) WriteOperation(org.whispersystems.signalservice.internal.storage.protos.WriteOperation) Util(org.whispersystems.signalservice.internal.util.Util) TimeoutException(java.util.concurrent.TimeoutException) SignedPreKeyRecord(org.whispersystems.libsignal.state.SignedPreKeyRecord) NotFoundException(org.whispersystems.signalservice.api.push.exceptions.NotFoundException) DiscoveryRequest(org.whispersystems.signalservice.internal.contacts.entities.DiscoveryRequest) ByteArrayInputStream(java.io.ByteArrayInputStream) Locale(java.util.Locale) NonSuccessfulResponseCodeException(org.whispersystems.signalservice.api.push.exceptions.NonSuccessfulResponseCodeException) InvalidCiphertextException(org.whispersystems.signalservice.api.crypto.InvalidCiphertextException) CdshAuthResponse(org.whispersystems.signalservice.internal.push.CdshAuthResponse) StorageId(org.whispersystems.signalservice.api.storage.StorageId) ContactDiscoveryCipher(org.whispersystems.signalservice.internal.contacts.crypto.ContactDiscoveryCipher) VerifyAccountResponse(org.whispersystems.signalservice.internal.push.VerifyAccountResponse) PushServiceSocket(org.whispersystems.signalservice.internal.push.PushServiceSocket) VerifyDeviceResponse(org.whispersystems.signalservice.api.messages.multidevice.VerifyDeviceResponse) SignatureException(java.security.SignatureException) Collection(java.util.Collection) KeyStore(java.security.KeyStore) UUID(java.util.UUID) SignalServiceConfiguration(org.whispersystems.signalservice.internal.configuration.SignalServiceConfiguration) ByteString(com.google.protobuf.ByteString) DiscoveryResponse(org.whispersystems.signalservice.internal.contacts.entities.DiscoveryResponse) List(java.util.List) CurrencyConversions(org.whispersystems.signalservice.api.payments.CurrencyConversions) ProfileCipherOutputStreamFactory(org.whispersystems.signalservice.internal.push.http.ProfileCipherOutputStreamFactory) ProvisioningVersion(org.whispersystems.signalservice.internal.push.ProvisioningProtos.ProvisioningVersion) CdshService(org.whispersystems.signalservice.api.services.CdshService) AccountAttributes(org.whispersystems.signalservice.api.account.AccountAttributes) DataInputStream(java.io.DataInputStream) MessageDigest(java.security.MessageDigest) HashMap(java.util.HashMap) ClientZkOperations(org.whispersystems.signalservice.api.groupsv2.ClientZkOperations) UnauthenticatedResponseException(org.whispersystems.signalservice.internal.contacts.crypto.UnauthenticatedResponseException) Log(org.whispersystems.libsignal.logging.Log) LinkedList(java.util.LinkedList) SignalStorageManifest(org.whispersystems.signalservice.api.storage.SignalStorageManifest) PNI(org.whispersystems.signalservice.api.push.PNI) SignedPreKeyEntity(org.whispersystems.signalservice.api.push.SignedPreKeyEntity) RemoteAttestation(org.whispersystems.signalservice.internal.contacts.crypto.RemoteAttestation) ServiceResponse(org.whispersystems.signalservice.internal.ServiceResponse) TimeUnit(java.util.concurrent.TimeUnit) StorageItem(org.whispersystems.signalservice.internal.storage.protos.StorageItem) Collections(java.util.Collections) ProfileCipherOutputStreamFactory(org.whispersystems.signalservice.internal.push.http.ProfileCipherOutputStreamFactory) SignalServiceProfileWrite(org.whispersystems.signalservice.api.profiles.SignalServiceProfileWrite) ProfileCipher(org.whispersystems.signalservice.api.crypto.ProfileCipher) ProfileAvatarData(org.whispersystems.signalservice.internal.push.ProfileAvatarData)

Example 5 with StreamDetails

use of org.whispersystems.signalservice.api.util.StreamDetails in project Signal-Android by signalapp.

the class ManageProfileRepository method setAvatar.

public void setAvatar(@NonNull Context context, @NonNull byte[] data, @NonNull String contentType, @NonNull Consumer<Result> callback) {
    SignalExecutors.UNBOUNDED.execute(() -> {
        try {
            ProfileUtil.uploadProfileWithAvatar(context, new StreamDetails(new ByteArrayInputStream(data), contentType, data.length));
            AvatarHelper.setAvatar(context, Recipient.self().getId(), new ByteArrayInputStream(data));
            SignalStore.misc().markHasEverHadAnAvatar();
            ApplicationDependencies.getJobManager().add(new MultiDeviceProfileContentUpdateJob());
            callback.accept(Result.SUCCESS);
        } catch (IOException e) {
            Log.w(TAG, "Failed to upload profile during avatar change.", e);
            callback.accept(Result.FAILURE_NETWORK);
        }
    });
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) StreamDetails(org.whispersystems.signalservice.api.util.StreamDetails) IOException(java.io.IOException) MultiDeviceProfileContentUpdateJob(org.thoughtcrime.securesms.jobs.MultiDeviceProfileContentUpdateJob)

Aggregations

ByteArrayInputStream (java.io.ByteArrayInputStream)5 IOException (java.io.IOException)5 StreamDetails (org.whispersystems.signalservice.api.util.StreamDetails)4 ByteString (com.google.protobuf.ByteString)2 Single (io.reactivex.rxjava3.core.Single)2 DataInputStream (java.io.DataInputStream)2 KeyStore (java.security.KeyStore)2 MessageDigest (java.security.MessageDigest)2 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)2 SignatureException (java.security.SignatureException)2 ArrayList (java.util.ArrayList)2 Collection (java.util.Collection)2 Collections (java.util.Collections)2 HashMap (java.util.HashMap)2 LinkedList (java.util.LinkedList)2 List (java.util.List)2 Locale (java.util.Locale)2 Map (java.util.Map)2 Set (java.util.Set)2 UUID (java.util.UUID)2