Search in sources :

Example 51 with DecryptedGroup

use of org.signal.storageservice.protos.groups.local.DecryptedGroup in project Signal-Android by WhisperSystems.

the class GroupsV2Operations_decrypt_group_Test method avatar_field_passed_through_3.

@Test
public void avatar_field_passed_through_3() throws VerificationFailedException, InvalidGroupStateException {
    Group group = Group.newBuilder().setAvatar("AvatarCdnKey").build();
    DecryptedGroup decryptedGroup = groupOperations.decryptGroup(group);
    assertEquals("AvatarCdnKey", decryptedGroup.getAvatar());
}
Also used : Group(org.signal.storageservice.protos.groups.Group) DecryptedGroup(org.signal.storageservice.protos.groups.local.DecryptedGroup) DecryptedGroup(org.signal.storageservice.protos.groups.local.DecryptedGroup) Test(org.junit.Test)

Example 52 with DecryptedGroup

use of org.signal.storageservice.protos.groups.local.DecryptedGroup in project Signal-Android by WhisperSystems.

the class GroupsV2Operations_decrypt_group_Test method pass_through_access_control_field_5.

@Test
public void pass_through_access_control_field_5() throws VerificationFailedException, InvalidGroupStateException {
    AccessControl accessControl = AccessControl.newBuilder().setMembers(AccessControl.AccessRequired.ADMINISTRATOR).setAttributes(AccessControl.AccessRequired.MEMBER).setAddFromInviteLink(AccessControl.AccessRequired.UNSATISFIABLE).build();
    Group group = Group.newBuilder().setAccessControl(accessControl).build();
    DecryptedGroup decryptedGroup = groupOperations.decryptGroup(group);
    assertEquals(accessControl, decryptedGroup.getAccessControl());
}
Also used : Group(org.signal.storageservice.protos.groups.Group) DecryptedGroup(org.signal.storageservice.protos.groups.local.DecryptedGroup) AccessControl(org.signal.storageservice.protos.groups.AccessControl) DecryptedGroup(org.signal.storageservice.protos.groups.local.DecryptedGroup) Test(org.junit.Test)

Example 53 with DecryptedGroup

use of org.signal.storageservice.protos.groups.local.DecryptedGroup in project Signal-Android by WhisperSystems.

the class GroupChangeUtil_resolveConflict_decryptedOnly_Test method field_13__no_attribute_access_change_is_removed.

@Test
public void field_13__no_attribute_access_change_is_removed() {
    DecryptedGroup groupState = DecryptedGroup.newBuilder().setAccessControl(AccessControl.newBuilder().setAttributes(AccessControl.AccessRequired.ADMINISTRATOR)).build();
    DecryptedGroupChange decryptedChange = DecryptedGroupChange.newBuilder().setNewAttributeAccess(AccessControl.AccessRequired.ADMINISTRATOR).build();
    DecryptedGroupChange resolvedChanges = GroupChangeUtil.resolveConflict(groupState, decryptedChange).build();
    assertTrue(DecryptedGroupUtil.changeIsEmpty(resolvedChanges));
}
Also used : DecryptedGroupChange(org.signal.storageservice.protos.groups.local.DecryptedGroupChange) DecryptedGroup(org.signal.storageservice.protos.groups.local.DecryptedGroup) Test(org.junit.Test)

Example 54 with DecryptedGroup

use of org.signal.storageservice.protos.groups.local.DecryptedGroup in project Signal-Android by WhisperSystems.

the class GroupChangeUtil_resolveConflict_decryptedOnly_Test method field_10__no_title_change_is_removed.

@Test
public void field_10__no_title_change_is_removed() {
    DecryptedGroup groupState = DecryptedGroup.newBuilder().setTitle("Existing title").build();
    DecryptedGroupChange decryptedChange = DecryptedGroupChange.newBuilder().setNewTitle(DecryptedString.newBuilder().setValue("Existing title").build()).build();
    DecryptedGroupChange resolvedChanges = GroupChangeUtil.resolveConflict(groupState, decryptedChange).build();
    assertTrue(DecryptedGroupUtil.changeIsEmpty(resolvedChanges));
}
Also used : DecryptedGroupChange(org.signal.storageservice.protos.groups.local.DecryptedGroupChange) DecryptedGroup(org.signal.storageservice.protos.groups.local.DecryptedGroup) Test(org.junit.Test)

Example 55 with DecryptedGroup

use of org.signal.storageservice.protos.groups.local.DecryptedGroup in project Signal-Android by WhisperSystems.

the class GroupChangeUtil_resolveConflict_decryptedOnly_Test method field_21__announcement_change_is_preserved.

@Test
public void field_21__announcement_change_is_preserved() {
    DecryptedGroup groupState = DecryptedGroup.newBuilder().setIsAnnouncementGroup(EnabledState.DISABLED).build();
    DecryptedGroupChange decryptedChange = DecryptedGroupChange.newBuilder().setNewIsAnnouncementGroup(EnabledState.ENABLED).build();
    DecryptedGroupChange resolvedChanges = GroupChangeUtil.resolveConflict(groupState, decryptedChange).build();
    assertEquals(decryptedChange, resolvedChanges);
}
Also used : DecryptedGroupChange(org.signal.storageservice.protos.groups.local.DecryptedGroupChange) DecryptedGroup(org.signal.storageservice.protos.groups.local.DecryptedGroup) Test(org.junit.Test)

Aggregations

DecryptedGroup (org.signal.storageservice.protos.groups.local.DecryptedGroup)328 Test (org.junit.Test)306 DecryptedGroupChange (org.signal.storageservice.protos.groups.local.DecryptedGroupChange)182 UUID (java.util.UUID)110 GroupChange (org.signal.storageservice.protos.groups.GroupChange)58 ProfileKey (org.signal.zkgroup.profiles.ProfileKey)50 ProtoTestUtils.randomProfileKey (org.whispersystems.signalservice.api.groupsv2.ProtoTestUtils.randomProfileKey)46 DecryptedMember (org.signal.storageservice.protos.groups.local.DecryptedMember)44 ProtoTestUtils.newProfileKey (org.whispersystems.signalservice.api.groupsv2.ProtoTestUtils.newProfileKey)24 ProtoTestUtils.withProfileKey (org.whispersystems.signalservice.api.groupsv2.ProtoTestUtils.withProfileKey)24 Group (org.signal.storageservice.protos.groups.Group)22 ByteString (com.google.protobuf.ByteString)16 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)14 DecryptedPendingMember (org.signal.storageservice.protos.groups.local.DecryptedPendingMember)12 DecryptedRequestingMember (org.signal.storageservice.protos.groups.local.DecryptedRequestingMember)8 NonNull (androidx.annotation.NonNull)6 ArrayList (java.util.ArrayList)6 GroupDatabase (org.thoughtcrime.securesms.database.GroupDatabase)6 Nullable (androidx.annotation.Nullable)4 WorkerThread (androidx.annotation.WorkerThread)4