X-Git-Url: https://git.nmode.ca/signal-cli/blobdiff_plain/4f2261e86f493a9c8954c02c52ddaa9a46490d20..b738f5740c94fe7a5df9e322e1345a99ef0c5ce5:/src/main/java/org/asamk/signal/manager/helper/ProfileHelper.java diff --git a/src/main/java/org/asamk/signal/manager/helper/ProfileHelper.java b/src/main/java/org/asamk/signal/manager/helper/ProfileHelper.java index f775cc1c..c81e2ff7 100644 --- a/src/main/java/org/asamk/signal/manager/helper/ProfileHelper.java +++ b/src/main/java/org/asamk/signal/manager/helper/ProfileHelper.java @@ -4,8 +4,6 @@ import org.signal.zkgroup.profiles.ProfileKey; import org.whispersystems.libsignal.util.guava.Optional; import org.whispersystems.signalservice.api.SignalServiceMessagePipe; import org.whispersystems.signalservice.api.SignalServiceMessageReceiver; -import org.whispersystems.signalservice.api.crypto.InvalidCiphertextException; -import org.whispersystems.signalservice.api.crypto.ProfileCipher; import org.whispersystems.signalservice.api.crypto.UnidentifiedAccess; import org.whispersystems.signalservice.api.crypto.UnidentifiedAccessPair; import org.whispersystems.signalservice.api.profiles.ProfileAndCredential; @@ -15,7 +13,6 @@ import org.whispersystems.signalservice.api.push.exceptions.NotFoundException; import org.whispersystems.signalservice.api.push.exceptions.PushNetworkException; import org.whispersystems.signalservice.internal.util.concurrent.CascadingFuture; import org.whispersystems.signalservice.internal.util.concurrent.ListenableFuture; -import org.whispersystems.util.Base64; import java.io.IOException; import java.util.Arrays; @@ -46,8 +43,7 @@ public final class ProfileHelper { } public ProfileAndCredential retrieveProfileSync( - SignalServiceAddress recipient, - SignalServiceProfile.RequestType requestType + SignalServiceAddress recipient, SignalServiceProfile.RequestType requestType ) throws IOException { try { return retrieveProfile(recipient, requestType).get(10, TimeUnit.SECONDS); @@ -65,37 +61,29 @@ public final class ProfileHelper { } public ListenableFuture retrieveProfile( - SignalServiceAddress address, - SignalServiceProfile.RequestType requestType + SignalServiceAddress address, SignalServiceProfile.RequestType requestType ) { Optional unidentifiedAccess = getUnidentifiedAccess(address); Optional profileKey = Optional.fromNullable(profileKeyProvider.getProfileKey(address)); if (unidentifiedAccess.isPresent()) { - return new CascadingFuture<>(Arrays.asList(() -> getPipeRetrievalFuture(address, profileKey, unidentifiedAccess, requestType), + return new CascadingFuture<>(Arrays.asList(() -> getPipeRetrievalFuture(address, + profileKey, + unidentifiedAccess, + requestType), () -> getSocketRetrievalFuture(address, profileKey, unidentifiedAccess, requestType), () -> getPipeRetrievalFuture(address, profileKey, Optional.absent(), requestType), () -> getSocketRetrievalFuture(address, profileKey, Optional.absent(), requestType)), e -> !(e instanceof NotFoundException)); } else { - return new CascadingFuture<>(Arrays.asList(() -> getPipeRetrievalFuture(address, profileKey, Optional.absent(), requestType), - () -> getSocketRetrievalFuture(address, profileKey, Optional.absent(), requestType)), + return new CascadingFuture<>(Arrays.asList(() -> getPipeRetrievalFuture(address, + profileKey, + Optional.absent(), + requestType), () -> getSocketRetrievalFuture(address, profileKey, Optional.absent(), requestType)), e -> !(e instanceof NotFoundException)); } } - public String decryptName( - ProfileKey profileKey, - String encryptedName - ) throws InvalidCiphertextException, IOException { - if (encryptedName == null) { - return null; - } - - ProfileCipher profileCipher = new ProfileCipher(profileKey); - return new String(profileCipher.decryptName(Base64.decode(encryptedName))); - } - private ListenableFuture getPipeRetrievalFuture( SignalServiceAddress address, Optional profileKey,