mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 18:40:39 +00:00
Move decrypting recipient profile to separate method
This commit is contained in:
parent
3aade45643
commit
f96770df3c
1 changed files with 6 additions and 2 deletions
|
@ -425,7 +425,7 @@ public class Manager implements Closeable {
|
||||||
account.getDeviceId(), account.getSignalProtocolStore(), userAgent, account.isMultiDevice(), attachmentsV3, Optional.fromNullable(messagePipe), Optional.fromNullable(unidentifiedMessagePipe), Optional.absent(), clientZkProfileOperations);
|
account.getDeviceId(), account.getSignalProtocolStore(), userAgent, account.isMultiDevice(), attachmentsV3, Optional.fromNullable(messagePipe), Optional.fromNullable(unidentifiedMessagePipe), Optional.absent(), clientZkProfileOperations);
|
||||||
}
|
}
|
||||||
|
|
||||||
private SignalServiceProfile getRecipientProfile(SignalServiceAddress address, Optional<UnidentifiedAccess> unidentifiedAccess) throws IOException {
|
private SignalServiceProfile getEncryptedRecipientProfile(SignalServiceAddress address, Optional<UnidentifiedAccess> unidentifiedAccess) throws IOException {
|
||||||
SignalServiceMessagePipe pipe = unidentifiedMessagePipe != null && unidentifiedAccess.isPresent() ? unidentifiedMessagePipe
|
SignalServiceMessagePipe pipe = unidentifiedMessagePipe != null && unidentifiedAccess.isPresent() ? unidentifiedMessagePipe
|
||||||
: messagePipe;
|
: messagePipe;
|
||||||
|
|
||||||
|
@ -444,6 +444,10 @@ public class Manager implements Closeable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private SignalProfile getRecipientProfile(SignalServiceAddress address, Optional<UnidentifiedAccess> unidentifiedAccess, ProfileKey profileKey) throws IOException {
|
||||||
|
return decryptProfile(getEncryptedRecipientProfile(address, unidentifiedAccess), profileKey);
|
||||||
|
}
|
||||||
|
|
||||||
private Optional<SignalServiceAttachmentStream> createGroupAvatarAttachment(byte[] groupId) throws IOException {
|
private Optional<SignalServiceAttachmentStream> createGroupAvatarAttachment(byte[] groupId) throws IOException {
|
||||||
File file = getGroupAvatarFile(groupId);
|
File file = getGroupAvatarFile(groupId);
|
||||||
if (!file.exists()) {
|
if (!file.exists()) {
|
||||||
|
@ -980,7 +984,7 @@ public class Manager implements Closeable {
|
||||||
}
|
}
|
||||||
SignalProfile targetProfile;
|
SignalProfile targetProfile;
|
||||||
try {
|
try {
|
||||||
targetProfile = decryptProfile(getRecipientProfile(recipient, Optional.absent()), theirProfileKey);
|
targetProfile = getRecipientProfile(recipient, Optional.absent(), theirProfileKey);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
System.err.println("Failed to get recipient profile: " + e);
|
System.err.println("Failed to get recipient profile: " + e);
|
||||||
return null;
|
return null;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue