Server signed group v2 changes sent and received P2P.

This commit is contained in:
Alan Evans
2020-05-19 16:02:24 -03:00
committed by Greyson Parrelli
parent ec8d5defd4
commit 2f9320989a
8 changed files with 98 additions and 49 deletions

View File

@@ -1072,10 +1072,17 @@ public class SignalServiceMessageSender {
}
private static GroupContextV2 createGroupContent(SignalServiceGroupV2 group) {
return GroupContextV2.newBuilder()
.setMasterKey(ByteString.copyFrom(group.getMasterKey().serialize()))
.setRevision(group.getRevision())
.build();
GroupContextV2.Builder builder = GroupContextV2.newBuilder()
.setMasterKey(ByteString.copyFrom(group.getMasterKey().serialize()))
.setRevision(group.getRevision());
byte[] signedGroupChange = group.getSignedGroupChange();
if (signedGroupChange != null && signedGroupChange.length <= 2048) {
builder.setGroupChange(ByteString.copyFrom(signedGroupChange));
}
return builder.build();
}
private List<DataMessage.Contact> createSharedContactContent(List<SharedContact> contacts) throws IOException {

View File

@@ -132,15 +132,11 @@ public final class GroupsV2Api {
return form.getKey();
}
public DecryptedGroupChange patchGroup(GroupChange.Actions groupChange,
GroupSecretParams groupSecretParams,
GroupsV2AuthorizationString authorization)
throws IOException, VerificationFailedException, InvalidGroupStateException
public GroupChange patchGroup(GroupChange.Actions groupChange,
GroupsV2AuthorizationString authorization)
throws IOException
{
GroupChange groupChanges = socket.patchGroupsV2Group(groupChange, authorization.toString());
return groupsOperations.forGroup(groupSecretParams)
.decryptChange(groupChanges, true);
return socket.patchGroupsV2Group(groupChange, authorization.toString());
}
private static HashMap<Integer, AuthCredentialResponse> parseCredentialResponse(CredentialResponse credentialResponse)