use of org.signal.zkgroup.profiles.ProfileKey in project Signal-Android by WhisperSystems.
the class GroupsV2Operations_decrypt_change_Test method can_decrypt_member_additions_direct_to_admin_field3.
@Test
public void can_decrypt_member_additions_direct_to_admin_field3() {
UUID self = UUID.randomUUID();
UUID newMember = UUID.randomUUID();
ProfileKey profileKey = newProfileKey();
GroupCandidate groupCandidate = groupCandidate(newMember, profileKey);
assertDecryption(groupOperations.createModifyGroupMembershipChange(Collections.singleton(groupCandidate), self).setRevision(10), DecryptedGroupChange.newBuilder().setRevision(10).addNewMembers(DecryptedMember.newBuilder().setRole(Member.Role.DEFAULT).setProfileKey(ByteString.copyFrom(profileKey.serialize())).setJoinedAtRevision(10).setUuid(UuidUtil.toByteString(newMember))));
}
use of org.signal.zkgroup.profiles.ProfileKey in project Signal-Android by WhisperSystems.
the class GroupsV2Operations_decrypt_change_Test method can_decrypt_member_requests_field16.
@Test
public void can_decrypt_member_requests_field16() {
UUID newRequestingMember = UUID.randomUUID();
ProfileKey profileKey = newProfileKey();
GroupCandidate groupCandidate = groupCandidate(newRequestingMember, profileKey);
assertDecryption(groupOperations.createGroupJoinRequest(groupCandidate.getProfileKeyCredential().get()).setRevision(10), DecryptedGroupChange.newBuilder().setRevision(10).addNewRequestingMembers(DecryptedRequestingMember.newBuilder().setUuid(UuidUtil.toByteString(newRequestingMember)).setProfileKey(ByteString.copyFrom(profileKey.serialize()))));
}
use of org.signal.zkgroup.profiles.ProfileKey in project Signal-Android by WhisperSystems.
the class GroupsV2Operations_decrypt_group_Test method decrypt_full_members_field_7.
@Test
public void decrypt_full_members_field_7() throws VerificationFailedException, InvalidGroupStateException {
UUID admin1 = UUID.randomUUID();
UUID member1 = UUID.randomUUID();
ProfileKey adminProfileKey = newProfileKey();
ProfileKey memberProfileKey = newProfileKey();
Group group = Group.newBuilder().addMembers(Member.newBuilder().setRole(Member.Role.ADMINISTRATOR).setUserId(groupOperations.encryptUuid(admin1)).setJoinedAtRevision(4).setProfileKey(encryptProfileKey(admin1, adminProfileKey))).addMembers(Member.newBuilder().setRole(Member.Role.DEFAULT).setUserId(groupOperations.encryptUuid(member1)).setJoinedAtRevision(7).setProfileKey(encryptProfileKey(member1, memberProfileKey))).build();
DecryptedGroup decryptedGroup = groupOperations.decryptGroup(group);
assertEquals(DecryptedGroup.newBuilder().addMembers(DecryptedMember.newBuilder().setJoinedAtRevision(4).setUuid(UuidUtil.toByteString(admin1)).setRole(Member.Role.ADMINISTRATOR).setProfileKey(ByteString.copyFrom(adminProfileKey.serialize()))).addMembers(DecryptedMember.newBuilder().setJoinedAtRevision(7).setRole(Member.Role.DEFAULT).setUuid(UuidUtil.toByteString(member1)).setProfileKey(ByteString.copyFrom(memberProfileKey.serialize()))).build().getMembersList(), decryptedGroup.getMembersList());
}
use of org.signal.zkgroup.profiles.ProfileKey in project Signal-Android by WhisperSystems.
the class GroupsV2Operations_decrypt_group_Test method decrypt_requesting_members_field_9.
@Test
public void decrypt_requesting_members_field_9() throws VerificationFailedException, InvalidGroupStateException {
UUID admin1 = UUID.randomUUID();
UUID member1 = UUID.randomUUID();
ProfileKey adminProfileKey = newProfileKey();
ProfileKey memberProfileKey = newProfileKey();
Group group = Group.newBuilder().addRequestingMembers(RequestingMember.newBuilder().setUserId(groupOperations.encryptUuid(admin1)).setProfileKey(encryptProfileKey(admin1, adminProfileKey)).setTimestamp(5000)).addRequestingMembers(RequestingMember.newBuilder().setUserId(groupOperations.encryptUuid(member1)).setProfileKey(encryptProfileKey(member1, memberProfileKey)).setTimestamp(15000)).build();
DecryptedGroup decryptedGroup = groupOperations.decryptGroup(group);
assertEquals(DecryptedGroup.newBuilder().addRequestingMembers(DecryptedRequestingMember.newBuilder().setUuid(UuidUtil.toByteString(admin1)).setProfileKey(ByteString.copyFrom(adminProfileKey.serialize())).setTimestamp(5000)).addRequestingMembers(DecryptedRequestingMember.newBuilder().setUuid(UuidUtil.toByteString(member1)).setProfileKey(ByteString.copyFrom(memberProfileKey.serialize())).setTimestamp(15000)).build().getRequestingMembersList(), decryptedGroup.getRequestingMembersList());
}
use of org.signal.zkgroup.profiles.ProfileKey in project Signal-Android by WhisperSystems.
the class DecryptedGroupUtil_apply_Test method apply_modify_member_profile_keys.
@Test
public void apply_modify_member_profile_keys() throws NotAbleToApplyGroupV2ChangeException {
ProfileKey profileKey1 = randomProfileKey();
ProfileKey profileKey2a = randomProfileKey();
ProfileKey profileKey2b = randomProfileKey();
DecryptedMember member1 = member(UUID.randomUUID(), profileKey1);
DecryptedMember member2a = member(UUID.randomUUID(), profileKey2a);
DecryptedMember member2b = withProfileKey(member2a, profileKey2b);
DecryptedGroup newGroup = DecryptedGroupUtil.apply(DecryptedGroup.newBuilder().setRevision(13).addMembers(member1).addMembers(member2a).build(), DecryptedGroupChange.newBuilder().setRevision(14).addModifiedProfileKeys(member2b).build());
assertEquals(DecryptedGroup.newBuilder().setRevision(14).addMembers(member1).addMembers(member2b).build(), newGroup);
}
Aggregations