mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-19 16:19:33 +01:00
Treat member labels as unset if they can't be decrypted.
This commit is contained in:
@@ -769,8 +769,8 @@ public final class GroupsV2Operations {
|
||||
modifyMemberLabels.add(
|
||||
new DecryptedModifyMemberLabel.Builder()
|
||||
.aciBytes(decryptAciToBinary(action.userId))
|
||||
.labelEmoji(Objects.requireNonNullElse(decryptString(action.labelEmoji), ""))
|
||||
.labelString(Objects.requireNonNullElse(decryptString(action.labelString), ""))
|
||||
.labelEmoji(decryptMemberLabelEmoji(action.labelEmoji))
|
||||
.labelString(decryptMemberLabelText(action.labelString))
|
||||
.build()
|
||||
);
|
||||
}
|
||||
@@ -817,8 +817,8 @@ public final class GroupsV2Operations {
|
||||
private DecryptedMember.Builder decryptMember(Member member)
|
||||
throws InvalidGroupStateException, VerificationFailedException, InvalidInputException
|
||||
{
|
||||
String labelEmoji = Objects.requireNonNullElse(decryptString(member.labelEmoji), "");
|
||||
String labelString = Objects.requireNonNullElse(decryptString(member.labelString), "");
|
||||
String labelEmoji = decryptMemberLabelEmoji(member.labelEmoji);
|
||||
String labelString = decryptMemberLabelText(member.labelString);
|
||||
|
||||
if (member.presentation.size() == 0) {
|
||||
ACI aci = decryptAci(member.userId);
|
||||
@@ -1072,6 +1072,26 @@ public final class GroupsV2Operations {
|
||||
return new String(decryptedBytes, StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
private String decryptMemberLabelText(@Nullable ByteString cipherText) {
|
||||
try {
|
||||
return Objects.requireNonNullElse(decryptString(cipherText), "");
|
||||
} catch (VerificationFailedException e) {
|
||||
Log.w(TAG, "Failed to decrypt member label string, treating as unset");
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
private String decryptMemberLabelEmoji(@Nullable ByteString cipherText) {
|
||||
try {
|
||||
return Objects.requireNonNullElse(decryptString(cipherText), "");
|
||||
} catch (VerificationFailedException e) {
|
||||
Log.w(TAG, "Failed to decrypt member label emoji, treating as unset");
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifies signature and parses actions on a group change.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user