mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-05-08 17:29:02 +01:00
Update to libsignal-client 0.10.0, which includes zkgroup.
This commit is contained in:
committed by
Cody Henthorne
parent
f0ab919ca5
commit
7ccc7ec856
@@ -43,8 +43,6 @@ dependencies {
|
||||
|
||||
api libs.rxjava3.rxjava
|
||||
|
||||
api libs.signal.zkgroup.java
|
||||
|
||||
testImplementation testLibs.junit.junit
|
||||
testImplementation testLibs.assertj.core
|
||||
testImplementation testLibs.conscrypt.openjdk.uber
|
||||
|
||||
+2
-3
@@ -36,7 +36,6 @@ import org.signal.zkgroup.profiles.ClientZkProfileOperations;
|
||||
import org.signal.zkgroup.profiles.ProfileKey;
|
||||
import org.signal.zkgroup.profiles.ProfileKeyCredential;
|
||||
import org.signal.zkgroup.profiles.ProfileKeyCredentialPresentation;
|
||||
import org.signal.zkgroup.util.UUIDUtil;
|
||||
import org.whispersystems.libsignal.logging.Log;
|
||||
import org.whispersystems.libsignal.util.guava.Optional;
|
||||
import org.whispersystems.signalservice.api.util.UuidUtil;
|
||||
@@ -649,7 +648,7 @@ public final class GroupsV2Operations {
|
||||
return DecryptedPendingMember.newBuilder()
|
||||
.setUuid(UuidUtil.toByteString(uuid))
|
||||
.setUuidCipherText(userIdCipherText)
|
||||
.setAddedByUuid(ByteString.copyFrom(UUIDUtil.serialize(addedBy)))
|
||||
.setAddedByUuid(UuidUtil.toByteString(addedBy))
|
||||
.setRole(role)
|
||||
.setTimestamp(member.getTimestamp())
|
||||
.build();
|
||||
@@ -698,7 +697,7 @@ public final class GroupsV2Operations {
|
||||
}
|
||||
|
||||
private ByteString decryptUuidToByteString(ByteString userId) throws InvalidGroupStateException, VerificationFailedException {
|
||||
return ByteString.copyFrom(UUIDUtil.serialize(decryptUuid(userId)));
|
||||
return UuidUtil.toByteString(decryptUuid(userId));
|
||||
}
|
||||
|
||||
ByteString encryptUuid(UUID uuid) {
|
||||
|
||||
-1
@@ -7,7 +7,6 @@ import org.signal.storageservice.protos.groups.local.DecryptedGroupChange;
|
||||
import org.signal.storageservice.protos.groups.local.DecryptedMember;
|
||||
import org.signal.storageservice.protos.groups.local.DecryptedPendingMember;
|
||||
import org.signal.storageservice.protos.groups.local.DecryptedPendingMemberRemoval;
|
||||
import org.signal.zkgroup.util.UUIDUtil;
|
||||
import org.whispersystems.signalservice.api.util.UuidUtil;
|
||||
import org.whispersystems.signalservice.internal.util.Util;
|
||||
|
||||
|
||||
+4
-4
@@ -34,7 +34,7 @@ import org.signal.zkgroup.profiles.ProfileKeyCredentialResponse;
|
||||
import org.whispersystems.libsignal.util.guava.Optional;
|
||||
import org.whispersystems.signalservice.api.util.UuidUtil;
|
||||
import org.whispersystems.signalservice.internal.util.Util;
|
||||
import org.whispersystems.signalservice.testutil.ZkGroupLibraryUtil;
|
||||
import org.whispersystems.signalservice.testutil.LibSignalLibraryUtil;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.UUID;
|
||||
@@ -52,7 +52,7 @@ public final class GroupsV2Operations_decrypt_change_Test {
|
||||
|
||||
@Before
|
||||
public void setup() throws InvalidInputException {
|
||||
ZkGroupLibraryUtil.assumeZkGroupSupportedOnOS();
|
||||
LibSignalLibraryUtil.assumeLibSignalSupportedOnOS();
|
||||
|
||||
server = new TestZkGroupServer();
|
||||
groupSecretParams = GroupSecretParams.deriveFromMasterKey(new GroupMasterKey(Util.getSecretBytes(32)));
|
||||
@@ -142,7 +142,7 @@ public final class GroupsV2Operations_decrypt_change_Test {
|
||||
|
||||
@Test(expected = InvalidGroupStateException.class)
|
||||
public void cannot_decrypt_member_additions_with_bad_cipher_text_field3() throws InvalidProtocolBufferException, VerificationFailedException, InvalidGroupStateException {
|
||||
byte[] randomPresentation = Util.getSecretBytes(ProfileKeyCredentialPresentation.SIZE);
|
||||
byte[] randomPresentation = Util.getSecretBytes(5);
|
||||
GroupChange.Actions.Builder actions = GroupChange.Actions.newBuilder();
|
||||
|
||||
actions.addAddMembers(GroupChange.Actions.AddMemberAction.newBuilder()
|
||||
@@ -165,7 +165,7 @@ public final class GroupsV2Operations_decrypt_change_Test {
|
||||
|
||||
@Test(expected = InvalidGroupStateException.class)
|
||||
public void cannot_decrypt_member_removals_with_bad_cipher_text_field4() throws InvalidProtocolBufferException, VerificationFailedException, InvalidGroupStateException {
|
||||
byte[] randomPresentation = Util.getSecretBytes(UuidCiphertext.SIZE);
|
||||
byte[] randomPresentation = Util.getSecretBytes(5);
|
||||
GroupChange.Actions.Builder actions = GroupChange.Actions.newBuilder();
|
||||
|
||||
actions.addDeleteMembers(GroupChange.Actions.DeleteMemberAction.newBuilder()
|
||||
|
||||
+2
-2
@@ -9,7 +9,7 @@ import org.signal.zkgroup.InvalidInputException;
|
||||
import org.signal.zkgroup.groups.GroupMasterKey;
|
||||
import org.signal.zkgroup.groups.GroupSecretParams;
|
||||
import org.whispersystems.signalservice.internal.util.Util;
|
||||
import org.whispersystems.signalservice.testutil.ZkGroupLibraryUtil;
|
||||
import org.whispersystems.signalservice.testutil.LibSignalLibraryUtil;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
@@ -22,7 +22,7 @@ public final class GroupsV2Operations_decrypt_groupJoinInfo_Test {
|
||||
|
||||
@Before
|
||||
public void setup() throws InvalidInputException {
|
||||
ZkGroupLibraryUtil.assumeZkGroupSupportedOnOS();
|
||||
LibSignalLibraryUtil.assumeLibSignalSupportedOnOS();
|
||||
|
||||
TestZkGroupServer server = new TestZkGroupServer();
|
||||
ClientZkOperations clientZkOperations = new ClientZkOperations(server.getServerPublicParams());
|
||||
|
||||
+2
-2
@@ -39,7 +39,7 @@ import org.signal.zkgroup.profiles.ProfileKeyCredentialResponse;
|
||||
import org.whispersystems.libsignal.util.guava.Optional;
|
||||
import org.whispersystems.signalservice.api.util.UuidUtil;
|
||||
import org.whispersystems.signalservice.internal.util.Util;
|
||||
import org.whispersystems.signalservice.testutil.ZkGroupLibraryUtil;
|
||||
import org.whispersystems.signalservice.testutil.LibSignalLibraryUtil;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.UUID;
|
||||
@@ -56,7 +56,7 @@ public final class GroupsV2Operations_decrypt_group_Test {
|
||||
|
||||
@Before
|
||||
public void setup() throws InvalidInputException {
|
||||
ZkGroupLibraryUtil.assumeZkGroupSupportedOnOS();
|
||||
LibSignalLibraryUtil.assumeLibSignalSupportedOnOS();
|
||||
|
||||
TestZkGroupServer server = new TestZkGroupServer();
|
||||
ClientZkOperations clientZkOperations = new ClientZkOperations(server.getServerPublicParams());
|
||||
|
||||
+2
-2
@@ -9,7 +9,7 @@ import org.signal.zkgroup.profiles.ProfileKeyCredentialPresentation;
|
||||
import org.signal.zkgroup.profiles.ProfileKeyCredentialRequest;
|
||||
import org.signal.zkgroup.profiles.ProfileKeyCredentialResponse;
|
||||
import org.signal.zkgroup.profiles.ServerZkProfileOperations;
|
||||
import org.whispersystems.signalservice.testutil.ZkGroupLibraryUtil;
|
||||
import org.whispersystems.signalservice.testutil.LibSignalLibraryUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@@ -22,7 +22,7 @@ final class TestZkGroupServer {
|
||||
private final ServerZkProfileOperations serverZkProfileOperations;
|
||||
|
||||
TestZkGroupServer() {
|
||||
ZkGroupLibraryUtil.assumeZkGroupSupportedOnOS();
|
||||
LibSignalLibraryUtil.assumeLibSignalSupportedOnOS();
|
||||
|
||||
ServerSecretParams serverSecretParams = ServerSecretParams.generate();
|
||||
|
||||
|
||||
-19
@@ -3,7 +3,6 @@ package org.whispersystems.signalservice.api.util;
|
||||
import com.google.protobuf.ByteString;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.signal.zkgroup.util.UUIDUtil;
|
||||
import org.whispersystems.libsignal.util.Hex;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -50,24 +49,6 @@ public final class UuidUtilTest {
|
||||
assertEquals("b83dfb0b-67f1-41aa-992e-030c167cd011", uuid.toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void byte_array_compatibility_with_zk_group_uuid_util() {
|
||||
UUID uuid = UUID.fromString("67dfd496-ea02-4720-b13d-83a462168b1d");
|
||||
|
||||
UUID result = UUIDUtil.deserialize(UuidUtil.toByteArray(uuid));
|
||||
|
||||
assertEquals(uuid, result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void byte_string_compatibility_with_zk_group_uuid_util() {
|
||||
UUID uuid = UUID.fromString("67dfd496-ea02-4720-b13d-83a462168b1d");
|
||||
|
||||
UUID result = UuidUtil.fromByteString(ByteString.copyFrom(UUIDUtil.serialize(uuid)));
|
||||
|
||||
assertEquals(uuid, result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void byte_string_round_trip() {
|
||||
UUID uuid = UUID.fromString("67dfd496-ea02-4720-b13d-83a462168b1d");
|
||||
|
||||
-45
@@ -1,45 +0,0 @@
|
||||
package org.whispersystems.signalservice.testutil;
|
||||
|
||||
import org.signal.zkgroup.internal.Native;
|
||||
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.junit.Assume.assumeNoException;
|
||||
|
||||
public final class ZkGroupLibraryUtil {
|
||||
|
||||
private ZkGroupLibraryUtil() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempts to initialize the ZkGroup Native class, which will load the native binaries.
|
||||
* <p>
|
||||
* If that fails to link, then on Unix, it will fail as we rely on that for CI.
|
||||
* <p>
|
||||
* If that fails to link, and it's not Unix, it will skip the test via assumption violation.
|
||||
* <p>
|
||||
* If using inside a PowerMocked test, the assumption violation can be fatal, use:
|
||||
* {@code @PowerMockRunnerDelegate(JUnit4.class)}
|
||||
*/
|
||||
public static void assumeZkGroupSupportedOnOS() {
|
||||
try {
|
||||
Class.forName(Native.class.getName());
|
||||
} catch (ClassNotFoundException e) {
|
||||
fail();
|
||||
} catch (UnsatisfiedLinkError | NoClassDefFoundError e) {
|
||||
String osName = System.getProperty("os.name");
|
||||
|
||||
if (isUnix(osName)) {
|
||||
fail("Not able to link native ZkGroup on a key OS: " + osName);
|
||||
} else {
|
||||
assumeNoException("Not able to link native ZkGroup on this operating system: " + osName, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isUnix(String osName) {
|
||||
assertNotNull(osName);
|
||||
osName = osName.toLowerCase();
|
||||
return osName.contains("nix") || osName.contains("nux") || osName.contains("aix");
|
||||
}
|
||||
}
|
||||
@@ -39,13 +39,10 @@ dependencyVerification {
|
||||
['org.reactivestreams:reactive-streams:1.0.3',
|
||||
'1dee0481072d19c929b623e155e14d2f6085dc011529a0a0dbefc84cf571d865'],
|
||||
|
||||
['org.signal:zkgroup-java:0.8.2',
|
||||
'eaae035a974e0179052d9b90fb4dc4d5b8bd2fdb0b20ed36824f2bdf9fb6dd36'],
|
||||
|
||||
['org.threeten:threetenbp:1.3.6',
|
||||
'f4c23ffaaed717c3b99c003e0ee02d6d66377fd47d866fec7d971bd8644fc1a7'],
|
||||
|
||||
['org.whispersystems:signal-client-java:0.9.7',
|
||||
'b9c141324db38e940e910c71d3c8474679a9f6f46c4d4f3116ec63a1e1368ffc'],
|
||||
['org.whispersystems:signal-client-java:0.10.0',
|
||||
'e32606dfab66f9c4a1356da988ae51f55e52a30669621da94ae4032d7e5c5528'],
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user