use of org.signal.storageservice.protos.groups.local.DecryptedMember in project Signal-Android by signalapp.
the class DecryptedGroupUtilTest method can_extract_uuid_from_bad_decrypted_member.
@Test
public void can_extract_uuid_from_bad_decrypted_member() {
DecryptedMember decryptedMember = DecryptedMember.newBuilder().setUuid(ByteString.copyFrom(new byte[0])).build();
UUID parsed = DecryptedGroupUtil.toUuid(decryptedMember);
assertEquals(UuidUtil.UNKNOWN_UUID, parsed);
}
use of org.signal.storageservice.protos.groups.local.DecryptedMember in project Signal-Android by WhisperSystems.
the class DecryptedGroupUtil_apply_Test method cannot_remove_pending_member_if_not_in_group.
@Test
public void cannot_remove_pending_member_if_not_in_group() throws NotAbleToApplyGroupV2ChangeException {
DecryptedMember member1 = member(UUID.randomUUID());
UUID pendingUuid = UUID.randomUUID();
DecryptedGroup newGroup = DecryptedGroupUtil.apply(DecryptedGroup.newBuilder().setRevision(10).addMembers(member1).build(), DecryptedGroupChange.newBuilder().setRevision(11).addDeletePendingMembers(DecryptedPendingMemberRemoval.newBuilder().setUuidCipherText(ProtoTestUtils.encrypt(pendingUuid)).build()).build());
assertEquals(DecryptedGroup.newBuilder().setRevision(11).addMembers(member1).build(), newGroup);
}
use of org.signal.storageservice.protos.groups.local.DecryptedMember in project Signal-Android by WhisperSystems.
the class DecryptedGroupUtil_apply_Test method skip_promote_requesting_member_by_direct_add.
@Test
public void skip_promote_requesting_member_by_direct_add() throws NotAbleToApplyGroupV2ChangeException {
ProfileKey profileKey2 = randomProfileKey();
ProfileKey profileKey3 = randomProfileKey();
DecryptedMember member1 = member(UUID.randomUUID());
UUID requesting2Uuid = UUID.randomUUID();
UUID requesting3Uuid = UUID.randomUUID();
UUID requesting4Uuid = UUID.randomUUID();
DecryptedRequestingMember requesting2 = requestingMember(requesting2Uuid);
DecryptedRequestingMember requesting3 = requestingMember(requesting3Uuid);
DecryptedRequestingMember requesting4 = requestingMember(requesting4Uuid);
DecryptedMember member2 = member(requesting2Uuid, profileKey2);
DecryptedMember member3 = member(requesting3Uuid, profileKey3);
DecryptedGroup newGroup = DecryptedGroupUtil.apply(DecryptedGroup.newBuilder().setRevision(10).addMembers(member1).addRequestingMembers(requesting2).addRequestingMembers(requesting3).addRequestingMembers(requesting4).build(), DecryptedGroupChange.newBuilder().setRevision(11).addNewMembers(member2).addNewMembers(member3).build());
assertEquals(DecryptedGroup.newBuilder().setRevision(11).addMembers(member1).addMembers(member2).addMembers(member3).addRequestingMembers(requesting4).build(), newGroup);
}
use of org.signal.storageservice.protos.groups.local.DecryptedMember in project Signal-Android by WhisperSystems.
the class DecryptedGroupUtil_apply_Test method apply_new_member_already_in_the_group_by_uuid.
@Test
public void apply_new_member_already_in_the_group_by_uuid() throws NotAbleToApplyGroupV2ChangeException {
DecryptedMember member1 = member(UUID.randomUUID());
UUID member2Uuid = UUID.randomUUID();
DecryptedMember member2a = member(member2Uuid, newProfileKey());
DecryptedMember member2b = member(member2Uuid, newProfileKey());
DecryptedGroup newGroup = DecryptedGroupUtil.apply(DecryptedGroup.newBuilder().setRevision(10).addMembers(member1).addMembers(member2a).build(), DecryptedGroupChange.newBuilder().setRevision(11).addNewMembers(member2b).build());
assertEquals(DecryptedGroup.newBuilder().setRevision(11).addMembers(member1).addMembers(member2b).build(), newGroup);
}
use of org.signal.storageservice.protos.groups.local.DecryptedMember in project Signal-Android by WhisperSystems.
the class DecryptedGroupUtil_apply_Test method remove_pending_member.
@Test
public void remove_pending_member() throws NotAbleToApplyGroupV2ChangeException {
DecryptedMember member1 = member(UUID.randomUUID());
UUID pendingUuid = UUID.randomUUID();
DecryptedPendingMember pending = pendingMember(pendingUuid);
DecryptedGroup newGroup = DecryptedGroupUtil.apply(DecryptedGroup.newBuilder().setRevision(10).addMembers(member1).addPendingMembers(pending).build(), DecryptedGroupChange.newBuilder().setRevision(11).addDeletePendingMembers(DecryptedPendingMemberRemoval.newBuilder().setUuidCipherText(ProtoTestUtils.encrypt(pendingUuid)).build()).build());
assertEquals(DecryptedGroup.newBuilder().setRevision(11).addMembers(member1).build(), newGroup);
}
Aggregations