use of org.signal.zkgroup.profiles.ProfileKey in project Signal-Android by WhisperSystems.
the class ProfileKeySetTest method new_requesting_member_if_not_editor_is_not_authoritative.
@Test
public void new_requesting_member_if_not_editor_is_not_authoritative() {
UUID editor = UUID.randomUUID();
UUID requesting = UUID.randomUUID();
ProfileKey profileKey = ProfileKeyUtil.createNew();
ProfileKeySet profileKeySet = new ProfileKeySet();
profileKeySet.addKeysFromGroupChange(changeBy(editor).requestJoin(requesting, profileKey).build());
assertTrue(profileKeySet.getAuthoritativeProfileKeys().isEmpty());
assertThat(profileKeySet.getProfileKeys(), is(Collections.singletonMap(ACI.from(requesting), profileKey)));
}
use of org.signal.zkgroup.profiles.ProfileKey in project Signal-Android by WhisperSystems.
the class ProfileKeySetTest method new_requesting_member_if_editor_is_authoritative.
@Test
public void new_requesting_member_if_editor_is_authoritative() {
UUID editor = UUID.randomUUID();
ProfileKey profileKey = ProfileKeyUtil.createNew();
ProfileKeySet profileKeySet = new ProfileKeySet();
profileKeySet.addKeysFromGroupChange(changeBy(editor).requestJoin(profileKey).build());
assertThat(profileKeySet.getAuthoritativeProfileKeys(), is(Collections.singletonMap(ACI.from(editor), profileKey)));
assertTrue(profileKeySet.getProfileKeys().isEmpty());
}
use of org.signal.zkgroup.profiles.ProfileKey in project Signal-Android by WhisperSystems.
the class ProfileKeySetTest method multiple_updates_overwrite.
@Test
public void multiple_updates_overwrite() {
UUID editor = UUID.randomUUID();
UUID member = UUID.randomUUID();
ProfileKey profileKey1 = ProfileKeyUtil.createNew();
ProfileKey profileKey2 = ProfileKeyUtil.createNew();
ProfileKeySet profileKeySet = new ProfileKeySet();
profileKeySet.addKeysFromGroupChange(changeBy(editor).profileKeyUpdate(member, profileKey1).build());
profileKeySet.addKeysFromGroupChange(changeBy(editor).profileKeyUpdate(member, profileKey2).build());
assertTrue(profileKeySet.getAuthoritativeProfileKeys().isEmpty());
assertThat(profileKeySet.getProfileKeys(), is(Collections.singletonMap(ACI.from(member), profileKey2)));
}
use of org.signal.zkgroup.profiles.ProfileKey in project Signal-Android by WhisperSystems.
the class ProfileKeySetTest method new_member_is_not_authoritative.
@Test
public void new_member_is_not_authoritative() {
UUID editor = UUID.randomUUID();
UUID newMember = UUID.randomUUID();
ProfileKey profileKey = ProfileKeyUtil.createNew();
ProfileKeySet profileKeySet = new ProfileKeySet();
profileKeySet.addKeysFromGroupChange(changeBy(editor).addMember(newMember, profileKey).build());
assertTrue(profileKeySet.getAuthoritativeProfileKeys().isEmpty());
assertThat(profileKeySet.getProfileKeys(), is(Collections.singletonMap(ACI.from(newMember), profileKey)));
}
use of org.signal.zkgroup.profiles.ProfileKey in project Signal-Android by WhisperSystems.
the class ProfileKeySetTest method new_member_by_self_promote_is_authoritative.
@Test
public void new_member_by_self_promote_is_authoritative() {
UUID newMember = UUID.randomUUID();
ProfileKey profileKey = ProfileKeyUtil.createNew();
ProfileKeySet profileKeySet = new ProfileKeySet();
profileKeySet.addKeysFromGroupChange(changeBy(newMember).promote(newMember, profileKey).build());
assertTrue(profileKeySet.getProfileKeys().isEmpty());
assertThat(profileKeySet.getAuthoritativeProfileKeys(), is(Collections.singletonMap(ACI.from(newMember), profileKey)));
}
Aggregations