mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 18:40:39 +00:00
Extract decryptProfileIfKeyKnown helper method
This commit is contained in:
parent
07893546d0
commit
b1ebdc8343
1 changed files with 11 additions and 5 deletions
|
@ -618,21 +618,27 @@ public class Manager implements Closeable {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
profile = decryptProfileIfKeyKnown(recipientId, encryptedProfile);
|
||||||
|
account.getProfileStore().storeProfile(recipientId, profile);
|
||||||
|
|
||||||
|
return profile;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Profile decryptProfileIfKeyKnown(
|
||||||
|
final RecipientId recipientId, final SignalServiceProfile encryptedProfile
|
||||||
|
) {
|
||||||
var profileKey = account.getProfileStore().getProfileKey(recipientId);
|
var profileKey = account.getProfileStore().getProfileKey(recipientId);
|
||||||
if (profileKey == null) {
|
if (profileKey == null) {
|
||||||
profile = new Profile(System.currentTimeMillis(),
|
return new Profile(System.currentTimeMillis(),
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
ProfileUtils.getUnidentifiedAccessMode(encryptedProfile, null),
|
ProfileUtils.getUnidentifiedAccessMode(encryptedProfile, null),
|
||||||
ProfileUtils.getCapabilities(encryptedProfile));
|
ProfileUtils.getCapabilities(encryptedProfile));
|
||||||
} else {
|
|
||||||
profile = decryptProfileAndDownloadAvatar(recipientId, profileKey, encryptedProfile);
|
|
||||||
}
|
}
|
||||||
account.getProfileStore().storeProfile(recipientId, profile);
|
|
||||||
|
|
||||||
return profile;
|
return decryptProfileAndDownloadAvatar(recipientId, profileKey, encryptedProfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
private SignalServiceProfile retrieveEncryptedProfile(RecipientId recipientId) {
|
private SignalServiceProfile retrieveEncryptedProfile(RecipientId recipientId) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue