Search in sources :

Example 1 with GroupChange

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

the class GroupsV2Operations_decrypt_change_Test method cannot_decrypt_change_with_epoch_higher_than_known.

@Test
public void cannot_decrypt_change_with_epoch_higher_than_known() throws InvalidProtocolBufferException, VerificationFailedException, InvalidGroupStateException {
    GroupChange change = GroupChange.newBuilder().setChangeEpoch(GroupsV2Operations.HIGHEST_KNOWN_EPOCH + 1).build();
    Optional<DecryptedGroupChange> decryptedGroupChangeOptional = groupOperations.decryptChange(change, false);
    assertFalse(decryptedGroupChangeOptional.isPresent());
}
Also used : DecryptedGroupChange(org.signal.storageservice.protos.groups.local.DecryptedGroupChange) GroupChange(org.signal.storageservice.protos.groups.GroupChange) DecryptedGroupChange(org.signal.storageservice.protos.groups.local.DecryptedGroupChange) Test(org.junit.Test)

Example 2 with GroupChange

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

the class GroupsV2Operations_decrypt_change_Test method assertDecryption.

void assertDecryption(GroupChange.Actions.Builder inputChange, DecryptedGroupChange.Builder expectedDecrypted) {
    UUID editor = UUID.randomUUID();
    GroupChange.Actions actions = inputChange.setSourceUuid(groupOperations.encryptUuid(editor)).build();
    GroupChange change = GroupChange.newBuilder().setActions(actions.toByteString()).build();
    DecryptedGroupChange decryptedGroupChange = decrypt(change);
    assertEquals(expectedDecrypted.setEditor(UuidUtil.toByteString(editor)).build(), decryptedGroupChange);
}
Also used : DecryptedGroupChange(org.signal.storageservice.protos.groups.local.DecryptedGroupChange) GroupChange(org.signal.storageservice.protos.groups.GroupChange) DecryptedGroupChange(org.signal.storageservice.protos.groups.local.DecryptedGroupChange) UUID(java.util.UUID)

Aggregations

GroupChange (org.signal.storageservice.protos.groups.GroupChange)2 DecryptedGroupChange (org.signal.storageservice.protos.groups.local.DecryptedGroupChange)2 UUID (java.util.UUID)1 Test (org.junit.Test)1